Ejemplo n.º 1
0
Archivo: Main.cs Proyecto: mikkoj/nocs
        private void AddInactiveNoc(Document doc, bool pinned = false)
        {
            var inactiveNoc = new Noc(doc, _synchronizer, contextMenuEditor);
            inactiveNoc.Pinned = pinned;

            // let's hook up events
            inactiveNoc.CaretPositionChanged += NocCaretPositionChanged;
            inactiveNoc.Enter += Noc_Enter;
            inactiveNoc.TokenExpired += TokenExpiredWhileSaving;
            inactiveNoc.NocTitleChanged += NocTitleChanged;
            inactiveNoc.Status += Status;
            SettingsChanged += inactiveNoc.SettingsChanged;

            // let's add the new Noc to tabcontrol
            tabs.Controls.Add(inactiveNoc);

            // let's update the selectedIndex
            var selectedIndex = (tabs.TabCount - 1);
            if (selectedIndex < 0)
            {
                selectedIndex = 0;
            }
            tabs.SelectedIndex = selectedIndex;
            SetMainTitle(doc.Title);

            // let's also make sure "Save to file" is enabled
            menuSaveFileAs.Enabled = true;
        }
Ejemplo n.º 2
0
Archivo: Main.cs Proyecto: mikkoj/nocs
        private void AddNoc()
        {
            var untitledNoc = new Noc(_synchronizer, contextMenuEditor)
            {
                Name = "Untitled"
            };

            // let's hook up events
            untitledNoc.CaretPositionChanged += NocCaretPositionChanged;
            untitledNoc.Enter += Noc_Enter;
            untitledNoc.TokenExpired += TokenExpiredWhileSaving;
            untitledNoc.NocTitleChanged += NocTitleChanged;
            untitledNoc.Status += Status;
            untitledNoc.Text = "Untitled";
            SettingsChanged += untitledNoc.SettingsChanged;

            // let's add the new Noc to tabcontrol
            tabs.Controls.Add(untitledNoc);

            // let's update the selectedIndex
            var selectedIndex = (tabs.TabCount - 1);
            if (selectedIndex < 0)
            {
                selectedIndex = 0;
            }
            tabs.SelectedIndex = selectedIndex;
            SetMainTitle("Untitled");

            // let's also make sure "Save to file" is enabled
            menuSaveFileAs.Enabled = true;
        }