Example #1
0
        public void SaveToFile(string json)
        {
            if (_toSaveTab == null)
            {
                _toSaveTab = tabControl.SelectedTab;
            }
            var sw = File.CreateText(_toSaveTab.FPath + ".json");

            _toSaveTab = null;

            sw.Write(json);
            sw.Close();
            sw.Dispose();
        }
        public void SelectTab(KryptonTab tab)
        {
            if (tab != SelectedTab)
            {
                SelectedTab.Hide();

                SelectedTab = tab;
                SelectedTab.Show();
            }
        }
 public bool HasTab(KryptonTab tab)
 {
     if (tabHeader.ButtonSpecs.Contains(tab.TabTag))
     {
         return true;
     }
     return false;
 }
        public KryptonTab AddNewTab(string name, string fpath)
        {
            if (SelectedTab != null)
            {
                SelectedTab.Hide();
            }

            KryptonTab tab = new KryptonTab(name, fpath);
            tab.OnSelecting += () =>
                {
                    SelectedTab.Hide();

                    SelectedTab = tab;
                    SelectedTab.Show();
                };

            SelectedTab = tab;
            SelectedTab.Show();

            tabHeader.ButtonSpecs.Add(tab.TabTag);
            tabBody.Controls.Add(tab.Container);

            _allTabs.Add(tab);

            return tab;
        }
Example #5
0
        private void sbtnSaveAll_Click(object sender, EventArgs e)
        {
            var index = 0;
            Timer timer = new Timer();
            timer.Interval = 1000;
            timer.Tick += (ss, ee) =>
            {
                if (index + 1 == tabControl.Tabs.Count)
                {
                    timer.Stop();
                }

                _toSaveTab = tabControl.Tabs[index];
                var browser = _toSaveTab.Container.Controls[0] as WebBrowser;
                ++index;

                browser.Document.InvokeScript("Save");
            };

            timer.Start();
        }