Skip to content

Classes

Mandatory usage of this.

In order to avoid ambiguities between variables, the usage of this. is mandatory across the entire codebase of NetIP.

Example:

public class ExampleClass : ObservableObject
{
    [ObservableProperty]
    private int _value;

    public void SetValue(int Value)
    {
        this.Value = Value;
    }
}

ViewModels

The ViewModels of NetIP relying on CommunityToolkit.MVVM in order to expose fields to the View.

Example:

using CommunityToolkit.Mvvm.ComponentModel;

public partial class FooBarViewModel : ObservableObject
{
    #region Exposed Fields

    [ObservableProperty]
    private string _fooBarText = string.Empty;

    [...]

    #endregion

    private bool _nonExposedFooBar = false;

    #region Relay Commands

    [RelayCommand]
    private void RefreshFooBar()
    {
        this.FooBarText = "Updated!";
    }

    #endregion

    // Constructor and init functions

    public FooBarViewModel()
    {
        [...]
    }

    // Rest of the ViewModel logic

    private AnotherFunction()
    {
        [...]
    }
}