Ejemplo n.º 1
0
        /// <summary>
        /// Whenever the LockState event has been triggered (CTRL-F12),
        /// we handle it here.
        /// </summary>
        private void Shell_LockedStateChanged()
        {
            logger.Debug("Detected Shell LockedState change.");
            LockedStateChangedEventArgs eventArgs = new LockedStateChangedEventArgs();

            LockedDownUI = LockedDownUI ? false : true;

            if (LockedDownUI)
            {
                logger.Debug("Shell is UNLOCKED. Performing lock down actions.");

                // Don't allow resizing of the UI when locked down
                this.ResizeMode = ResizeMode.NoResize;
                // Change the WindowStyle so that control box is not shown
                this.WindowStyle = WindowStyle.None;
                // Maximum the application
                this.WindowState = WindowState.Maximized;
                // Hide the menu
                mainMenu.Visibility = Visibility.Collapsed;
                // Lock the tab on current selection
                if (AdministrationTabItem.IsSelected)
                {
                    CheckInTabItem.Visibility = Visibility.Collapsed;
                }
                else
                {
                    AdministrationTabItem.Visibility = Visibility.Collapsed;
                }

                // Display lock status
                LockedStatus.Content = "LOCKED";
                eventArgs.State      = LockedState.Locked;
            }
            else
            {
                logger.Debug("Shell is LOCKED. Performing unlock actions.");

                // Allow resizing again
                this.ResizeMode = ResizeMode.CanResizeWithGrip;
                // Place border back for application
                this.WindowStyle = WindowStyle.SingleBorderWindow;
                // Change window back to Normal state
                this.WindowState = WindowState.Normal;
                // Show the menu again
                mainMenu.Visibility = Visibility.Visible;
                // Make sure both tabs are visible
                AdministrationTabItem.Visibility = Visibility.Visible;
                CheckInTabItem.Visibility        = Visibility.Visible;

                // Display lock status
                LockedStatus.Content = String.Empty;
                eventArgs.State      = LockedState.Unlocked;
            }

            logger.Debug("Publishing ShellLockedStateChangedEvent to subscribers.");
            _eventAggregator.GetEvent <ShellLockedStateChangedEvent>().Publish(eventArgs);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// If the Shell LockState has been changed, we will have a chance
 /// to react to the event here.
 /// </summary>
 /// <param name="args"></param>
 public void OnShellLockStateChanged(LockedStateChangedEventArgs args)
 {
     // For this View, when the Shell is Locked, we want to hide
     // the ExclusiveCheckInPanel and disable use of the ContextMenu
     // which displays the panel. If not Locked, we make sure to
     // enable the ContextMenu again.
     if (args.State == LockedState.Locked)
     {
         LimitCheckInMenu.IsEnabled       = false;
         LimitCheckInMenu.Visibility      = Visibility.Collapsed;
         ExclusiveCheckInPanel.Visibility = Visibility.Collapsed;
     }
     else
     {
         LimitCheckInMenu.IsEnabled  = true;
         LimitCheckInMenu.Visibility = Visibility.Visible;
     }
 }