Crysta.Core 2.0.0

dotnet add package Crysta.Core --version 2.0.0
                    
NuGet\Install-Package Crysta.Core -Version 2.0.0
                    
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.Core" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Crysta.Core" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Crysta.Core" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Crysta.Core --version 2.0.0
                    
#r "nuget: Crysta.Core, 2.0.0"
                    
#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.
#:package Crysta.Core@2.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Crysta.Core&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Crysta.Core&version=2.0.0
                    
Install as a Cake Tool

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.  net9.0-windows was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net5.0-windows7.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Crysta.Core:

Package Downloads
Crysta

Supports development using the MVVM architecture in WPF.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.0 172 3/19/2025