public Window1() { InitializeComponent(); // Enable "minimize to tray" behavior for this Window MinimizeToTray.Enable(this); // Set new state to prevent system sleep (note: still allows screen saver) m_previousExecutionState = NativeMethods.SetThreadExecutionState( NativeMethods.ES_CONTINUOUS | NativeMethods.ES_SYSTEM_REQUIRED); if (0 == m_previousExecutionState) { MessageBox.Show("Call to SetThreadExecutionState failed unexpectedly.", Title, MessageBoxButton.OK, MessageBoxImage.Error); // No way to recover; fail gracefully Close(); } // Start minimized if requested via the command-line foreach (var arg in Environment.GetCommandLineArgs()) { if (0 == string.Compare(arg, "-minimize", true)) { Loaded += delegate { WindowState = WindowState.Minimized; }; } } }
public MainWindow() { InitializeComponent(); // Enable "minimize to tray" behavior for this Window MinimizeToTray.Enable(this); this.Loaded += mainWindowLoaded; }
private void MainWindow_Loaded(object sender, RoutedEventArgs e) { if (Settings.Default.minimizeToTray) { MinimizeToTray.Enable(this, Settings.Default.minimizeOnStart); } KeymapConfigWindow.Instance.Owner = this; }
public MainWindow() { InitializeComponent(); myDataContext = new MyDataContext(); folderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog(); this.DataContext = myDataContext; MinimizeToTray.Enable(this); this.Closed += MainWindow_Closed; }
protected override void OnStartup(object sender, StartupEventArgs e) { if (!new SingleInstanceChecker().CheckSingleInstance(container)) { return; } ApplyPreferences(); MinimizeToTray.Enable(Application.MainWindow); }
public MainWindow(string dbpath) { db_ = new SQLiteConnection(dbpath); db_.CreateTable <Task>(); db_.CreateTable <ProgSettings>(); tasks_ = new ObservableCollection <Task>(db_.Table <Task>().OrderBy(t => t.Order)); settings_ = db_.Find <ProgSettings>(1); minimise_ = new MinimizeToTray(this, settings_.BallonShown); settings_.Plugins = new ObservableCollection <Plugin>(new Plugin[] { new PluginCore(settings_), new PluginWords(db_), new PluginExercises(db_), }); if (settings_ == null) { settings_ = new ProgSettings(db_); } else { settings_.DB = db_; } foreach (Task newItem in tasks_) { newItem.PropertyChanged += this.OnItemPropertyChanged; } InitializeComponent(); List_Tasks.ItemsSource = tasks_; Text_Add_Item.Focus(); workArc_.Right = true; playArc_.Right = false; workGrey_.Right = false; playGrey_.Right = true; customRenders_.Add(workArc_); customRenders_.Add(playArc_); customRenders_.Add(workGrey_); customRenders_.Add(playGrey_); this.ResetTimer(true, DateTime.Now); App.Tick += Tick; Closed += MainWindow_Closed; mediaPlayer_.Open(new Uri(Environment.CurrentDirectory + "\\bell.mp3")); mediaPlayer_.Volume = 1.0; tasks_.CollectionChanged += this.OnCollectionChanged; }
public MultiNotesMainWindow() { InitializeComponent(); ConnectionApi.Configure(); var vm = new MainWindowViewModel(Close); DataContext = vm; MinimizeToTray.Enable(this); WindowStartupLocation = WindowStartupLocation.CenterScreen; }
void Settings_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { if (e.PropertyName == "minimizeToTray") { if (Settings.Default.minimizeToTray) { MinimizeToTray.Enable(this, false); } else { MinimizeToTray.Disable(this); } } }
public MainWindow() { InitializeComponent(); MinimizeToTray.Enable(this); // Let the window shoe right away this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Background, new Action( delegate() { this.DataContext = new PCRobot(); } )); }
private void setRecodeMode(object sender, HotkeyEventArgs e) { if (recodeMode) { recodeMode = false; this.Icon = getWindowIcon(); MinimizeToTray.RecodeMode(new System.Drawing.Icon("../../favicon.ico")); // "pack://application:,,/icon/GB4.bmp" } else { recodeMode = true; this.Icon = getWindowIcon(); MinimizeToTray.RecodeMode(new System.Drawing.Icon("../../faviconActive.ico")); } }
public MainWindow() { Log.Register(LogHandler); Logs = new ObservableCollection <string>(); ComPorts = SerialPort.GetPortNames().ToList(); ArduinoPort = ComPorts.FirstOrDefault(); DataContext = this; InitializeComponent(); var wrapService = new WrapService(); wrapService.Add(_arduinoAdalightService); _ledMatrixPreviewService.LedArray = LedArrayPreview; wrapService.Add(_ledMatrixPreviewService); _processor = new Processor(); _processor.Run(wrapService); MinimizeToTray.Enable(this); }
public MainWindow() { InitializeComponent(); MinimizeToTray.Enable(this); }
public MainWindow(string dbpath) { db_ = new SQLiteConnection(dbpath); db_.CreateTable<Task>(); db_.CreateTable<ProgSettings>(); tasks_ = new ObservableCollection<Task>(db_.Table<Task>().OrderBy(t => t.Order)); settings_ = db_.Find<ProgSettings>(1); minimise_ = new MinimizeToTray(this, settings_.BallonShown); settings_.Plugins = new ObservableCollection<Plugin>(new Plugin[] { new PluginCore(settings_), new PluginWords(db_) }); if (settings_ == null) settings_ = new ProgSettings(db_); else settings_.DB = db_; foreach (Task newItem in tasks_) { newItem.PropertyChanged += this.OnItemPropertyChanged; } InitializeComponent(); List_Tasks.ItemsSource = tasks_; Text_Add_Item.Focus(); workArc_.Right = true; playArc_.Right = false; workGrey_.Right = false; playGrey_.Right = true; customRenders_.Add(workArc_); customRenders_.Add(playArc_); customRenders_.Add(workGrey_); customRenders_.Add(playGrey_); this.ResetTimer(true, DateTime.Now); App.Tick += Tick; Closed += MainWindow_Closed; mediaPlayer_.Open(new Uri(Environment.CurrentDirectory + "\\bell.mp3")); mediaPlayer_.Volume = 1.0; tasks_.CollectionChanged += this.OnCollectionChanged; }
void minimizeWindow() { MinimizeToTray.MinimizeWindow(this); }
void restoreWindow() { MinimizeToTray.RestoreWindow(this); }