Example #1
0
        /// <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);
            }
        }
Example #2
0
        /// <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);
 }
Example #4
0
 /// <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);
 }
Example #5
0
 /// <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);
 }
Example #6
0
 /// <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);
 }
Example #7
0
        /// <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);
        }
Example #8
0
 /// <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)
 {
 }
Example #9
0
 /// <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)
 {
 }
Example #10
0
 /// <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)
 {
 }
Example #11
0
 /// <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)
 {
 }
Example #12
0
 /// <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)
 {
 }
Example #13
0
 /// <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)
 {
 }
Example #14
0
 /// <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)
 {
 }
Example #15
0
 /// <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)
 {
 }
Example #16
0
 /// <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);
 }
Example #17
0
 /// <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)
 {
 }
Example #18
0
 /// <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)
 {
 }
Example #19
0
        /// <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);
        }
Example #20
0
 /// <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)
 {
 }
Example #21
0
 /// <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)
 {
 }
Example #22
0
 /// <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)
 {
 }
Example #23
0
 /// <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)
 {
 }
Example #24
0
 /// <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)
 {
 }
Example #25
0
 /// <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)
 {
 }
Example #26
0
 /// <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);
 }
Example #27
0
 /// <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)
 {
 }
Example #28
0
 /// <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)
 {
 }
Example #29
0
 /// <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);
 }
Example #30
0
 /// <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)
 {
 }
Example #31
0
 /// <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);
 }
Example #32
0
 /// <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="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);
 }
Example #34
0
 /// <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)
 {
 }
Example #35
0
 /// <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;
 }
Example #36
0
 /// <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)
 {
 }
Example #37
0
 /// <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)
 {
 }
Example #38
0
 /// <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)
 {
 }
Example #39
0
 /// <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)
 {
 }
Example #40
0
 /// <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)
 {
 }
Example #41
0
 /// <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="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);
 }
Example #43
0
 /// <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)
 {
 }
Example #44
0
 /// <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)
 {
 }
Example #45
0
 /// <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)
 {
 }
Example #46
0
 /// <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)
 {
 }
Example #47
0
 /// <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)
 {
 }
Example #48
0
 /// <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;
 }
Example #49
0
 /// <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);
 }
Example #50
0
 /// <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)
 {
 }
Example #51
0
 /// <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="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);
 }