Crysta 1.2.1

dotnet add package Crysta --version 1.2.1
NuGet\Install-Package Crysta -Version 1.2.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Crysta" Version="1.2.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Crysta --version 1.2.1
#r "nuget: Crysta, 1.2.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Crysta as a Cake Addin
#addin nuget:?package=Crysta&version=1.2.1

// Install Crysta as a Cake Tool
#tool nuget:?package=Crysta&version=1.2.1

Crysta

Introduction

The "Crysta" is a helper library for developments in .NET Application.

How to use

At first, declares some reference to the namespace as below.

using Crysta;
using Crysta.Events;
using System.Windows.Input;

The "Crysta" library has a generic class called "Presenter<T>" that is used as a base for all presenter class. And then you impliment a new class (In example. Named "MainPresenter") will be subclassed from it.

namespace SampleProject;

/// <summary>
/// A sample presenter class that based on M-V-P design pattern. It's dedicated the <see cref="MainWindow"/> view class.
/// </summary>
internal class MainPresenter : Presenter<MainWindow>
{
	
}

Examples

The example of declarating binding properties.

namespace SampleProject;

internal class MainPresenter : Presenter<MainWindow>
{

	// --- [Example 1] ---
	// Implementation property example of a legacy declaration.
	private int _Number1 = 0;
	public int Number1
	{
		get => _Number1;
		set
		{
			if(_Number1 != value) {
				_Number1 = value;
				Raise(nameof(Number1)); // Equivalent to "INotifyPropertyChanged.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Number1)));"
			}
		}
	}

	// --- [Example 2] ---
	// Implementation example of "Prism" like declaration.
	private int _Number1_F = 0;
	public int Number1_F 
	{ 
		get => _Number1_F; 
		set => SetProperty(ref _Number1_F, value);
	}

	// --- [Example 3] ---
	// The new way of declaration that is made to possible by "Crysta" backing-store service.
	public int Number1_C 
	{ 
		get => Get(initial:0); 
		set => Set(value);
	}

	// --- [Example 3-A] ---
	// "Example 3" can also be written as below.
	public int Number1_C 
	{ 
		get => Get(initial:0); 
		set {
			if(Set(value).IsChanged) {
				// Any logic executes when the value changed.
			}
		}
	}

}

The example of declarating commands.

namespace SampleProject;

internal class MainPresenter : Presenter<MainWindow>
{

	// --- [Example 1] ---
	// Implementation command example of a legacy declaration.
	private ICommand? _Command_1;
	public ICommand Command_1 => _Command_1 ??= new AnyCommand(() => { 
		// Do any stuff
	});
	
	// --- [Example 1-A] ---
	// "Example 1" can also be written as below.
	public ICommand Command_1A => Command(() => { 
		// Do any stuff
	});
  
    // --- [Example 1-B] ---
	// Asynchronous method can be written as below.
	public ICommand Command_1B => Command(async () => { 
		// Do any stuff
	});

	// --- [Example 2] ---
	// When to use specified arguments.
	public ICommand Shape1_MouseLeftButtonDown => Command<MouseButtonEventArgs>(e => {

		if(e.ButtonState == MouseButtonState.Pressed)
		{
			// Do stuff
		}

	});

	// --- [Example 3] ---
	// When to use any RoutedEventArgs, a type argument can be omitted.
	public ICommand TextBox1_TextChanged => Command(e => {

		// Access to RoutedEventArgs any properties.
		var source  = e.Source;
		
		// Do stuff

		e.Handled = true;

	});

}

Product Compatible and additional computed target framework versions.
.NET net5.0-windows7.0 is compatible.  net6.0-windows was computed.  net7.0-windows was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.1 342 1/15/2024
1.2.0 422 11/25/2023