Exemple #1
0
        private void OnItemClick(object sender, EventArgs e)
        {
            //Event handler for menu/toolbar item clicked
            try {
                ToolStripItem item = (ToolStripItem)sender;
                switch (item.Name)
                {
                case "msFileNew":
                case "csNew":
                case "tsbNew":
                    dlgInputBox input = new dlgInputBox("Specify a domain username (i.e. argix\\username)", "argix\\", "Create New User");
                    if (input.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                    {
                        ApplicationServicesGateway.CreateUser("Argix", input.Value);
                        this.msViewRefresh.PerformClick();
                    }
                    break;

                case "msFileDelete":
                case "csDelete":
                case "tsbDelete":
                    DialogResult res = MessageBox.Show("Delete the selected user?", App.Product, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                    if (res == System.Windows.Forms.DialogResult.Yes)
                    {
                        string name = this.grdMain.Selected.Rows[0].Cells["UserId"].Value.ToString();
                        ApplicationServicesGateway.DeleteUser("Argix", name);
                        this.msViewRefresh.PerformClick();
                    }
                    break;

                case "msFileExit": this.Close(); break;

                case "msViewRefresh":
                case "tsbRefresh":
                    this.mUsers.Clear();
                    this.mUsers.Merge(ApplicationServicesGateway.GetUsers("Argix"));
                    break;

                case "msViewFont":
                    FontDialog fd = new FontDialog();
                    fd.FontMustExist = true;
                    fd.Font          = this.Font;
                    if (fd.ShowDialog() == DialogResult.OK)
                    {
                        this.Font = this.msMain.Font = this.tsMain.Font = this.ssMain.Font = fd.Font;
                    }
                    break;

                case "msViewToolbar": this.tsMain.Visible = (this.msViewToolbar.Checked = !this.msViewToolbar.Checked); break;

                case "msViewStatusBar": this.ssMain.Visible = (this.msViewStatusBar.Checked = !this.msViewStatusBar.Checked); break;

                case "msHelpAbout": new dlgAbout(App.Product + " Application", App.Version, App.Copyright, App.Configuration).ShowDialog(this); break;
                }
            }
            catch (Exception ex) { App.ReportError(ex); }
            finally { setUserServices(); this.Cursor = Cursors.Default; }
        }
Exemple #2
0
 public string Show()
 {
     _result = "";
     _dlg.ShowDialog();
     return(_result);
 }