internal void Launch()
        {
            _loginControl = new LoginControl();

            var control = new ContentControl()
            {
                Content = _loginControl
            };

            AnimatedDialog dialog = new AnimatedDialog(
                new Point(0, 0),
                BalloonPopupPosition.ScreenCenter,
                control,
                50, true, true, null, null)
            {
                ShowHeaderPanel = true,
                ShowTickButton  = false
            };

            _loginControl.Closed += (s, e) => { dialog.Close(); };

            dialog.ShowCloseButton     = true;
            dialog.ShowMaximizeRestore = false;
            dialog.Topmost             = false;
            AppearanceManager.SetAppearance(dialog);
            dialog.Show();
        }
Exemple #2
0
 private void InitNavKeys()
 {
     FocusManager.GlobalKeyHandlers.PushForLifetime(ConsoleKey.Escape, null, () =>
     {
         if (currentContent != null && FocusManager.FocusedControl != null &&
             (FocusManager.FocusedControl == currentContent ||
              (currentContent is ConsolePanel && (currentContent as ConsolePanel).Descendents.Contains(FocusManager.FocusedControl)))
             )
         {
             currentNavButton?.TryFocus();
         }
         else
         {
             AnimatedDialog.Show((dialogHandle) =>
             {
                 var contentBg    = RGB.Yellow;
                 var bgCompliment = contentBg.GetCompliment();
                 var textColor    = RGB.Black.CalculateDistanceTo(bgCompliment) < RGB.MaxDistance * .75f ? RGB.Black : bgCompliment;
                 var panel        = new ConsolePanel()
                 {
                     Height = 11, Width = (int)Math.Round(LayoutRoot.Width * .5f), Background = contentBg
                 };
                 var label = panel.Add(new Label()
                 {
                     Text = "Press enter to quit or escape to resume".ToConsoleString(textColor, contentBg)
                 }).CenterBoth();
                 FocusManager.GlobalKeyHandlers.PushForLifetime(ConsoleKey.Enter, null, Stop, panel);
                 FocusManager.GlobalKeyHandlers.PushForLifetime(ConsoleKey.Escape, null, dialogHandle.CloseDialog, panel);
                 return(panel);
             });
         }
     }, this);
 }