Skip to content

Releases: DepthRel/Toolkit

Toolkit: 1.6.0; Toolkit.Components: 1.0.0; Toolkit.UI.WPF: 1.0.0

19 Sep 12:49
Compare
Choose a tag to compare

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, and NotNull overloads 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

29 Jun 20:44
Compare
Choose a tag to compare

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 AppSettings class designed to store settings by key.
    Examples of using:
    string name = "Dev";
    AppSettings.Setting["name"] = name;

    var storedValue = (string)AppSettings.Setting["name"]

- Range

  • The Range class 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 Condition class moved to root namespace from Sequences.

1.4.0

11 Jun 19:27
Compare
Choose a tag to compare

What's new

- Condition

  • The Condition class 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 Extensions class 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

24 May 20:57
Compare
Choose a tag to compare

What's new

- Is

  • The Is contract takes a boolean expression value.
    Examples of using:
    string str = "string";
    Contract.Is<ArgumentNullException>(str != null);
    Contract.Is<ArgumentException>(str != "string"); // ArgumentException !!!
  • The IsNot contract takes a boolean expression value and acts back to the contract Is
    Examples of using:
    string str = "string";
    Contract.IsNot<ArgumentNullException>(str != null); // ArgumentNullException !!!
    Contract.IsNot<ArgumentException>(str != "string");

1.2.0

10 Apr 07:39
Compare
Choose a tag to compare

What's new

- RelayCommand

  • The RelayCommand class is added that implements the ICommand interface 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 Check class has been added to test logical expressions. The Check class represents methods similar to contract methods, but if it does not match the expected values, it returns a bool value instead of throwing an exception.
    Examples of using:
    DateTime.TryParse(value, out var date);
    if (Check.MoreOrEqualThan(date, DateTime.Today))
    {
        // Some code
    }

First release

08 Apr 13:41
74f499a
Compare
Choose a tag to compare

What's new

- BaseViewModel

  • The basic implementation of the INotifyPropertyChanged interface and the OnPropertyChanged method for notifying about a change in the observed value.

  • Implementation of the generalized SetProperty method 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...