示例#1
0
        /// <summary>
        /// ctor
        /// </summary>
        public StatusViewModel(IHwdg hwdg, ISettingsProvider settings)
        {
            // Inject dependency
            this.hwdg     = hwdg;
            this.settings = settings;

            // Get and store main thread dispatcher.
            // This is necessary for further window color changes.
            uiDisp = Dispatcher.CurrentDispatcher;

            // Subscribe on hwdg events to handle HWDG
            // connecting and disconnecting situations.
            // We have only one instance of this view per app,
            // so no need to worry about memory leak.
            hwdg.Disconnected += OnDisconnected;
            hwdg.Connected    += OnConnected;

            hwdg.Stop();
            if (settings.Automonitor)
            {
                hwdg.RestoreStatus(settings.HwdgStatus);
                hwdg.Start();
            }
            HwStatus = hwdg.GetStatus();
        }
 public SettingsViewModel(IHwdg hwdg, ISettingsProvider settings)
 {
     this.settings      = settings;
     this.hwdg          = hwdg;
     CanResetTest       = hwdg.GetStatus() != null;
     hwdg.Connected    += OnConnected;
     hwdg.Disconnected += OnDisconnected;
 }
 public ShellViewModel(IHwdg hwdg)
 {
     this.hwdg = hwdg;
 }