Giter Club home page Giter Club logo

easy's Introduction

Easy

A library that makes developing for WinRT easy (well, easier).

The code is being currently used in WriteRT, a creative writing Windows Store app.

Get it from NuGet:

PM> Install-Package Easy

Classes

Easy.IO.AutoSave

Abstract base class for auto-save functionality, wraps a timer that periodically performs a save based on the given ISaveProvider (below).

Easy.IO.AutoSaveString

Specialization of AutoSave<T> for an ISaveProvider<string>, enables auto-save functionality.

// Initialize an auto-save every 10 seconds
var autoSave = new AutoSaveString(provider, TimeSpan.FromSeconds(10));

// Starts atuo-saving every 10 seconds
autoSave.Start();

...

// Stops auto-saving
autoSave.Stop();

Easy.IO.AutoSaveBytes

Specialization of AutoSave<T> for an ISaveProvider<bytes[]>, similar to the AutoSaveString above.

Easy.IO.File

Can create unique temporary files and perform transactional file saves.

// Temporary file with guaranteed unique name
IStorageFile temp = await File.CreateTemporaryFileAsync();

// Transactional file save
await File.SaveAsync(temp, "some content");

Easy.IO.ISaveProvider

A generic interface which provides an IStorageFile object as the DestinationFile property and data to be saved of type T as the Data property. Classes implementing this interface would encapsulate all data required to perform a file save (the file to save to and the data to be saved).

Easy.Platform.Setting

A setting with a default value in case its key is not in the data container.

// Local "foo" setting, default value is 0
var foo = Setting<int>.Local("foo");

// Roaming "bar" setting, default value is "baz"
var bar = Setting<string>.Roaming("bar", "baz");

foo.Value = 42;  // setting associated with foo is now 42
string x = bar.Value; // x is now "baz"

Easy.Text.Highlight.BaseHighlighter

Abstract class from which highlighters should derive. Deriving classes need to implement the DefaultFormatting method which should reset formatting to (non-highlighted) default and the AddHighlightRules which should contain a list of calls to AddHighligtRule, mapping regular expressions to formatting actions.

Look at Easy.Text.Highlight.Markdown for a sample implementation.

Note highlighting can only run on the UI thread because the ITextDocument and other involved WinRT objects cannot be used on other threads.

Easy.Text.Highlight.Markdown

Provides Markdown highlighting for a given ITextDocument.

var highlighter = new Markdown(SomeTextDocument);

// Applies Markdown formatting on the given text
highlighter.Highlight();

Easy.Text.Search

Enables string search on an ITextDocument, selecting the found string.

var search = new Search(SomeTextDocument);

// Highlights the first instance of 'foo' in the text
search.FindFirst("foo"); 

// Highlights the next instance of 'bar' after the previously found 'foo'
search.FindNext("bar"); 

...

// Search wraps around to the beginning of the text
search.FindNext("bar"); 

Easy.Text.WordCount

Provides asynchronous word count on an ITextDocument.

var wordCount = new WordCount(SomeTextDocument);

int words = await wordCount.Count(); 

Easy.UI.Toast

Easily display toast messages. Currently supports text or title + text. Don't forget to mark your app as toast capable in its manifest.

Toast.Show("A toast!");

Toast.Show("Title", "Some content");

License

Copyright (c) 2013-2014 Vlad Riscutia

Microsoft Public License

easy's People

Contributors

vladris avatar

Stargazers

 avatar

Watchers

 avatar  avatar  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.