Создание Windows-приложений на основе Visual C#


   http://www.finagood.ru          

The main entry point for


} #endregion

/// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Application.Run(new mainForm()); }

private void itemExit_Click(object sender, System.EventArgs e) { this.Close(); }

private void itemUsers_Click(object sender, System.EventArgs e) { selectUser select = new selectUser(); if(select.ShowDialog() != DialogResult.OK) //Запускаем главную форму. return; if(Thread.CurrentPrincipal.Identity is UserIdentity) ((UserIdentity)Thread.CurrentPrincipal.Identity).Dispose(); string userName = select.lstViewUsers.SelectedItems[0].Text; UserIdentity identity = new UserIdentity(userName); Thread.CurrentPrincipal = new GenericPrincipal(identity, new string[]{"user"}); //Вызываем метод ActivateEventItem this.ActivateEventItem(); }

private void ActivateEventItem() { //Включаем доступность пункта меню "Действия". this.itemEvent.Enabled = true; }

private void itemNewUser_Click(object sender, System.EventArgs e) { //Создаем экземпляр wizard формы CreateUserWizard CreateUserWizard wizard = new CreateUserWizard(); //Показываем форму: wizard.ShowDialog(); if(Thread.CurrentPrincipal != null) this.ActivateEventItem(); }

private void mainForm_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if(Thread.CurrentPrincipal.Identity is UserIdentity) ((UserIdentity)Thread.CurrentPrincipal.Identity).Dispose(); }

private void itemSend_Click(object sender, System.EventArgs e) { PasswordPromt pass = new PasswordPromt(); if(pass.ShowDialog() != DialogResult.OK) return; SendMessage send = new SendMessage(); send.MdiParent = this; send.Show(); }

private void itemGet_Click(object sender, System.EventArgs e) { PasswordPromt pass = new PasswordPromt(); if(pass.ShowDialog() != DialogResult.OK) return; MessageList list = new MessageList(); list.MdiParent = this; list.Show(); }

} }

Листинг 3.22.


Содержание  Назад  Вперед