public MainWindow() { InitializeComponent(); BtnEdit.SetIcon(global::CarSensX.Properties.Resources.iconEdit); BtnFullScreen.SetIcon(global::CarSensX.Properties.Resources.iconFullScreen); BtnExit.SetIcon(global::CarSensX.Properties.Resources.iconBack); BtnExit.SetLabel("Exit"); BtnFullScreen.SetLabel("Fullscreen"); BtnEdit.SetLabel("Configure"); BtnBackground.SetLabel("Set Background"); BtnEdit.MouseLeftButtonUp += new MouseButtonEventHandler(BtnEditClick); BtnFullScreen.MouseLeftButtonUp += new MouseButtonEventHandler(BtnFullScreenClick); BtnBackground.MouseLeftButtonUp += new MouseButtonEventHandler(BtnBackgroundClick); BtnExit.MouseLeftButtonUp += new MouseButtonEventHandler(BtnExitClick); if (global::CarSensX.Properties.Settings.Default.BackgroundImage != null) { String fileName = global::CarSensX.Properties.Settings.Default.BackgroundImage; try { BitmapImage iSource = new BitmapImage(new Uri(fileName)); BackgroundGrid.Background = new ImageBrush(iSource); } catch (Exception ex) { } } }
/// <summary> /// Enter or Exit Image Viewer Full Screen Mode /// </summary> /// <param name="on">'True' for entering full screen mode, /// 'False' for exiting full screen mode</param> public void FullScreenMode(bool on = true) { if (!on) { SetFocus(); Console.WriteLine("Exit Full screen mode"); Keyboard.SendKeys("{ESC}"); } else if (BtnFullScreen.Enabled) { Console.WriteLine("Enter Full screen mode"); BtnFullScreen.Click(); } Thread.Sleep(3000); }