Example #1
0
        public FanControllerViewModel(IFanControlClient client, int fanIndex)
        {
            this.fanIndex = fanIndex;
            this.client   = client;
            this.client.FanControlStatusChanged += Client_FanControlStatusChanged;
            Messenger.Default.Register <ReloadFanControlInfoMessage>(this, Refresh);

            Refresh(true);
        }
Example #2
0
 public MainViewModel(IFanControlClient client)
 {
     this.FanControllers = new ObservableCollection <FanControllerViewModel>();
     this.renderer       = new TrayIconRenderer();
     this.renderer.Color = Settings.Default.TrayIconForegroundColor;
     this.client         = client;
     this.client.FanControlStatusChanged += Client_FanControlStatusChanged;
     Messenger.Default.Register <ReloadFanControlInfoMessage>(this, Refresh);
     Refresh(true);
 }
Example #3
0
        public SelectConfigViewModel(IFanControlClient client)
        {
            this.client = client;
            string path = Assembly.GetExecutingAssembly()?.Location;

            if (path != null)
            {
                path             = Path.GetDirectoryName(path);
                ConfigEditorPath = Path.Combine(path, ConfigEditorExecutableName);

                string configsDirPath = Path.Combine(path, ConfigsDirectoryName);

                if (Directory.Exists(configsDirPath))
                {
                    configWatcher                     = new FileSystemWatcher(configsDirPath);
                    configWatcher.Created            += ConfigWatcher_Changed;
                    configWatcher.Deleted            += ConfigWatcher_Changed;
                    configWatcher.Renamed            += ConfigWatcher_Changed;
                    configWatcher.EnableRaisingEvents = true;
                }
            }

            SelectedConfig = this.client.FanControlInfo?.SelectedConfig;
        }