private void Form1_Load(object sender, EventArgs e) { try { // Set up the XML storee component (storage directory and file extension) string dir = Path.GetDirectoryName(Path.GetDirectoryName(Application.StartupPath)) + @"\Demo Programs\Security Demo\Sample Project"; xmlStore.DirectoryName = dir; xmlStore.FileExtension = ".nspj"; // Add a search path for shape assemblies (application's startup directory in this case) project.LibrarySearchPaths.Add(Application.StartupPath); // Set the name of the project to open and open it project.Name = "Security Demo Sample Project"; project.Open(); // Activate the pointer tool and load the sample diagram display1.ActiveTool = toolSetController.DefaultTool; display1.LoadDiagram("Simple Circuit"); chkHideMenuItems.Checked = true; chkHideProperties.Checked = true; SecurityDemoHelper.FillUserAndDomainComboBoxes(cboUser, cboDomain); InitializeSecurityManager(); UpdateSecurityInfoCtrls(); } catch (Exception exc) { // Always catch exceptions in the Form.Load event (and show their messages) as the framework // swallows all exceptions thrown in this exception handler without any notice in non-debug mode! MessageBox.Show(this, exc.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public SecuritySettingsEditor(MainForm owner) { InitializeComponent(); if (owner == null) { throw new ArgumentNullException("owner"); } this.owner = owner; SecurityDemoHelper.FillUserAndDomainComboBoxes(cboUser, cboDomain); cboUser.SelectedItem = owner.SecurityManager.CurrentRole; cboDomain.SelectedIndex = 0; }
private void Form1_Load(object sender, EventArgs e) { try { string dir = Path.GetDirectoryName(Path.GetDirectoryName(Application.StartupPath)) + @"\Demo Programs\Security Demo\Sample Project"; xmlStore.DirectoryName = dir; xmlStore.FileExtension = ".nspj"; project.LibrarySearchPaths.Add(Application.StartupPath); project.Name = "Security Demo Sample Project"; project.Open(); display1.CurrentTool = toolSetController.DefaultTool; display1.LoadDiagram("Simple Circuit"); chkHideMenuItems.Checked = true; chkHideProperties.Checked = true; SecurityDemoHelper.FillUserAndDomainComboBoxes(cboUser, cboDomain); InitializeSecurityManager(); UpdateSecurityInfoCtrls(); } catch (Exception exc) { MessageBox.Show(this, exc.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }