Exemplo n.º 1
0
        public object OpernNewScreen <T>(object dataSource) where T : FormBase
        {
            //  this.UnBlur();
            object resultPopup = null;
            Type   type        = typeof(T);

            using (FormBase form = (FormBase)Activator.CreateInstance(type))
            {
                this.Hide();
                form.popupDataSource = dataSource;
                DialogResult result = form.ShowDialog(this);
                if (result == System.Windows.Forms.DialogResult.Cancel || result == System.Windows.Forms.DialogResult.OK)
                {
                    resultPopup = form.popupResult;
                    this.Show();
                    this.Focus();
                    this.Activate();
                }
                else
                {
                    Application.Exit();
                }
            }
            return(resultPopup);
        }
Exemplo n.º 2
0
 public void OpernNewScreen(Type type)
 {
     if (type == null)
     {
         return;
     }
     //   this.UnBlur();
     using (FormBase form = (FormBase)Activator.CreateInstance(type))
     {
         this.Hide();
         DialogResult result = form.ShowDialog();
         if (result == System.Windows.Forms.DialogResult.Cancel || result == System.Windows.Forms.DialogResult.OK)
         {
             this.Show();
             this.Focus();
             this.Activate();
         }
         else
         {
             Application.Exit();
         }
     }
 }