public MainWindow() { try { RegisterStartup(); SupportHtml5(); InitializeComponent(); _service = new FarmaService(); _listener = new LowLevelKeyboardListener(); _infoBrowser = new BrowserWindow(); _customBrowser = new BrowserWindow(); _window = new LowLevelWindowsListener(); // Leemos los archivos de configuración _service.LeerFicherosConfiguracion(); // Setamos el comportamiento de la aplicación al presionar una tecla _listener.OnKeyPressed += _listener_OnKeyPressed; // Activamos el listener de teclado _listener.HookKeyboard(); _iconNotification = new System.Windows.Forms.NotifyIcon(); _iconNotification.BalloonTipText = "La Aplicación SisFarma se encuentra ejecutando"; _iconNotification.BalloonTipTitle = "SisFarma Notificación"; _iconNotification.Text = "Presione Click para Mostrar"; _iconNotification.Icon = Lector.Sharp.Wpf.Properties.Resources.Logo; _iconNotification.BalloonTipIcon = System.Windows.Forms.ToolTipIcon.Info; System.Windows.Forms.ContextMenu menu = new System.Windows.Forms.ContextMenu(); System.Windows.Forms.MenuItem notificactionInfoMenu = new System.Windows.Forms.MenuItem("Info"); notificactionInfoMenu.Click += notificactionInfoMenu_Click; System.Windows.Forms.MenuItem notificationQuitMenu = new System.Windows.Forms.MenuItem("Salir"); notificationQuitMenu.Click += notificationQuitMenu_Click; menu.MenuItems.Add(notificactionInfoMenu); menu.MenuItems.Add(notificationQuitMenu); _iconNotification.ContextMenu = menu; _iconNotification.Visible = true; } catch (IOException ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); Application.Current.Shutdown(); } }
/// <summary> /// Abre una ventana que contiene un browser /// </summary> /// <param name="browser">Ventana con un browser</param> private void OpenWindowBrowser(BrowserWindow browser, string url, BrowserWindow hidden) { if (_processChrome != null && !_processChrome.HasExited) { _processChrome.CloseMainWindow(); _processChrome.Close(); _processChrome = null; } hidden.Topmost = false; browser.Topmost = true; hidden.Topmost = true; browser.Browser.Navigate(url); browser.Visibility = Visibility.Visible; browser.WindowState = WindowState.Maximized; browser.Show(); browser.Activate(); }
/// <summary> /// Cierra una ventana que contiene un browser /// </summary> /// <param name="browser"></param> private void CloseWindowBrowser(BrowserWindow browser) { browser.Hide(); }
public MainWindow() { try { InitializeComponent(); _service = new FarmaService(); _ticketService = new TicketService(); _listener = new LowLevelKeyboardListener(); _window = new LowLevelWindowsListener(); _infoBrowser = new BrowserWindow(); _customBrowser = new BrowserWindow(); _presentationBrowser = new BrowserWindow(); // Leemos los archivos de configuración _service.LeerFicherosConfiguracion(); _ticketService.InitializeConfiguration(); // Setamos el comportamiento de la aplicación al presionar una tecla _listener.OnKeyPressed += _listener_OnKeyPressed; // Activamos el listener de teclado _listener.HookKeyboard(); _iconNotification = new System.Windows.Forms.NotifyIcon(); _iconNotification.BalloonTipText = "La Aplicación SisFarma se encuentra ejecutando"; _iconNotification.BalloonTipTitle = "SisFarma Notificación"; _iconNotification.Text = "Presione Click para Mostrar"; _iconNotification.Icon = Lector.Sharp.Wpf.Properties.Resources.Logo; _iconNotification.BalloonTipIcon = System.Windows.Forms.ToolTipIcon.Info; System.Windows.Forms.ContextMenu menu = new System.Windows.Forms.ContextMenu(); System.Windows.Forms.MenuItem notificactionInfoMenu = new System.Windows.Forms.MenuItem("Info"); notificactionInfoMenu.Click += notificactionInfoMenu_Click; System.Windows.Forms.MenuItem notificationQuitMenu = new System.Windows.Forms.MenuItem("Salir"); notificationQuitMenu.Click += notificationQuitMenu_Click; menu.MenuItems.Add(notificactionInfoMenu); menu.MenuItems.Add(notificationQuitMenu); _iconNotification.ContextMenu = menu; _iconNotification.Visible = true; InitializeTicketTimer(); InitializeShutdownTimer(); OpenWindowPresentation(_presentationBrowser, _service.Presentation); //_processChrome = new Process(); //_processChrome.StartInfo.FileName = @"chrome.exe"; //_processChrome.StartInfo.Arguments = $@"--kiosk --fullscreen --app={_service.Presentation}"; //_processChrome.Start(); //_processChrome.WaitForInputIdle(1000); //_processChrome.Refresh(); //SetParent(_processChrome.MainWindowHandle, new WindowInteropHelper(this).Handle); //SetWindowPos(_processChrome.MainWindowHandle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); //SetForegroundWindow(_processChrome.Handle); //_processChrome.Refresh(); } catch (IOException ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); Application.Current.Shutdown(); } }