public MainWindow() { InitializeComponent(); this.DataContext = this; if (!System.Security.Principal.WindowsIdentity.GetCurrent().Name.Contains("omartinez")) { KillExplorer(); this.Topmost = true; this.WindowStyle = WindowStyle.None; } if (SesionManager.Sesion.Operario == null) { while (SesionManager.Sesion.Operario == null) { Ventanas.Login login = new Ventanas.Login(); login.ShowDialog(); } this.Operario = SesionManager.Sesion.Operario; Bienvenida welcome = new Bienvenida(); welcome.Show(); Notificar("Operario"); } CargarDatos(); this.Closing += (s, e) => { Logs.Log.Write(new Exception(" Cerrando aplicacion...")); ClienteMQTT.Cerrar(); }; }
private void BtLogout_Click(object sender, RoutedEventArgs e) { try { if (InputManager.Current.MostRecentInputDevice is KeyboardDevice) { e.Handled = true; return; } Store.Reset(); ImprimirAuditoria impAud = new ImprimirAuditoria(); impAud.ShowDialog(); ClienteMQTT.Cerrar(); SesionManager.Sesion.Operario = null; while (SesionManager.Sesion.Operario == null) { Ventanas.Login login = new Ventanas.Login(); login.ShowDialog(); } this.Operario = SesionManager.Sesion.Operario; ClienteMQTT.Iniciar(); Bienvenida welcome = new Bienvenida(); welcome.Show(); this.CargarPaquetesPrevios(); Notificar("Operario"); } catch (Exception ex) { Log.Write(ex); } }