Giter Site home page Giter Site logo

beshoyhindy / commonhelpers Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lancemccarthy/commonhelpers

0.0 1.0 0.0 2.39 MB

A set of very frequently used classes, interfaces, and behaviors used in every day projects.

License: MIT License

C# 99.64% PowerShell 0.36%

commonhelpers's Introduction

CommonHelpers

This is a cross platform NET Standard 2.0 helper library containing a bunch of helper code that I used to rewrite several times a day while creating sample apps for developers.

By publishing this is as a signed NuGet package I save myself a lot of time, but more importantly, I get to share it with you. Enjoy!

Releases

NuGet.org (stable) Azure Artifacts Feed (preview)
# CommonHelpers package in MainFeed feed in Azure Artifacts

CI-CD

Workflow Status
main Main
dev Development
prerelease Release to GitHub Packages
release Release to NuGet.org

Azure Pipelines

Branch Status
dev dev
main (default) main
release Build status

Features

Extensions

Extensions for commonly used objects like string, DateTime, enum. There are also some special extensions for File, Exception and Color. Finally, there's a unqiue helper, HttpClientExtensions which provides download progress insights and a helper method to POST image data.

Collections

Special collection types that help in special scenarios (e.g. ObservableQueue and ObservableRangeCollection).

Common

This folder has some of the most frequently used classes (i.e. BindableBase, ViewModelBase, JsonHelper).

MVVM

Platform agnostic MVVM classes like DelegateCommand and RelayCommand.

Services

To make testing UI controls easier by quickly providing well formatted data from offline sample data and online API endpoints. This is really useful for quickly testing Load On Demand scenarios.

  • BingImageService
  • ComicVineApiService
  • SampleDataService
  • XkcdApiService

ComicVineService requires an API Key (it's free). All other services do not require an API key, just new up the class and start using it.

Examples

Sample Data Service

This is my most frequently used service. You can easily spin up data for Lists, Charts, DataGrids and more with a single method.

var sampleDataService = new SampleDataService();

BarSeriesData.AddRange(sampleDataService.GenerateCategoricalData());
ScatterSeriesData.AddRange(sampleDataService.GenerateScatterPointData());
LineSeriesData.AddRange(sampleDataService.GenerateDateTimeMinuteData());
SplineAreaSeriesData.AddRange(sampleDataService.GenerateDateTimeDayData());
People.AddRange(sampleDataService.GeneratePeopleData());

Sample Data Service

BingImageService

Easily fetch the Bing Image of Day.

using (var bingImageService = new BingImageService())
{
    var result = await bingImageService.GetBingImageOfTheDayAsync();
    image.Source = new UriImageSource{Uri = result};
}

Bing ImageService

xkcd API Service

Getting today's comic by calling GetNewestComic or get any comic by using GetComicAsync(comicNumber).

var xkcdService = new XkcdApiService();

// to fetch a comic, get the latest or pass a specific comic ID
XkcdComic xkcdComic;

if (lastXkcdComicNumber == 0)
{
    xkcdComic = await xkcdService.GetNewestComicAsync();
}
else
{
    xkcdComic = await xkcdService.GetComicAsync(lastXkcdComicNumber - 1);
}

lastXkcdComicNumber = xkcdComic.Num;

// This is an `ObservableQueue` (located in CommonHelpers.Collections)      
XkcdComics.Enqueue(xkcdComic);

xkcd Image Service

ComicVineApiService

The ComicVine API is the only service in which you'll need an API key. You pass the key and a unique string name for your app to the constructor. Now you have access to thousands of items like Characters, Videos and more from the service.

var comicVineService = new ComicVineApiService(ApiKeys.ComicVineApiKey, ApiKeys.UniqueUserAgentString);

var apiResult = await comicVineService.GetCharactersAsync(CurrentCharactersCount);
CurrentCharactersCount = apiResult.Offset + apiResult.NumberOfPageResults;
TotalCharactersCount = apiResult.NumberOfTotalResults;

var characters = apiResult.Results;

ComicVine API Service

  • Updating to be included in the Arctic Code Vault

commonhelpers's People

Contributors

lancemccarthy avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.