public void createNewTab(object sender, EventArgs e) { PTabPage tab = new PTabPage(this); tab.Name = "New " + tabControl.tabsCount; tab.Text = "New " + tabControl.tabsCount; tabControl.Controls.Add(tab); tabControl.SelectTab(tab); onCreateTab(tab.Name); }
public void openFigures(object sender, EventArgs e) { OpenFileDialog dlgOpen = new OpenFileDialog(); string ext = "SO (*.json; *.xml; *.yaml; *.bin; *.csv)| *.json; *.xml; *.yaml; *.bin; *.csv"; dlgOpen.Filter = ext; if (dlgOpen.ShowDialog() == DialogResult.OK) { PTabPage activeTab = tabControl.SelectedTab as PTabPage; activeTab.pdraw.Figures = SOFactory.GetInstance(dlgOpen.FileName).Open(); activeTab.pdraw.Redraw(); activeTab.Name = Path.GetFileName(dlgOpen.FileName); activeTab.Text = Path.GetFileName(dlgOpen.FileName); } }
public void saveFigures(object sender, EventArgs e) { SaveFileDialog dlgSave = new SaveFileDialog(); string[] ext = { "JSON (*.json)|*.json", "XML (*.xml) | *.xml", "YAML (*.yaml)|*.yaml", "BIN (*.bin)|*.bin", "CSV (*.csv)|*.csv" }; dlgSave.Filter = String.Join("|", ext); if (dlgSave.ShowDialog() == DialogResult.OK) { PTabPage activeTab = tabControl.SelectedTab as PTabPage; SOFactory.GetInstance(dlgSave.FileName).Save(activeTab.pdraw.Figures); activeTab.path = dlgSave.FileName; activeTab.Name = Path.GetFileName(activeTab.path); activeTab.Text = Path.GetFileName(activeTab.path); } }