Ejemplo n.º 1
0
 public VeeamWorkerManager(
     IPortalService portalService,
     IPortalAuthenticationService authService,
     IVeeamManager veeamManager)
     : base(portalService, authService)
 {
     _veeamManager = veeamManager;
 }
Ejemplo n.º 2
0
 public UserWorkerManager(
     IPortalService portalService,
     IPortalAuthenticationService authService,
     IActiveDirectoryManager activeDirectoryManager
     ) : base(portalService, authService)
 {
     _activeDirectoryManager = activeDirectoryManager;
 }
Ejemplo n.º 3
0
 public VeeamManager(IPortalAuthenticationService authService)
 {
     _authService = authService;
 }
        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;
        }
Ejemplo n.º 5
0
 public PortalService(IPortalAuthenticationService authService)
 {
     _authService = authService;
 }
Ejemplo n.º 6
0
 protected WorkerManagerBase(IPortalService portalService, IPortalAuthenticationService authService)
 {
     PortalService = portalService;
     AuthService   = authService;
 }