public void Initialize(Window window) { Settings.Load(); SystemTrayIconService.Initialize(window); WindowInteropService.PowerManagementRegistration(window, SystemState); WindowInteropService.SetWindowPosition(window, Settings.MainWindowPosition); InitializeSaveSettingsOnMove(window); window.CommandBindings.AddRange(CommandBindings.Select(cb => cb.CommandBinding()).ToArray()); window.CommandBindings.Add(new CommandBinding(ApplicationCommands.Close, delegate { window.Close(); })); }
public void Initialize(Window window) { if (window is null) { throw new System.ArgumentNullException(nameof(window)); } Settings.Load(); SystemTrayIconService.Initialize(window); WindowInteropService.PowerManagementRegistration(window, SystemState); WindowInteropService.SetWindowPosition(window, Settings.MainWindowPosition); window.CommandBindings.AddRange(CommandBindings.Select(cb => cb.CommandBinding()).ToList()); window.CommandBindings.Add(new CommandBinding(ApplicationCommands.Close, (_, __) => window.Close())); }