Releases: DepthRel/Toolkit
Releases · DepthRel/Toolkit
Release list
Toolkit: 1.6.0; Toolkit.Components: 1.0.0; Toolkit.UI.WPF: 1.0.0
What's new
Platform specific parts have been moved to the Toolkit.Components project, such as BaseViewModel. Created a Toolkit.UI.WPF project to implement WPF dependent entities.
Toolkit
- Contract
StringNotNullOrWhiteSpace, andNotNulloverloads return the passed value if no exception was thrown.
Examples of using:
int first = 1;
int second = 20;
Extensions.Swap(ref first, ref second); // Now first is 20 and second is 1- AppSettings
- Added serialization and deserialization.
Examples of using:
AppSettings.Setting["value"] = "value";
var SerializedJSON = AppSettings.Setting.SerializeToJSON();
var SerializedXML = AppSettings.Setting.SerializeToXML();- Added the ability to get a value without throwing an exception in the absence of a key.
Examples of using:
AppSettings.Setting["value"] = "value";
var result = AppSettings.Setting.TryGetSetting<string>("value");Toolkit.Components
- ViewModels
- BaseViewModel and RelayCommand are moved to this project.
- Notifications
- Interfaces IMessage and IRequest have been created to encapsulate requests to the user. IMessage is for simply displaying a message, and IRequest is for returning results from requests.
Toolkit.UI.WPF
- Controls
- PlaceholderTextBox, NumberBox, FontIcon controls have been created. More details at wiki
- Created a custom dialog control similar to the native UWP dialog: DialogBox.
1.5.0
What's new
- Extensions
- Added a method of changing the value of two variables in places.
Examples of using:
int first = 1;
int second = 20;
Extensions.Swap(ref first, ref second); // Now first is 20 and second is 1- AppSettings
- The
AppSettingsclass designed to store settings by key.
Examples of using:
string name = "Dev";
AppSettings.Setting["name"] = name;
var storedValue = (string)AppSettings.Setting["name"]- Range
- The
Rangeclass designed to work at intervals. It can be useful when comparing time intervals, or for checking membership in a number range.
Examples of using:
var interval = new Range<int>(1, 10);
if (interval.Beyond(5) || !interval.Between(12))
{
// Some logic
}- Other
- The
Conditionclass moved to root namespace from Sequences.
1.4.0
What's new
- Condition
- The
Conditionclass allows to build chains of Boolean expressions in a more readable style for a large number of expressions.
Examples of using:
if (Condition
.Check(IsNowAllowed()
.Not()
.And(value == 10)
.AndNot(condition == false)
.OrNot(string.IsNullOrWhiteSpace(line)))
{
// Some code
}- Extensions
- The
Extensionsclass designed for extension methods and static class methods analogues. This class will be replenished in the future with new methods.
Examples of using:
var list = new List<int>() { 1, 2, 3, 4, 5 };
list = list.Reorder().ToList();
Console.WriteLine(string.Join(" ", list));
list = Sequences.Reorder(list).ToList();
Console.WriteLine(string.Join(" ", list));1.3.0
What's new
- Is
- The
Iscontract takes a boolean expression value.
Examples of using:
string str = "string";
Contract.Is<ArgumentNullException>(str != null);
Contract.Is<ArgumentException>(str != "string"); // ArgumentException !!!- The
IsNotcontract takes a boolean expression value and acts back to the contractIs
Examples of using:
string str = "string";
Contract.IsNot<ArgumentNullException>(str != null); // ArgumentNullException !!!
Contract.IsNot<ArgumentException>(str != "string");1.2.0
What's new
- RelayCommand
- The
RelayCommandclass is added that implements theICommandinterface for more flexible configuration of commands.
Examples of using:
ICommand Command
{
get => new RelayCommand(
arg =>
{
list.Clear();
});
}- Added generic version of
RelayCommand<T>class
- Check
- A static
Checkclass has been added to test logical expressions. TheCheckclass represents methods similar to contract methods, but if it does not match the expected values, it returns aboolvalue instead of throwing an exception.
Examples of using:
DateTime.TryParse(value, out var date);
if (Check.MoreOrEqualThan(date, DateTime.Today))
{
// Some code
}First release
What's new
- BaseViewModel
-
The basic implementation of the
INotifyPropertyChangedinterface and theOnPropertyChangedmethod for notifying about a change in the observed value. -
Implementation of the generalized
SetPropertymethod for setting a property and automatic notification of a change in a property.
- Contract
- String checks
Instead this:
if (string.IsNullOrWhiteSpace(str?.Trim()))
{
throw new Exception("The value is incorrect");
}Just write:
Contract.StringNotNullOrWhiteSpace<Exception>(str);- The same goes for null checks
Contract.NotNull<object, ArgumentNullException>(obj);- Logic checks
Contract.MoreOrEqualThan<int, InvalidOperationException>(first, second);- And many others...