Page 152 - DCAP408_WEB_PROGRAMMING
P. 152

Windows Programming




                    Notes                       Username = “OldUserName”;
                                                 InitializeComponent();
                                                           this.txtBlockUsername.Text  =  Username;
                                              }

                                                       private  void  button1_Click(object  sender,  RoutedEventArgs  e)
                                              {
                                                               LoginChildWindow  loginWindow  =  new  LoginChildWindow();
                                                  loginWindow.Login = Username;
                                                loginWindow.Closed += new EventHandler(OnLoginChildWindowShow);


                                                  loginWindow.Show();
                                              }
                                                         private  void  OnLoginChildWindowShow(object  sender,  EventArgs  e)
                                               {
                                                 LoginChildWindow loginChildWindow = sender as LoginChildWindow;


                                                                 if  (loginChildWindow.DialogResult  ==  true)
                                                  {
                                                                         this.txtBlockUsername.Text  =  loginChildWindow.Login;
                                                               this.txtBlockPassword.Text  = loginChildWindow.Password;
                                                      //;
                                                  }
                                               }
                                           }
                                      }


                                   While I have included my version of System.Windows.Controls.dll in the app download, please
                                   use your own. I’ve grabbed several in the last six months from various locations and I don’t
                                   know if mine is the right one.


                                          Example:





















          146                               LOVELY PROFESSIONAL UNIVERSITY
   147   148   149   150   151   152   153   154   155   156   157