Example #1
0
        protected override void OnClosing(CancelEventArgs e)
        {
            if (CurrentUserNotifications.CurrentUser != null)
            {
                ESB2Login.Logout(CurrentUserNotifications.CurrentUser);
            }

            if (ESB2db.GetDatabase().ChangeTracker.HasChanges())
            {
                ESB2db.GetDatabase().SaveChanges();
            }

            base.OnClosing(e);
        }
Example #2
0
        private void MainWindowKeyDown(object sender, KeyEventArgs e)
        {
            switch (e.Key)
            {
            case Key.F2:
                CurrentUserNotifications.SendNotification(ESB2Login.Login());
                break;

            case Key.Escape:
                if (CurrentUserNotifications.CurrentUser != null)
                {
                    CurrentUserNotifications.SendNotification(ESB2Login.Logout(CurrentUserNotifications.CurrentUser));
                }

                if (ESB2db.GetDatabase().ChangeTracker.HasChanges())
                {
                    ESB2db.GetDatabase().SaveChanges();
                }

                break;
            }
        }