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); }
public MainWindow() { ProcessCommandLineArgs(); InitializeComponent(); Application.Current.SessionEnding += Current_SessionEnding; this.renderer = new TrayIconRenderer(); this.renderer.Color = Settings.Default.TrayIconForegroundColor; this.saveSizeTimer = new DispatcherTimer(); this.saveSizeTimer.Interval = TimeSpan.FromSeconds(SaveWindowSizeDelay); this.saveSizeTimer.Tick += saveSizeTimer_Tick; this.viewModel = new MainWindowViewModel(); viewModel.PropertyChanged += viewModel_PropertyChanged; this.client = new FanControlClient(viewModel, UpdateInterval); this.DataContext = viewModel; client.UpdateViewModel(); this.Height = Settings.Default.WindowHeight; this.Width = Settings.Default.WindowWidth; this.SizeChanged += MainWindow_SizeChanged; var wbcd = new DateTime(DateTime.Now.Year, 5, 28); if ((DateTime.Today > wbcd.Subtract(new TimeSpan(14, 0, 0, 0))) && (DateTime.Today <= wbcd)) { this.wbcd.Visibility = System.Windows.Visibility.Visible; } else { this.wbcd.Visibility = System.Windows.Visibility.Collapsed; } }