private void defaultGraphOptionsToolStripMenuItem_Click(object sender, EventArgs e) { PropertiesDialog pd = new PropertiesDialog(_defaultProperties); if (pd.ShowDialog() == DialogResult.OK) { _defaultProperties = pd.DSGraphEditPanelProperties; //set the properties of any open Graphs foreach (GraphForm graph in _Graphs) { graph.DSGraphEditPanel.DSGraphEditPanelProperties = _defaultProperties; } // serialize the properties try { FileStream fs = new FileStream("DSGraphEdit.options", FileMode.Create); BinaryFormatter bformatter = new BinaryFormatter(); bformatter.Serialize(fs, _defaultProperties); fs.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error writing default options"); } } pd.Dispose(); pd = null; }
private void Form1_Load(object sender, EventArgs e) { _filtersForm.Show(_dockPanel, DockState.DockLeft); _graphNavigator.Show(_filtersForm.Pane, DockAlignment.Top, 0.25); // load or create default graph options if (File.Exists("DSGraphEdit.options")) { try { Stream filestream = File.OpenRead("DSGraphEdit.options"); BinaryFormatter bformatter = new BinaryFormatter(); _defaultProperties = (DSGraphEditPanelProperties)bformatter.Deserialize(filestream); filestream.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error reading default options"); _defaultProperties = new DSGraphEditPanelProperties(); } } else { _defaultProperties = new DSGraphEditPanelProperties(); } // create the initial blank graph GraphForm current = NewGraph(); current.Show(_dockPanel, DockState.Document); }
public PropertiesDialog(DSGraphEditPanelProperties properties) { InitializeComponent(); okButton.DialogResult = DialogResult.OK; cancelButton.DialogResult = DialogResult.Cancel; // populate the ui elements for (int i = 0; i < 7; i++) { noodleStyleComboBox.Items.Add(((NoodleStyle)i).ToString()); } noodleStyleComboBox.SelectedIndex = (int)properties.NoodleStyle; for (int i = 0; i < 3; i++) { pinPlacementCombobox.Items.Add(((DaggerNodePinPlacement)i).ToString()); } pinPlacementCombobox.SelectedIndex = (int)properties.PinPlacement; canvasColorButton.BackColor = properties.CanvasBackColor; dropShadowVisibleCheckBox.Checked = properties.DropShadowVisible; modalPropertiesCheckbox.Checked = properties.ModalProperties; showTimeSliderCheckbox.Checked = properties.ShowTimeSlider; showPinNamesCheckbox.Checked = properties.ShowPinNames; }