Esempio n. 1
0
 public void ApplyTabSettings(TabSettings settings)
 {
     TextFont = settings.Font;
     BackgroundColor = settings.BackgroundColor;
     PromptColor = settings.PromptColor;
     TextColor = settings.TextColor;
 }
        public TabSettings LoadTabSettings()
        {
            var retVal = new TabSettings();
            if (!_settingsFile.Exists)
            {
                return retVal;
            }

            XDocument document = ReadDocument();
            XElement root = (XElement) document.FirstNode;
            XElement element = root.Element("TabSettings");
            return element != null ? retVal.Parse(element) : retVal;
        }
        public void WriteTabSettings(TabSettings tabSettings)
        {
            XDocument document = ReadDocument();
            XElement root = (XElement)document.FirstNode;
            XElement element = root.Element("TabSettings") ?? new XElement("TabSettings");

            if (element.Parent != null)
            {
                element.Remove();
            }

            element.RemoveAll();
            tabSettings.Write(element);

            root.Add(element);
            document.Save(_settingsFile.FullName);
        }
Esempio n. 4
0
        private void OnSettingsMenuItemClicked(object sender, EventArgs e)
        {
            using (var dlg = new SettingsDialog())
            {
                dlg.ApplyTabSettings(_tabSettings);
                if (dlg.ShowDialog(this) == DialogResult.OK)
                {
                    var tabSettings = new TabSettings(dlg.TextFont, dlg.PromptColor, dlg.TextColor, dlg.BackgroundColor);
                    _applicationSettingsManager.WriteTabSettings(tabSettings);

                    foreach (TabPage tab in _commandTabContainer.TabPages)
                    {
                        _tabSettings = tabSettings;
                        ((ShellTabPresenter)tab.Tag).ApplySettings(_tabSettings);
                    }
                }
            }
        }
Esempio n. 5
0
        protected override void OnShown(EventArgs e)
        {
            base.OnShown(e);

            _tabSettings = _applicationSettingsManager.LoadTabSettings();

            _shellIntegration.ThumbnailActivated += (tabSender, eArgs) => _commandTabContainer.SelectTab(tabSender as TabPage);
            _shellIntegration.ThumbnailClosed += (tabSender, eArgs) => CloseTab(tabSender as TabPage);
            _shellIntegration.Init();

            _commandHost = new CommandHost(_internalCommandManager, _commandLoader);
            _commandLoadStatusViewPresenter = new CommandLoadStatusViewPresenter(statusBar, _commandHost, tslCommandsStatus);
            _commandLoadStatusViewPresenter.Init();

            NewCommandTab();

            _commandHistoryManager.Init();
            _autoCompletePresenter.Init();
            _autoCompletePresenter.ItemClicked += (sender, commandArg) => {
                _autoCompletePresenter.Hide();

                var tabPresenter = GetActiveTab();
                tabPresenter.InsertCommand(commandArg.Command);
                tabPresenter.Focus();
            };

            _clipboardHistoryPresenter.Init();
        }