All Projects → mathtone → MIST

mathtone / MIST

Licence: MIT License
Implements change notification for properties (ie: INotifyPropertyChanged) using IL weaving and a custom Visual Studio build task.

Programming Languages

C#
18002 projects
powershell
5483 projects

Projects that are alternatives of or similar to MIST

Mvvmcross
The .NET MVVM framework for cross-platform solutions, including Xamarin.iOS, Xamarin.Android, Windows and Mac.
Stars: ✭ 3,594 (+6947.06%)
Mutual labels:  visual-studio, nuget, mvvm
Computesharp
A .NET 5 library to run C# code in parallel on the GPU through DX12 and dynamically generated HLSL compute shaders, with the goal of making GPU computing easy to use for all .NET developers! 🚀
Stars: ✭ 982 (+1825.49%)
Mutual labels:  visual-studio, nuget
Visualstudiorevittemplate
Visual Studio project template for Revit add-in development. (using WPF and MVVM)
Stars: ✭ 22 (-56.86%)
Mutual labels:  visual-studio, mvvm
Monogame.forms
MonoGame.Forms is the easiest way of integrating a MonoGame render window into your Windows Forms project. It should make your life much easier, when you want to create your own editor environment.
Stars: ✭ 165 (+223.53%)
Mutual labels:  visual-studio, nuget
Framework
Machine learning, computer vision, statistics and general scientific computing for .NET
Stars: ✭ 4,177 (+8090.2%)
Mutual labels:  visual-studio, nuget
Windowscommunitytoolkit
The Windows Community Toolkit is a collection of helpers, extensions, and custom controls. It simplifies and demonstrates common developer tasks building UWP and .NET apps for Windows 10. The toolkit is part of the .NET Foundation.
Stars: ✭ 4,654 (+9025.49%)
Mutual labels:  visual-studio, mvvm
Msbuild.sdk.sqlproj
An MSBuild SDK that provides similar functionality to SQL Server Data Tools (.sqlproj) projects
Stars: ✭ 142 (+178.43%)
Mutual labels:  visual-studio, nuget
Krypton Net 5.470
A update to Component factory's krypton toolkit to support the .NET 4.7 framework.
Stars: ✭ 79 (+54.9%)
Mutual labels:  visual-studio, nuget
Krypton-Toolkit-Suite-Extended-NET-5.470
An extension to the Krypton Toolkit suite of controls for .NET framework 4.7
Stars: ✭ 51 (+0%)
Mutual labels:  visual-studio, nuget
UnityAssemblies
Simple, forward-compatible references to ANY Unity DLL on ANY platform.
Stars: ✭ 65 (+27.45%)
Mutual labels:  visual-studio, nuget
EmptyLicensesLicx
Easy continuous integration of apps using third-party controls that rely on licenses.licx files
Stars: ✭ 57 (+11.76%)
Mutual labels:  visual-studio, nuget
Professionalcsharp7
Code samples for the book Professional C# 7 and .NET Core 2.0 (with updates for 2.1), Wrox Press
Stars: ✭ 403 (+690.2%)
Mutual labels:  visual-studio, mvvm
Bing-Maps-V8-TypeScript-Definitions
This project contains the TypeScript definitions for the Bing Maps V8 Web Control.
Stars: ✭ 36 (-29.41%)
Mutual labels:  visual-studio, nuget
Prism
Prism is a framework for building loosely coupled, maintainable, and testable XAML applications in WPF, Xamarin Forms, and Uno / Win UI Applications..
Stars: ✭ 4,842 (+9394.12%)
Mutual labels:  visual-studio, mvvm
MonoGame.Forms
MonoGame.Forms is the easiest way of integrating a MonoGame render window into your Windows Forms project. It should make your life much easier, when you want to create your own editor environment.
Stars: ✭ 183 (+258.82%)
Mutual labels:  visual-studio, nuget
Bridge
♠️ C# to JavaScript compiler. Write modern mobile and web apps in C#. Run anywhere with Bridge.NET.
Stars: ✭ 2,216 (+4245.1%)
Mutual labels:  visual-studio, nuget
Standard-Toolkit
An update to Component factory's krypton toolkit to support .NET Framework 4.6.2 - 4.8.1 to .NET Core/.NET
Stars: ✭ 194 (+280.39%)
Mutual labels:  visual-studio, nuget
TfsCmdlets
PowerShell Cmdlets for Azure DevOps and Team Foundation Server
Stars: ✭ 75 (+47.06%)
Mutual labels:  visual-studio, nuget
lockd
Generate strong passwords and save them in Keychain. Made with SwiftUI
Stars: ✭ 38 (-25.49%)
Mutual labels:  mvvm
Nineties
💾 Colors for World Wide Web pioneers
Stars: ✭ 16 (-68.63%)
Mutual labels:  visual-studio

MIST

Implements change notification for properties (ie: INotifyPropertyChanged) using IL weaving and a custom Visual Studio build task.

This is how it works:

The NuGet package now covers .NET framework versions 4.0-4.7.

  1. Create a WPF project in visual studio, Target any framework 4.0 - 4.7 (if there's any favorable response I'll set up other frameworks in the NuGet package, what I've done should mostly work for all of them)
  2. In the package manager type the NuGet command: install-package Mathtone.MIST. Visual Studio will prompt you to reload the project.
  3. This should set everything up, adding a reference to the Mathtone.MIST assembly (which only contains the attribute classes you will use to decorate your code), copying the Mathtone.MIST.Builder and Mono.Cecil (this is the framework that does the actual weaving of IL operations, a fine piece of work) assemblies to the NuGet package "tools" folder. Additionally, it executes a nonthreatening script that modifies your project file and adds the post build task.

Using MIST from Nuget.org

  1. Install MIST build components (available from nuget.org) in the project containing classes for which you would like notification to be automatically implemented.

Install-Package Mathtone.MIST

  1. If you unload and Edit the project file, it should contain a build task similar to the following:The location of the Mathtone.MIST.Builder assembly is the default and can be changed by modifying your local Nuget.config file (If you install MIST via the nuget package, this should be handled for you).

<UsingTask TaskName="Mathtone.MIST.NotificationWeaverBuildTask" AssemblyFile="$(ProjectDir)..\packages\Mathtone.MIST.1.0.1\tools\Mathtone.MIST.Builder.dll" /> <Target Name="AfterBuild"> <NotificationWeaverBuildTask TargetPath="$(TargetPath)" DebugMode="True" /> </Target>

Apply notification attributes

  1. Use the "NotifierAttribute", "NotifyAttribute" and "NotifyTargetAttributte"

Typical usage scenario:

public class NotifierBase : INotifyPropertyChanged {

	[NotifyTarget]
	protected void RaisePropertyChanged(string propertyName) {
		var method = PropertyChanged;
		if (method != null) {
			PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
		}
	}

	public event PropertyChangedEventHandler PropertyChanged;
}

[Notifier(NotificationMode.Implicit)]
public class ImplicitTestNotifier : NotifierBase {

	public string Property1 { get; set; }

	public string Property2 { get; set; }

	public string Property3 { get; set; }

	[SupressNotify]
	public string Supressed { get; set; }

	[Notify("Prop1And2", "Property1", "Property2")]
	public string Prop1And2 { get; set; }
}

[Notifier]
public class ExplicitTestNotifier : NotifierBase {

	[Notify]
	public string Property1 { get; set; }

	[Notify]
	public string Property2 { get; set; }

	[Notify]
	public string Property3 { get; set; }

	public string Supressed { get; set; }

	[Notify("Prop1And2", "Property1", "Property2")]
	public string Prop1And2 { get; set; }
}

If it's all wired up correctly, you should see a message in the build output window: "Lightly Misting: <your project output>" at build time.

OnChange Notification:

Additionally, the MIST utility supports notification only when the value being set changes from a previous value. This is controlled by setting the notifycation style to NotificationStyle.OnChange and this can be applied to the NotifierAttribute as a default, or the NotifyAttribute as an override. This method respects all known conventions (at least those known to me) for the comparing of equality among value & reference types, including overridden "Equals" methods, etc:

   [Notifier(NotificationMode.Implicit, NotificationStyle.OnChange)]
public class OnChangeTest : TestNotifierBase
{
	public string StringValue { get; set; } = "";

	[Notify(NotificationStyle.OnSet)]
	public string ExplicitOnSetString { get; set; }
}

Happy coding!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].