Пример #1
0
        protected static void RegisterGlobalKeyBindings()
        {
            IInputManager inputManager = ServiceRegistration.Get <IInputManager>();

            inputManager.AddKeyBinding(Key.Escape, () =>
            {
                // Close dialog or switch to previous workflow state
                IScreenManager screenManager = ServiceRegistration.Get <IScreenManager>();
                if (screenManager.IsDialogVisible)
                {
                    screenManager.CloseTopmostDialog();
                }
                else
                {
                    ServiceRegistration.Get <IWorkflowManager>().NavigatePop(1);
                }
            });
            inputManager.AddKeyBinding(Key.Fullscreen, () =>
            {
                //switch to fullscreen
                IScreenControl sc  = ServiceRegistration.Get <IScreenControl>();
                int nextMode       = ((int)sc.CurrentScreenMode) + 1;
                int totalModes     = Enum.GetNames(typeof(ScreenMode)).Length;
                ScreenMode newMode = (ScreenMode)(nextMode % totalModes);
                ServiceRegistration.Get <ILogger>().Info("SkinEngine: Switching screen mode from current '{0}' to '{1}'", sc.CurrentScreenMode, newMode);
                sc.SwitchMode(newMode);
            });
        }
Пример #2
0
        public void Dismiss()
        {
            var settingsManager = ServiceRegistration.Get <ISettingsManager>();
            var settings        = settingsManager.Load <WhatsNewSettings>();

            settings.NewsConfirmed = true;
            settingsManager.Save(settings);

            IScreenManager screenManager = ServiceRegistration.Get <IScreenManager>();

            screenManager.CloseTopmostDialog();
        }
        /// <summary>
        /// Shows an info dialog that the server with the given <see cref="sd"/> was attached.
        /// </summary>
        /// <param name="sd">Descriptor of the server whose information should be shown.</param>
        protected void ShowAttachInformationDialogAndClose(ServerDescriptor sd)
        {
            IScreenManager screenManager = ServiceRegistration.Get <IScreenManager>();
            IDialogManager dialogManager = ServiceRegistration.Get <IDialogManager>();

            _attachInfoDialogHandle = Guid.Empty; // Set this to value != null here to make the attachment dialog's close handler know we are not finished in our WF-state
            screenManager.CloseTopmostDialog();
            string header = LocalizationHelper.Translate(Consts.RES_ATTACH_INFO_DIALOG_HEADER);
            string text   = LocalizationHelper.Translate(Consts.RES_ATTACH_INFO_DIALOG_TEXT, sd.ServerName, sd.GetPreferredLink().HostName);
            Guid   handle = dialogManager.ShowDialog(header, text, DialogType.OkDialog, false, DialogButtonType.Ok);

            lock (_syncObj)
                _attachInfoDialogHandle = handle;
        }
Пример #4
0
        protected static void RegisterGlobalKeyBindings()
        {
            IInputManager inputManager = ServiceRegistration.Get <IInputManager>();

            inputManager.AddKeyBinding(Key.Escape, () =>
            {
                // Close dialog or switch to previous workflow state
                IScreenManager screenManager = ServiceRegistration.Get <IScreenManager>();
                if (screenManager.IsDialogVisible)
                {
                    screenManager.CloseTopmostDialog();
                }
                else
                {
                    ServiceRegistration.Get <IWorkflowManager>().NavigatePop(1);
                }
            });
            inputManager.AddKeyBinding(Key.Fullscreen, () =>
            {
                //switch to fullscreen
                IScreenControl sc = ServiceRegistration.Get <IScreenControl>();
                sc.SwitchMode(sc.IsFullScreen ? ScreenMode.NormalWindowed : ScreenMode.FullScreen);
            });
        }