public void UpdateDocumentSelectorList() { TabControl.TabPageCollection tabcoll = tabOption.TabPages; TreeView.Nodes.Clear(); // Перебираем вкладки. foreach (TabPage tabPage in tabcoll) { string fileName = tabPage.Text; Color color; // Если файл содержит символ и такую букву. if (fileName.Contains("*")) { fileName = fileName.Remove(fileName.Length - 1); } if (fileName.Contains("Untitled")) { color = Color.Green; } else { color = Color.FromArgb(255, 250, 250); } // Добавляем новый путь и цвет. TreeNode trnode = new TreeNode { Text = fileName, BackColor = color }; TreeView.Nodes.Add(trnode); } }
/// <summary> /// make Tabs and add elements on them /// </summary> private void makeForms() { LblStart2.Visible = false; numOfGames = Program.NumOfGames; mainTab.TabPages.RemoveAt(0); mainTab.TabPages.RemoveAt(0); mainTab.Multiline = true; mainTab.Dock = DockStyle.Fill; headerLab = new List <Label>(); fieldBox = new List <PictureBox>(); historyBar = new List <TrackBar>(); winLab = new List <Label>(); statLab = new List <Label>(); nowTurn = new List <Label>(); replayButton = new List <Button>(); gameTabs = new TabControl.TabPageCollection(mainTab); graphic = new List <Graphics>(); previousField = new List <GraphicField>(); previousScrollStep = new List <Int32>(); for (int i = 0; i < numOfGames; i++) { AddTab(i); } }
private void UpdateWindow() { try { TabControl.TabPageCollection tabcoll = tabOption.TabPages; foreach (TabPage tabpage in tabcoll) { ToolStripMenuItem menuitem = new ToolStripMenuItem(); string s = tabpage.Text; menuitem.Text = s; if (tabOption.SelectedTab == tabpage) { menuitem.Checked = true; } else { menuitem.Checked = false; } Invalidate(); menuitem.Click += WindowList; } } catch (Exception exception) { MessageBox.Show(exception.Message); } }
public ProductTabPagesManager(OrderForm orderFormData, TabControl.TabPageCollection tabPagesData) { _orderForm = orderFormData; _tabPages = tabPagesData; InitializeTabPageIndexToProductTypeMap(); InitializeProductTabPageItems(); }
/// <summary> /// Updates a TabControl to reflect all loaded items. /// </summary> /// <typeparam name="T">The type of element that is loaded.</typeparam> /// <param name="loaded">A list of all loaded elements.</param> /// <param name="tabControl">The TabControl to be updated.</param> /// <param name="onChange">Callback function when the Tabs where updates.</param> private void UpdateTabs <T>(List <T> loaded, TabControl tabControl, Action <object, EventArgs> onChange) { // save the current selected index int prevIndex = tabControl.SelectedIndex; TabControl.TabPageCollection pageCollection = tabControl.TabPages; // remove all pages while (pageCollection.Count != 0) { pageCollection.RemoveAt(0); } // readd all pages for (int i = 0; i < loaded.Count; i++) { pageCollection.Add(loaded[i].ToString()); } // is the index still valid? if (prevIndex >= pageCollection.Count) { prevIndex = pageCollection.Count - 1; } if (prevIndex < 0) { prevIndex = 0; } // restore the index tabControl.SelectedIndex = prevIndex; onChange.Invoke(null, null); }
/// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } if (tabs != null) { TabControl.TabPageCollection pages = tabs.TabPages; if (pages.Count > 1) { RestClient restClient = new RestClient(); restClient.EndPoint = "http://" + Properties.Settings.Default.Host.ToString() + ":8080/ReleaseFileCludge/"; //if (rClient.makePostRequest(new { file_name = newFileNameTextBox.Text })) foreach (TabPage page in pages) { if (page.AccessibilityObject.Name.Equals("KK Reader") || page.AccessibilityObject.Name.Equals(" +")) { continue; } if (page.Controls.Count <= 1) { continue; } string fileName = page.AccessibilityObject.Name; restClient.MakePostRequest(new { fileName }); } } } SaveJsonWithFilesOnDevice(); base.Dispose(disposing); }
/// <summary> /// Таймер сохранения. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void Timer_Tick(object sender, EventArgs e) { try { _timeleft--; if (_timeleft <= 0) { timerInterval.Stop(); string path = $@"backup/BackupMainFormText {_backupCount++}.rtf"; TabControl.TabPageCollection tabcoll = tabOption.TabPages; TabPage tb = tabOption.SelectedTab; foreach (TabPage tabPage in tabcoll) { SelectedTab().SaveFile(path); SelectedTab().SaveFile(tb.AccessibleDescription); File.AppendAllText("DataHistoryEditor.txt", tb.AccessibleDescription + Environment.NewLine); } _timeleft = _newTime; timerInterval.Start(); } } catch (Exception exception) { MessageBox.Show(exception.Message); } }
private void InitializeTrainingVideoLayout() { this.ControlBox = false; this.Text = string.Empty; this.FormBorderStyle = FormBorderStyle.None; this.WindowState = FormWindowState.Maximized; TabControl.TabPageCollection lTabs = this.TabControl.TabPages; foreach (TabPage lTab in lTabs) { if (lTab.Name.CompareTo(ProjectConstants.TRAINING_VIDEO_PANEL_NAME) != 0 && lTab.Name.CompareTo(ProjectConstants.SETUP_PANEL_NAME) != 0 && lTab.Name.CompareTo(ProjectConstants.CALIBRATION_PANEL_NAME) != 0) { lTabs.Remove(lTab); } } this.RecordingStatus.Visible = false; this.scoreFeedbackText.Visible = false; this.label30.Visible = false; this.startCalibration.Visible = false; this.RecordStopButton.Visible = false; this.resetCalibration.Visible = false; }
public void Indexer() { TabControl tab = new TabControl(); TabControl.TabPageCollection tabPages = new TabControl.TabPageCollection(tab); TabPage tabPageA = new TabPage(); TabPage tabPageB = new TabPage(); TabPage tabPageC = new TabPage(); TabPage tabPageD = new TabPage(); tabPages.Add(tabPageA); Assert.AreSame(tabPageA, tabPages [0], "#1"); tabPages [0] = tabPageB; Assert.AreSame(tabPageB, tabPages [0], "#2"); tabPages.Add(tabPageC); Assert.AreSame(tabPageB, tabPages [0], "#3"); Assert.AreSame(tabPageC, tabPages [1], "#4"); tabPages.Remove(tabPageB); Assert.AreSame(tabPageC, tabPages [0], "#5"); tabPages [0] = tabPageD; Assert.AreSame(tabPageD, tabPages [0], "#6"); Form form = new Form(); form.ShowInTaskbar = false; form.Controls.Add(tab); form.Show(); form.Dispose(); }
public static void Compile_Flowchart(System.Windows.Forms.TabControl.TabPageCollection tabpages) { _tpc = tabpages; Oval start = mainSubchart(tabpages).Start; foreach (Subchart sbchrt in allSubcharts(tabpages)) { sbchrt.am_compiling = false; } mainSubchart(tabpages).am_compiling = true; Generate_IL gil = new Generate_IL("MyAssembly"); try { Do_Compilation(start, gil, tabpages); } catch { foreach (Subchart sbchrt in allSubcharts(tabpages)) { sbchrt.am_compiling = false; } throw; } mainSubchart(tabpages).am_compiling = false; }
public static IEnumerable <TabPage> AsEnumerable(this TabControl.TabPageCollection pages) { for (int i = 0; i < pages.Count; i++) { yield return(pages[i]); } }
public async Task AddConfigForCategories() { // Get the serialized JSON data for the defaults dynamic ConfigSeri = await System.IO.File.OpenText(AppDomain.CurrentDomain.BaseDirectory + "ServerSettingsList.json").ReadToEndAsync(); // Create the list of default setting parameters Dictionary <string, List <Setting> > defaultSettings = JsonConvert.DeserializeObject <Dictionary <string, List <Setting> > >(ConfigSeri, new Settings.SettingConverterPreset()); Settings.defaultSettings = defaultSettings.Values.SelectMany(array => array).ToList(); // Get the control for the main form MainForm MainForm_Control = Application.OpenForms.OfType <MainForm>().First(); TabControl.TabPageCollection SettingsTabs = MainForm_Control.ServerSettingsTabControl.TabPages; // Create a new position for the position of each form Point Position = new Point(10, 10); // Add a collection of controls for each setting foreach (KeyValuePair <string, List <Setting> > settingsList in defaultSettings) { // Reset the position for each TabPager Position.X = PaddingLeft; Position.Y = PaddingTop; foreach (Setting setting in settingsList.Value) { // Start the procedure to add the collecton of controls for each setting AddConfigOption(MainForm_Control, SettingsTabs[SettingsTabs.IndexOfKey(settingsList.Key)], setting, Position); Position.Y += PaddingTop + Spacing; } } }
public void autoSave(object source, ElapsedEventArgs e) { if (this.InvokeRequired) { this.Invoke(new MethodInvoker(() => autoSave(source, e))); } else { TabControl.TabPageCollection tabs = tcMain.TabPages; try{ Parallel.ForEach(Partitioner.Create(0, tabs.Count), (range) => { for (int i = range.Item1; i < range.Item2; i++) { TabPage tp = tabs[i]; if (tp.Tag != null) { getRichTextBox(tp).BeginInvoke((MethodInvoker) delegate { getRichTextBox(tp).SaveFile((string)tp.Tag, RichTextBoxStreamType.PlainText); }); } } }); }catch (AggregateException ae) { foreach (Exception innerEx in ae.InnerExceptions) { } } } }
public Manager() { main = GUI.Main.Instance; tabs = main.TabControl; pages = tabs.TabPages; lManager.Enter(Logs.Sender.MANAGER, Logs.Level.NOTICE, "Tab Manager Initialized."); }
private void treeMain_AfterSelect(object sender, TreeViewEventArgs e) { try { TreeNode treeNode = this.treeMain.SelectedNode; if (treeNode.Tag is string) { string className = treeNode.Tag.ToString(); object obj = Activator.CreateInstance(Type.GetType(className)); Form form = obj as System.Windows.Forms.Form; if (form == null) { throw new NullReferenceException("找不到窗口:" + className); } form.TopLevel = false; TabControl.TabPageCollection tabPageCollection = this.tabShowForm.TabPages; foreach (TabPage item in tabPageCollection) { if (item.Text == form.Text) { this.tabShowForm.SelectedTab = item; return; } } TabPage tabPage = new TabPage(form.Text); tabPage.Controls.Add(form); this.tabShowForm.TabPages.Add(tabPage); form.Show(); } } catch (Exception ee) { MessageBox.Show(ee.Message); } }
/// <summary> /// Limpa todos os controles passados de todas as TabPages informadas /// </summary> /// <param name="controls">Controles onde possui os campos a serem limpados</param> /// <param name="tabPages">TabPages que necessitam ter seus controles limpados</param> public static void ClearControls(Control.ControlCollection controls, TabControl.TabPageCollection tabPages) { foreach (TabPage tp in tabPages) { ClearControls(controls); } }
public void Timer_Tick(object sender, EventArgs e) { try { --_timeLeft; // Якщо час дорівнює нулю, то виконується ця дія. if (_timeLeft <= 0) { timerInterval.Stop(); // Потрібен для журналу, файл зберігається в шляху exe-шника string path = $@"backup/BackupText {_count++}.rtf"; // TabPage tb = tabOption.SelectedTab; TabControl.TabPageCollection tabcoll = tabOption.TabPages; foreach (TabPage tabpage in tabcoll) { SelectedPageTextBox().SaveToFile(path, Encoding.UTF8); SelectedPageTextBox().SaveToFile(tb.AccessibleDescription, Encoding.UTF8); File.AppendAllText(historyFileName, tb.AccessibleDescription + Environment.NewLine); } _timeLeft = _newTime; timerInterval.Start(); } } catch (Exception exception) { LoggingHelper.LogEntry(SystemCategories.GeneralError, exception.Message + " " + exception.StackTrace); MessageBox.Show(exception.Message); } }
private void FormLootEditor_Load(object sender, EventArgs e) { // Gets all pages from the Tab Control TabControl.TabPageCollection pages = tabControlFloors.TabPages; // Adds a ListView control to each tab - I don't know if this is even in the right spot to have this Console.WriteLine("\nBegin generating ListViews"); foreach (TabPage page in pages) { ListView listView = new ListView(); listView.Name = "listView"; listView.View = View.Details; listView.FullRowSelect = true; listView.Columns.Add("Item ID / ChestGenHook", 300); listView.Columns.Add("Meta", -2); listView.Columns.Add("% Chance", -2); listView.Columns.Add("Min Amt", -2); listView.Columns.Add("Max Amt", -2); listView.DoubleClick += new EventHandler(ListView_DoubleClicked); //listView.KeyPress += new KeyPressEventHandler(ListView_KeyPressed); listView.ContextMenuStrip = contextMenuStrip1; listView.Location = new Point(6, 6); listView.Size = new Size(page.Width - 12, page.Height - 12); listView.Anchor = (AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom); page.Controls.Add(listView); Console.WriteLine("\tAdding ListView to control: " + page.Name); } Console.WriteLine("Finished generating ListViews\n"); }
/// <summary> /// Событие /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void Timer_Tick(object sender, EventArgs e) { try { // Минусуется время. _timeLeft--; // Если время равно нулю, то выполняется это действие. if (_timeLeft <= 0) { timerInterval.Stop(); // Нужен для журналирования, файл сохраняется в пути exe-шника string path = $@"backup/BackupDeveloperText {_count++}.rtf"; // TabPage tb = tabOption.SelectedTab; TabControl.TabPageCollection tabcoll = tabOption.TabPages; foreach (TabPage tabpage in tabcoll) { SelectedPageTextBox().SaveToFile(path, Encoding.UTF8); SelectedPageTextBox().SaveToFile(tb.AccessibleDescription, Encoding.UTF8); File.AppendAllText("DataHistoryEditor.txt", tb.AccessibleDescription + Environment.NewLine); } _timeLeft = _newTime; timerInterval.Start(); } } catch (Exception exception) { MessageBox.Show(exception.Message); } }
private void saveAllToolStripMenuItem_Click(object sender, EventArgs e) { SaveFileDialog saveFileDialog1 = new SaveFileDialog(); saveFileDialog1.InitialDirectory = @"C:\"; saveFileDialog1.Title = "Save text Files"; saveFileDialog1.Filter = "txt files (*.txt)|*.txt"; saveFileDialog1.FilterIndex = 2; saveFileDialog1.RestoreDirectory = true; try { TabControl.TabPageCollection tabcollection = tabControl1.TabPages; foreach (TabPage tabpage in tabcollection) { if (!(tabpage.Text).Contains("Encrypted")) { if (!(tabpage.Text).Equals("untitled *")) { RichTextBox rtb = tabpage.Controls[1] as RichTextBox; //returns the rich tex box of that selected tab string text = rtb.Text; var t2 = new Task(() => saveAll(tabpage, text)); //run as a separate task t2.Start(); //start the task Task.WaitAll(t2); //wait till it completes } else { if (saveFileDialog1.ShowDialog() == DialogResult.OK) { path = saveFileDialog1.FileName; tabpage.Tag = path; //set the path as the tab's tag field String[] substrings = path.Split('\\'); int noofStrings = substrings.Length; tabpage.Text = substrings[noofStrings - 1]; //set the name of the tab as the file name RichTextBox rtbnew = tabpage.Controls[1] as RichTextBox; string text = rtbnew.Text; File.WriteAllText(saveFileDialog1.FileName, myrtb().Text); //write what is in the rich text box to the file File.WriteAllLines(path, myrtb().Lines); } } } else { RichTextBox rtb = tabpage.Controls[1] as RichTextBox; string text = rtb.Text; byte[] toEncodeAsBytes = ASCIIEncoding.ASCII.GetBytes(text); //if it is already an encrypted file, encrypt the text string encryptedText = Convert.ToBase64String(toEncodeAsBytes); var t2 = new Task(() => saveAll(tabpage, encryptedText)); //run as another task t2.Start(); Task.WaitAll(t2); //wait till task completes } } } catch (InvalidOperationException ee) { Console.WriteLine(ee); } }
private void loadControls(string Status) { if (_Position == "Stf") { TabControl.TabPageCollection objTabs = this.tabMain.TabPages; setupTabs_Staff(objTabs); } }
void init() { this.__ul = new IHTMLUnorderedList(); this.__ul.name = "tabs"; this.__ul.style.marginTop = "0"; this.__ul.style.marginRight = "0"; this.__ul.style.marginBottom = "-1px"; this.__ul.style.marginLeft = "0"; this.__ul.style.paddingTop = "0"; this.__ul.style.paddingRight = "0"; this.__ul.style.paddingBottom = "0.3em"; this.__ul.style.paddingLeft = "0"; this.__ul.style.width = "" + this.Size.Width; this.__ul.style.height = "" + __TAB_BAR_HEIGHT; this.__ul.style.Float = DOM.IStyle.FloatEnum.left; this.__ulContainer = new IHTMLDiv(); this.__ulContainer.name = "ulcontainer"; this.__ulContainer.style.width = "" + this.Size.Width; this.__ulContainer.style.height = "" + __TAB_BAR_HEIGHT; this.__ulContainer.style.position = DOM.IStyle.PositionEnum.relative; this.__ulContainer.style.top = "0"; this.__ulContainer.style.bottom = "0"; this.__ulContainer.appendChild(this.__ul); this.__tabFiller = new IHTMLDiv(); this.__tabFiller.name = "filler"; this.__tabFiller.style.height = "" + __TAB_BAR_HEIGHT; this.__tabFiller.style.borderBottom = "1px solid"; this.__tabFiller.style.borderTop = "none"; this.__tabFiller.style.borderRight = "none"; this.__tabFiller.style.borderLeft = "none"; this.__tabFiller.style.minWidth = "0"; this.__tabFiller.style.Float = DOM.IStyle.FloatEnum.left; this.InternalContainer = new IHTMLDiv(); this.InternalContainer.name = "tabcontrol"; this.__tabs = new Panel(); this.__tabs.Location = new Point(0, 0); this.__tabs.Size = new Size(this.Size.Width, __TAB_BAR_HEIGHT); setTabsSize(); base.Controls.Add(this.__tabs); this.__tabs.GetHTMLTarget().appendChild(this.__ulContainer); this.__tabs.GetHTMLTarget().style.SetLocation(0, 0, this.Size.Width, __TAB_BAR_HEIGHT); _tabPages = new TabControl.TabPageCollection((TabControl)this); FontChanged += OnFontChanged; }
private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { try { // Собираю инфу про вкладку. TabControl.TabPageCollection tabcoll1 = tabOption.TabPages; // Читаю с текстового файла. string[] arrPages = File.ReadAllLines("DataHistoryEditor.txt"); // Создаю 3 списка List <string> list = new List <string>(arrPages); List <string> tabPageUrl = new List <string>(); List <string> finalList = new List <string>(); // Добавление вкладок в список. foreach (TabPage tabpage in tabcoll1) { tabPageUrl.Add(tabpage.AccessibleDescription); } // Убираю не нужные ссылки. finalList = tabPageUrl.Where(g => !list.Contains(g)).ToList(); if (tabOption.TabCount > 0) { TabControl.TabPageCollection tabcoll = tabOption.TabPages; // Перебираем вкладки. foreach (TabPage tabpage in tabcoll) { tabOption.SelectedTab = tabpage; // Если не сохранилось, то выполняем условие. if (tabpage.Text.Contains("Untitled")) { SaveFile_Click(sender, e); } tabOption.TabPages.Remove(tabpage); _filePath = tabpage.AccessibleDescription; // Добавляем ссылки в файл. for (int i = 0; i < finalList.Count; i++) { if (!finalList[i].Contains("Untitled")) { File.AppendAllText("DataHistoryEditor.txt", finalList[i] + Environment.NewLine); } } break; } } // Добавляем в дебаг. File.AppendAllText("DebugLog.txt", $"[{DateTime.UtcNow}] Closing DeveloperEditor {Environment.NewLine}"); } catch (Exception exception) { MessageBox.Show(exception.Message); } }
public void ApplyTranslation(TabControl.TabPageCollection Pages) { foreach (TabPage c in Pages) { if (c.Tag != null) { c.Text = GetValue(LanguageSection, c.Tag.ToString(), c.Text); } } }
/// <summary> /// Initialize product tab pages. /// </summary> private void InitializeProductTabPages() { TabControl.TabPageCollection tabPages = _productTabControl.TabPages; for (int i = 0; i < _model.GetProductTypesCount(); i++) { TabPage tabPage = tabPages[i]; tabPage.Controls.Add(CreateTableLayout(TAB_PAGE_LAYOUT_NAME, AppDefinition.TAB_PAGE_LAYOUT_ROW_COUNT, AppDefinition.TAB_PAGE_LAYOUT_COLUMN_COUNT)); PopulateProductTabPageButtons(( TableLayoutPanel )tabPage.Controls[TAB_PAGE_LAYOUT_NAME], i); } }
/// <summary> /// Initialize tab pages. /// </summary> public void InitializeProductTabPages() { TabControl.TabPageCollection tabPages = _productTabControl.TabPages; for (int i = 0; i < AppDefinition.TAB_PAGES_COUNT; i++) { TabPage tabPage = tabPages[i]; tabPage.Controls.Add(Model.CreateTableLayout(TAB_PAGE_LAYOUT_NAME, AppDefinition.TAB_PAGE_LAYOUT_ROW_COUNT, AppDefinition.TAB_PAGE_LAYOUT_COLUMN_COUNT)); PopulateProductTabPageItems(( TableLayoutPanel )tabPage.Controls[TAB_PAGE_LAYOUT_NAME], i); } }
private void design() { TabControl.TabPageCollection pages = tabControlMain.TabPages; foreach (TabPage page in pages) { page.BackColor = frm.grauMittel; } panMonatswahl.BackColor = frm.grauDunkel1; }
private void initTabPages() { TabControl.TabPageCollection tabpages = tabControl.TabPages; foreach (TabPage page in tabpages) { BetBrowser browserControl = new BetBrowser(); browserControl.Dock = DockStyle.Fill; browserControl.TextCaptured += onBrowserTextCaptured; page.Controls.Add(browserControl); } }
public static List <TabPage> AsList(this TabControl.TabPageCollection collection) { List <TabPage> pages = new List <TabPage>(); foreach (TabPage page in collection) { pages.Add(page); } return(pages); }
/// <summary> /// Initialize tab pages. /// </summary> public void InitializeTabPages() { TabControl.TabPageCollection tabPages = _tabControl.TabPages; for (int index = 0; index < tabPages.Count; index++) { TabPage tabPage = tabPages[index]; tabPage.Controls.Add(CreateTableLayout(TAB_PAGE_LAYOUT_NAME, TAB_PAGE_LAYOUT_ROW_COUNT, TAB_PAGE_LAYOUT_COLUMN_COUNT)); PopulateTabPageWithProducts(ref tabPage, index); } _tabControl.SelectedIndexChanged += new EventHandler(ChangeTabPage); }