public PageSwitcher() { InitializeComponent(); BingWallpaperManager man = new BingWallpaperManager(); _mainPage = new Home_Page(man); var timeLinePage = new Time_Line_Page(man); var settingsPage = new Settings_Page(); Switcher.PageSwitcher = this; Switcher.Switch(_mainPage); HomeButton.SelectionCommand = new SwitchCommand(_ => Switcher.Switch(_mainPage)); TimeLineButton.SelectionCommand = new SwitchCommand(_ => Switcher.Switch(timeLinePage)); SettingsButton.SelectionCommand = new SwitchCommand(_ => Switcher.Switch(settingsPage)); this.CommandBindings.Add(new CommandBinding(SystemCommands.CloseWindowCommand, this.OnCloseWindow)); this.CommandBindings.Add(new CommandBinding(SystemCommands.MaximizeWindowCommand, this.OnMaximizeWindow, this.OnCanResizeWindow)); this.CommandBindings.Add(new CommandBinding(SystemCommands.MinimizeWindowCommand, this.OnMinimizeWindow, this.OnCanMinimizeWindow)); this.CommandBindings.Add(new CommandBinding(SystemCommands.RestoreWindowCommand, this.OnRestoreWindow, this.OnCanResizeWindow)); this.KeyDown += OnKeyDown; }
public Home_Page(BingWallpaperManager man) { InitializeComponent(); manager = man; this.DataContext = manager; }