コード例 #1
0
 public VeeamWorkerManager(
     IPortalService portalService,
     IPortalAuthenticationService authService,
     IVeeamManager veeamManager)
     : base(portalService, authService)
 {
     _veeamManager = veeamManager;
 }
コード例 #2
0
 public UserWorkerManager(
     IPortalService portalService,
     IPortalAuthenticationService authService,
     IActiveDirectoryManager activeDirectoryManager
     ) : base(portalService, authService)
 {
     _activeDirectoryManager = activeDirectoryManager;
 }
コード例 #3
0
 public VeeamManager(IPortalAuthenticationService authService)
 {
     _authService = authService;
 }
コード例 #4
0
        public MainWindowViewModel()
        {
            // resolve dependencies
            _settingManager = IocManager.Instance.Resolve <ISettingManager>();
            _authService    = IocManager.Instance.Resolve <IPortalAuthenticationService>();

            try
            {
                _serviceController = new ServiceController("LicenseMonitoringSystem");
                if (_serviceController == null)
                {
                    ServiceInstalled = false;
                    ServiceStatus    = "Program not installed.";
                }
                else
                {
                    ServiceInstalled = true;
                    ServiceStatus    = _serviceController.Status.ToString();
                }
            }
            catch (Exception ex)
            {
                ServiceInstalled = false;
                ServiceStatus    = ex.Message;
            }

            // set initial values
            AccountId = _authService.GetAccount();
            DeviceId  = _authService.GetDevice();

            // listen for changes
            this.Changed(p => p.AccountId)
            .Throttle(TimeSpan.FromMilliseconds(500))
            .ObserveOnDispatcher()
            .Subscribe(accountId =>
            {
                IsBusy = true;

                if (_canChangeAccountId)
                {
                    var prev = _authService.GetAccount();
                    if (prev != AccountId)
                    {
                        PendingChanges = true;
                    }
                }

                Debug.WriteLine($"Account ID: {accountId}");
                _settingManager.ChangeSettingForApplication(AppSettingNames.AutotaskAccountId, accountId.ToString());

                IsBusy = false;
                _canChangeAccountId = true;
            })
            .DisposeWith(_disposable);

            this.Changed(p => p.DeviceId)
            .Throttle(TimeSpan.FromMilliseconds(500))
            .ObserveOnDispatcher()
            .Subscribe(deviceId =>
            {
                IsBusy = true;
                if (_canChangeDeviceId)
                {
                    var prev = _authService.GetDevice();
                    if (prev != DeviceId)
                    {
                        PendingChanges = true;
                    }
                }

                Debug.WriteLine($"Device ID: {deviceId}");
                _settingManager.ChangeSettingForApplication(AppSettingNames.CentrastageDeviceId, deviceId.ToString());

                IsBusy             = false;
                _canChangeDeviceId = true;
            })
            .DisposeWith(_disposable);

            PendingChanges = false;
        }
コード例 #5
0
 public PortalService(IPortalAuthenticationService authService)
 {
     _authService = authService;
 }
コード例 #6
0
 protected WorkerManagerBase(IPortalService portalService, IPortalAuthenticationService authService)
 {
     PortalService = portalService;
     AuthService   = authService;
 }