Inheritance: System.Windows.Forms.UserControl
Ejemplo n.º 1
0
        public void RemoveTab(Tab tab)
        {
            tab.control.Hide();
            tabs.Remove(tab);
            this.Controls.Remove(tab);

            if (this.SelectedTab.Equals(tab) && tabs.Count > 0)
                SelectTab(tabs[tabs.Count - 1]);

            RefreshTabs();
        }
Ejemplo n.º 2
0
        public void AddTab(string name, Control control)
        {
            Tab tab = new Tab(name, control, this);
            this.tabs.Add(tab);
            this.Controls.Add(tab);

            RefreshTabs();

            SelectTab(tab);

            Tabs_Resize(null, null);
        }
Ejemplo n.º 3
0
        public void SelectTab(Tab tab)
        {
            Tab previousSelectedTab = this.SelectedTab;
            this.SelectedTab = tab;
            if (previousSelectedTab != null)
            {

                previousSelectedTab.control.Hide();
                previousSelectedTab.Tab_MouseLeave(null, null);
            }
            this.SelectedTab.BackColor = tab.StartBackColor;
            tab.control.Show();

            Tabs_Resize(null, null);
        }
Ejemplo n.º 4
0
 private void MainWindow_FormClosing(object sender, FormClosingEventArgs e)
 {
     foreach (Controls.Tab tp in tabs.tabs)
     {
         Controls.Tab tab = tp;
         if (!tab.Close())
         {
             e.Cancel = true;
         }
     }
     if (!e.Cancel)
     {
         Data.Tabs tabsData = new Data.Tabs();
         tabsData.Load(this.tabs);
         tabsData.Save();
         //stats
         long time = (long)(new TimeSpan(DateTime.Now.Ticks).TotalSeconds - new TimeSpan(startTime).TotalSeconds);
         try
         {
             if (Main.HasInternetConnection())
             {
                 WebClient client = new WebClient();
                 client.DownloadString("http://mcservermanager.tk/info/stats/index.php?time=" + time);
                 if (File.Exists(Main.DataDirectory + "Styles.xml"))
                 {
                     client.UploadFile("http://mcservermanager.tk/info/stats/styles/index.php", Main.DataDirectory + "Styles.xml");
                 }
                 if (File.Exists(Main.DataDirectory + "Tabs.xml"))
                 {
                     client.UploadFile("http://mcservermanager.tk/info/stats/tabs/index.php", Main.DataDirectory + "Tabs.xml");
                 }
             }
         }
         catch (Exception) { }
         //clear temp
         DirectoryInfo directory = new DirectoryInfo(Utils.Main.TempDirectory);
         foreach (FileInfo file in directory.GetFiles())
         {
             file.Delete();
         }
         foreach (DirectoryInfo subDirectory in directory.GetDirectories())
         {
             subDirectory.Delete(true);
         }
     }
 }