/// <summary> /// Initializes a new instance of the <see cref="DsmApiBase"/> class. /// </summary> /// <param name="dsmApiContext">The context used to access the DSM API.</param> /// <param name="api">The name of the API.</param> /// <param name="supportedApiVersion">The supported version of the API.</param> protected DsmApiBase(IDsmApiContext dsmApiContext, string api, int supportedApiVersion) { if (dsmApiContext == null) { throw new ArgumentNullException("dsmApiContext"); } this.ApiContext = dsmApiContext; DsmApiInfo apiInfo; if (!this.ApiContext.AllApiInfo.TryGetValue(api, out apiInfo)) { string message = string.Format( CultureInfo.CurrentCulture, Resources.UnsupportedApiMessage, api); throw new NotSupportedException(message); } this.ApiInfo = apiInfo; if (supportedApiVersion < this.ApiInfo.MinVersion || supportedApiVersion > this.ApiInfo.MaxVersion) { string message = string.Format( CultureInfo.CurrentCulture, Resources.UnsupportedApiVersionMessage, supportedApiVersion, this.ApiInfo.MinVersion, this.ApiInfo.MaxVersion); throw new NotSupportedException(message); } }
/// <summary> /// Initializes a new instance of the <see cref="AuthenticationViewModel"/> class. /// </summary> /// <param name="apiContext">The API context to use.</param> public AuthenticationViewModel(IDsmApiContext apiContext) : base(apiContext) { this.AuthenticationApi = new AuthenticationApi(apiContext); this.LogOnCommand = new AsyncRelayCommand(this.LogOn); this.LogOffCommand = new AsyncRelayCommand(this.LogOff); }
/// <summary> /// Initializes a new instance of the <see cref="DsmSystemViewModel"/> class. /// </summary> /// <param name="apiContext">The API context to use.</param> public DsmSystemViewModel(IDsmApiContext apiContext) : base(apiContext) { this.DsmSystemApi = new DsmSystemApi(apiContext); this.RebootCommand = new AsyncRelayCommand(this.Reboot); this.ShutdownCommand = new AsyncRelayCommand(this.Shutdown); this.PingPongCommand = new AsyncRelayCommand(this.PingPong); }
/// <summary> /// Loads the API context. /// </summary> private async void LoadApiContext() { this.ApiContext = new DsmWebApiContext(new Uri(this.WebApiBaseUri)); await this.ApiContext.LoadAllApiInfo(); this.AuthenticationViewModel = new AuthenticationViewModel(this.ApiContext); this.RaisePropertyChanged(() => this.AuthenticationViewModel); this.EncryptionViewModel = new EncryptionViewModel(this.ApiContext); this.RaisePropertyChanged(() => this.EncryptionViewModel); this.InformationViewModel = new InformationViewModel(this.ApiContext); this.RaisePropertyChanged(() => this.InformationViewModel); this.DsmInformationViewModel = new DsmInformationViewModel(this.ApiContext); this.RaisePropertyChanged(() => this.DsmInformationViewModel); this.DsmShareViewModel = new DsmShareViewModel(this.ApiContext); this.RaisePropertyChanged(() => this.DsmShareViewModel); this.DsmSystemViewModel = new DsmSystemViewModel(this.ApiContext); this.RaisePropertyChanged(() => this.DsmSystemViewModel); this.DsmUserViewModel = new DsmUserViewModel(this.ApiContext); this.RaisePropertyChanged(() => this.DsmUserViewModel); this.IsApiContextLoaded = true; this.RaisePropertyChanged(() => this.IsApiContextLoaded); }
/// <summary> /// Initializes a new instance of the <see cref="DsmPackageApi"/> class. /// </summary> /// <param name="dsmApiContext">The context used to access the DSM API.</param> public DsmPackageApi(IDsmApiContext dsmApiContext) : base(dsmApiContext, DsmPackageApiName, 1) { }
/// <summary> /// Initializes a new instance of the <see cref="AuthenticationApi"/> class. /// </summary> /// <param name="dsmApiContext">The context used to access the DSM API.</param> public AuthenticationApi(IDsmApiContext dsmApiContext) : base(dsmApiContext, AuthenticationApiName, 3) { }
/// <summary> /// Initializes a new instance of the <see cref="DsmSystemApi"/> class. /// </summary> /// <param name="dsmApiContext">The context used to access the DSM API.</param> public DsmSystemApi(IDsmApiContext dsmApiContext) : base(dsmApiContext, DsmSystemApiName, 1) { }
/// <summary> /// Initializes a new instance of the <see cref="DsmNetworkApi"/> class. /// </summary> /// <param name="dsmApiContext">The context used to access the DSM API.</param> public DsmNetworkApi(IDsmApiContext dsmApiContext) : base(dsmApiContext, DsmNetworkApiName, 1) { }
/// <summary> /// Initializes a new instance of the <see cref="DsmVolumeApi"/> class. /// </summary> /// <param name="dsmApiContext">The context used to access the DSM API.</param> public DsmVolumeApi(IDsmApiContext dsmApiContext) : base(dsmApiContext, DsmVolumeApiName, 1) { }
/// <summary> /// Initializes a new instance of the <see cref="DsmShareApi"/> class. /// </summary> /// <param name="dsmApiContext">The context used to access the DSM API.</param> public DsmShareApi(IDsmApiContext dsmApiContext) : base(dsmApiContext, DsmShareApiName, 1) { }
/// <summary> /// Initializes a new instance of the <see cref="DsmAutoBlockApi"/> class. /// </summary> /// <param name="dsmApiContext">The context used to access the DSM API.</param> public DsmAutoBlockApi(IDsmApiContext dsmApiContext) : base(dsmApiContext, DsmAutoBlockApiName, 1) { }
/// <summary> /// Initializes a new instance of the <see cref="DsmUserApi"/> class. /// </summary> /// <param name="dsmApiContext">The context used to access the DSM API.</param> public DsmUserApi(IDsmApiContext dsmApiContext) : base(dsmApiContext, DsmUserApiName, 1) { }
/// <summary> /// Initializes a new instance of the <see cref="EncryptionViewModel"/> class. /// </summary> /// <param name="apiContext">The API context to use.</param> public EncryptionViewModel(IDsmApiContext apiContext) : base(apiContext) { this.EncryptionApi = new EncryptionApi(this.ApiContext); this.GetInfoCommand = new AsyncRelayCommand(this.GetInfo); }
/// <summary> /// Initializes a new instance of the <see cref="DsmApplicationApi"/> class. /// </summary> /// <param name="dsmApiContext">The context used to access the DSM API.</param> public DsmApplicationApi(IDsmApiContext dsmApiContext) : base(dsmApiContext, DsmApplicationApiName, 1) { }
/// <summary> /// Initializes a new instance of the <see cref="EncryptionApi"/> class. /// </summary> /// <param name="dsmApiContext">The context used to access the DSM API.</param> public EncryptionApi(IDsmApiContext dsmApiContext) : base(dsmApiContext, EncryptionApiName, 1) { }
/// <summary> /// Initializes a new instance of the <see cref="DsmGroupApi"/> class. /// </summary> /// <param name="dsmApiContext">The context used to access the DSM API.</param> public DsmGroupApi(IDsmApiContext dsmApiContext) : base(dsmApiContext, DsmGroupApiName, 1) { }
/// <summary> /// Initializes a new instance of the <see cref="DsmLogViewerApi"/> class. /// </summary> /// <param name="dsmApiContext">The context used to access the DSM API.</param> public DsmLogViewerApi(IDsmApiContext dsmApiContext) : base(dsmApiContext, DsmLogViewerApiName, 1) { }
/// <summary> /// Initializes a new instance of the <see cref="DsmIScsiApi"/> class. /// </summary> /// <param name="dsmApiContext">The context used to access the DSM API.</param> public DsmIScsiApi(IDsmApiContext dsmApiContext) : base(dsmApiContext, DsmIScsiApiName, 1) { }
/// <summary> /// Initializes a new instance of the <see cref="DsmInformationApi"/> class. /// </summary> /// <param name="dsmApiContext">The context used to access the DSM API.</param> public DsmInformationApi(IDsmApiContext dsmApiContext) : base(dsmApiContext, DsmInformationApiName, 1) { }
/// <summary> /// Initializes a new instance of the <see cref="DsmServiceApi"/> class. /// </summary> /// <param name="dsmApiContext">The context used to access the DSM API.</param> public DsmServiceApi(IDsmApiContext dsmApiContext) : base(dsmApiContext, DsmServiceApiName, 1) { }
/// <summary> /// Initializes a new instance of the <see cref="DsmConnectionApi"/> class. /// </summary> /// <param name="dsmApiContext">The context used to access the DSM API.</param> public DsmConnectionApi(IDsmApiContext dsmApiContext) : base(dsmApiContext, DsmConnectionApiName, 1) { }
/// <summary> /// Initializes a new instance of the <see cref="DsmUserViewModel"/> class. /// </summary> /// <param name="apiContext">The API context to use.</param> public DsmUserViewModel(IDsmApiContext apiContext) : base(apiContext) { this.DsmUserApi = new DsmUserApi(apiContext); this.ListCommand = new AsyncRelayCommand(this.List); }
/// <summary> /// Initializes a new instance of the <see cref="DsmFindMeApi"/> class. /// </summary> /// <param name="dsmApiContext">The context used to access the DSM API.</param> public DsmFindMeApi(IDsmApiContext dsmApiContext) : base(dsmApiContext, DsmFindMeApiName, 1) { }
/// <summary> /// Initializes a new instance of the <see cref="InformationViewModel"/> class. /// </summary> /// <param name="apiContext">The API context to use.</param> public InformationViewModel(IDsmApiContext apiContext) : base(apiContext) { this.InformationApi = new InformationApi(this.ApiContext); this.QueryAllCommand = new AsyncRelayCommand(this.QueryAll); }
/// <summary> /// Initializes a new instance of the <see cref="ApiViewModelBase"/> class. /// </summary> /// <param name="apiContext">The API context to use.</param> protected ApiViewModelBase(IDsmApiContext apiContext) { this.ApiContext = apiContext; }
/// <summary> /// Initializes a new instance of the <see cref="DsmInformationViewModel"/> class. /// </summary> /// <param name="apiContext">The API context to use.</param> public DsmInformationViewModel(IDsmApiContext apiContext) : base(apiContext) { this.DsmInformationApi = new DsmInformationApi(apiContext); this.GetInfoCommand = new AsyncRelayCommand(this.GetInfo); }
/// <summary> /// Initializes a new instance of the <see cref="DsmEncryptShareApi"/> class. /// </summary> /// <param name="dsmApiContext">The context used to access the DSM API.</param> public DsmEncryptShareApi(IDsmApiContext dsmApiContext) : base(dsmApiContext, DsmEncryptShareApiName, 1) { }