private void ShowForm()
 {
     if (TrayFormCreator != null)
     {
         if (displayedForm == null)
         {
             try
             {
                 displayedForm = TrayFormCreator(StateObject);
                 displayedForm.ShowDialog(); //It SHOULD get stuck here! That way, it can't release the lock until the form gets closed!
                 TrayFormCleanup?.Invoke(displayedForm, StateObject);
             }
             finally
             {
                 displayedForm = null;
             }
         }
         else
         {
             //Form may have become null in the time it took to get down here. use ? for safety.
             displayedForm?.Activate();
         }
     }
     else
     {
         Logger.Error($"Tried showing a form when no form creator was set!");
     }
 }
Exemplo n.º 2
0
        private void OnClick(object sender, MouseEventArgs e)
        {
            // We do not operate the qat button at design time
            if (!_ribbon.InDesignMode)
            {
                Form ownerForm = _ribbon.FindForm();

                // Ensure the form we are inside is active
                ownerForm?.Activate();

                // Inform quick access toolbar button it has been clicked
                _qatButton.PerformClick();
            }
        }
        private void OnClick(object sender, MouseEventArgs e)
        {
            Form ownerForm = _ribbon.FindForm();

            // Ensure the form we are inside is active
            ownerForm?.Activate();

            if ((ClickAndFinish != null) && !_ribbon.InDesignMode)
            {
                ClickAndFinish(this, _finishDelegate);
            }
            else
            {
                ClickFinished(this, EventArgs.Empty);
            }
        }
Exemplo n.º 4
0
 private void buttonItem4_Click(object sender, EventArgs e)
 {
     try
     {
         if (frmUsers == null || frmUsers.MdiParent == null)
         {
             frmUsers = new frmUser();
             // frmUsers.MdiParent = this;
             frmUsers.Location = new Point(0, 0);
             frmUsers.Show();
         }
         else
         {
             frmUsers.Activate();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 5
0
 private void btn_xemlskb_Click(object sender, EventArgs e)
 {
     if (txt_socmnd.Text != "")
     {
         Form frm = kiemtratontai(typeof(Admin.fr_admin_xemlichsu));
         if (frm != null)
         {
             frm.Activate();
         }
         else
         {
             Admin.fr_admin_xemlichsu fr = new Admin.fr_admin_xemlichsu(txt_socmnd.Text);
             fr.ShowDialog();
         }
     }
     else
     {
         MessageBox.Show("Hãy chọn bệnh nhân để xem lịch sử", "Chú Ý", MessageBoxButtons.OK);
         dgv_ds.Focus();
     }
 }
Exemplo n.º 6
0
        private void barbtnEmployee_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Form empListForm = this.checkExist(typeof(frmEmployee));

            if (empListForm != null)
            {
                empListForm.Activate();
            }
            else
            {
                //create new one
                empListForm           = new frmEmployee();
                empListForm.MdiParent = this;
                //set fill parent
                empListForm.Dock = DockStyle.Fill;
                //turn off border style
                empListForm.FormBorderStyle = FormBorderStyle.None;
                //show
                empListForm.Show();
            }
        }
Exemplo n.º 7
0
        public static void ShowForm(string form)
        {
            saveCurrentForm(form, FormShowType.Normal);

            if (!checkPrivilegeToAccessForm(form))
            {
                return;
            }

            Form frm = formFactory.GetForm(form);

            frm.MdiParent = frmMain;
            frm.Show();
            frm.Activate();

            if (formKeysToCaptions.ContainsKey(form))
            {
                string caption = formKeysToCaptions[form];
                SetStatusCaption(form, caption);
            }
        }
Exemplo n.º 8
0
 private void btnSanghaUpasthayaka_Click(object sender, EventArgs e)
 {
     try
     {
         if (rptSanghaUpasthayaka == null || rptSanghaUpasthayaka.MdiParent == null)
         {
             rptSanghaUpasthayaka = new rpt_SanghaUpasthayaka();
             // rptSanghaUpasthayaka.MdiParent = this;
             rptSanghaUpasthayaka.Location = new Point(0, 0);
             rptSanghaUpasthayaka.Show();
         }
         else
         {
             rptSanghaUpasthayaka.Activate();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 9
0
        private void EditRuleItem_Click(object sender, EventArgs e)
        {
            if (!RulesAreExist())
            {
                return;
            }
            Form er = Application.OpenForms["editRule"];

            if (er != null)
            {
                er.Activate();
                return;
            }
            else
            {
                //editRuleForm editRuleForm = new editRuleForm(rulesGrid);
                editRuleForm erf = new editRuleForm(rulesGrid);
                erf.ShowDialog();
            }
            rulesUpdater.UpdateRules();
        }
Exemplo n.º 10
0
        private void btlogin_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            btlogin.Enabled      = btBD.Enabled = btDSDK.Enabled = btKHOA.Enabled = btLOP.Enabled = btCancel.Enabled = btMonHoc.Enabled = false;
            btnXEMBAITHI.Enabled = btnXEMBANGDIEM.Enabled = btnXEMDSDANGKY.Enabled = false;

            Form frm = this.CheckExists(typeof(frmRegisterUsers));

            if (frm != null)
            {
                frm.Activate();
            }

            else
            {
                //btlogin.Enabled = btBD.Enabled = btDSDK.Enabled = btKHOA.Enabled = btLOP.Enabled = btCancel.Enabled = btMonHoc.Enabled = false;
                //btnXEMBAITHI.Enabled = btnXEMBANGDIEM.Enabled = btnXEMDSDANGKY.Enabled = false;
                frmRegisterUsers f = new frmRegisterUsers();
                f.MdiParent = this;
                f.Show();
            }
        }
Exemplo n.º 11
0
 private void btnXEMDSDANGKY_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (Program.mNhom.Equals("TRUONG") || Program.mNhom.Equals("COSO"))
     {
         Form frm = this.CheckExists(typeof(frmBaoCao));
         if (frm != null)
         {
             frm.Activate();
         }
         else
         {
             frmBaoCao f = new frmBaoCao();
             f.MdiParent = this;
             f.Show();
         }
     }
     else
     {
         MessageBox.Show("Bạn không có quyền xem mục này!");
     }
 }
Exemplo n.º 12
0
        public static void ActivateTopLevelWindow(Control control)
        {
            //	Prevent stupidity.
            if (control == null || !control.IsHandleCreated)
            {
                return;
            }

            //	Find the form that contains the control.  If it's found, we get off easy, and can
            //	activate it natively through .NET.
            Form form = control.FindForm();

            if (form != null)
            {
                form.Activate();
            }
            else
            {
                User32.BringWindowToTop(control.Handle);
            }
        }
Exemplo n.º 13
0
        private void btn_douong_Click(object sender, EventArgs e)
        {
            pnl_leftbar.Height = btn_douong.Height;
            pnl_leftbar.Top    = btn_douong.Top;
            changeColor(btn_douong);
            Form frm = kiemtraform(typeof(QLMENU));

            if (frm == null)
            {
                QLMENU forms = new QLMENU();
                forms.TopLevel = false;
                content.Controls.Clear();
                content.Controls.Add(forms);
                forms.Dock = DockStyle.Fill;
                forms.Show();
            }
            else
            {
                frm.Activate();
            }
        }
Exemplo n.º 14
0
        private void bunifuFlatButton1_Click(object sender, EventArgs e)
        {
            pnl_leftbar.Height = bunifuFlatButton1.Height;
            pnl_leftbar.Top    = bunifuFlatButton1.Top;
            changeColor(bunifuFlatButton1);
            Form frm = kiemtraform(typeof(QLBC));

            if (frm == null)
            {
                QLBC forms = new QLBC();
                forms.TopLevel = false;
                content.Controls.Clear();
                content.Controls.Add(forms);
                forms.Dock = DockStyle.Fill;
                forms.Show();
            }
            else
            {
                frm.Activate();
            }
        }
Exemplo n.º 15
0
        private void frmGui_Load(object sender, EventArgs e)
        {
            pnl_leftbar.Height = btn_banhang.Height;
            pnl_leftbar.Top    = btn_banhang.Top;
            changeColor(btn_banhang);
            Form frm = kiemtraform(typeof(ORDER));

            if (frm == null)
            {
                ORDER forms = new ORDER();
                forms.TopLevel = false;
                content.Controls.Clear();
                content.Controls.Add(forms);
                forms.Dock = DockStyle.Fill;
                forms.Show();
            }
            else
            {
                frm.Activate();
            }
        }
Exemplo n.º 16
0
 private void allReportButton_Click(object sender, EventArgs e)
 {
     try
     {
         if (rptAllBhikkuSummary == null || rptAllBhikkuSummary.MdiParent == null)
         {
             rptAllBhikkuSummary = new rptAllBhikkuSummary();
             //rptAllBhikkuSummary.MdiParent = this;
             rptAllBhikkuSummary.Location = new Point(0, 0);
             rptAllBhikkuSummary.Show();
         }
         else
         {
             rptAllBhikkuSummary.Activate();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 17
0
 private void btnGiaoVienDangKy_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (Program.KetNoi() == 0)
     {
         btnGiaoVienDangKy.Enabled = false;
     }
     else
     {
         Form frm = this.CheckExists(typeof(txtTrinhDo));
         if (frm != null)
         {
             frm.Activate();
         }
         else
         {
             txtTrinhDo f = new txtTrinhDo();
             f.MdiParent = this;
             f.Show();
         }
     }
 }
Exemplo n.º 18
0
 private void buttonItem7_Click(object sender, EventArgs e)
 {
     try
     {
         if (rptAllBhikkuaspImg == null || rptAllBhikkuaspImg.MdiParent == null)
         {
             rptAllBhikkuaspImg = new rpt_AllbhikkuAsapuwaWithImage();
             // rptAllBhikkuaspImg.MdiParent = this;
             rptAllBhikkuaspImg.Location = new Point(0, 0);
             rptAllBhikkuaspImg.Show();
         }
         else
         {
             rptAllBhikkuaspImg.Activate();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 19
0
 private void btnBangDiem_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (Program.KetNoi() == 0)
     {
         btnBangDiem.Enabled = false;
     }
     else
     {
         Form frm = this.CheckExists(typeof(BangDiem));
         if (frm != null)
         {
             frm.Activate();
         }
         else
         {
             BangDiem f = new BangDiem();
             f.MdiParent = this;
             f.Show();
         }
     }
 }
Exemplo n.º 20
0
        private void ExecutePlugin(DataRow drData)
        {
            int    menuID     = Int32.Parse(drData["MenuPluginID"].ToString());
            string pluginName = drData["PluginName"].ToString();
            Form   frm        = MdiExists(pluginName);

            if (frm != null)
            {
                frm.Activate();
            }
            else
            {
                frm = pm.Execute(menuID, pluginName);
                if (frm != null)
                {
                    frm.Text      = drData["MenuName"].ToString();
                    frm.MdiParent = this;
                    frm.Show();
                }
            }
        }
Exemplo n.º 21
0
 private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (Program.KetNoi() == 0)
     {
         btnLop.Enabled = false;
     }
     else
     {
         Form frm = this.CheckExists(typeof(frmLop));
         if (frm != null)
         {
             frm.Activate();
         }
         else
         {
             frmLop f = new frmLop();
             f.MdiParent = this;
             f.Show();
         }
     }
 }
Exemplo n.º 22
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (form1var == null)
     {
         form1var = new SkyIndexAnalyzer_AnalysisForm();
         form1var.Show();
     }
     else if (!form1var.Visible)
     {
         form1var = new SkyIndexAnalyzer_AnalysisForm();
         form1var.Show();
     }
     else
     {
         form1var.Activate();
         if (form1var.WindowState == FormWindowState.Minimized)
         {
             form1var.WindowState = FormWindowState.Normal;
         }
     }
 }
Exemplo n.º 23
0
        private void gvData_DoubleClick(object sender, EventArgs e)
        {
            Form frm = Application.OpenForms["frmImportDetail"];

            if (frm != null)
            {
                frm.Activate();
            }
            else
            {
                int row_index = gvData.FocusedRowHandle;
                if (row_index >= 0)
                {
                    string          col_IDDocument   = "IDDocument";
                    object          value_IDDocument = gvData.GetRowCellValue(row_index, col_IDDocument);
                    frmExportDetail f = new frmExportDetail(Convert.ToInt32(value_IDDocument));
                    f.MdiParent = this.ParentForm;
                    f.Show();
                }
            }
        }
Exemplo n.º 24
0
        /// <summary>
        /// Processes messages during normal operations (while the form is not resized or moved)
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        private bool DefaultMsgProcessor(ref Message m)
        {
            switch (m.Msg)
            {
            case Win32.WM.Wi_NCLBUTTONDOWN:
            {
                originalForm.Activate();
                mousePoint.X = (short)Win32.Bit.LoWord((int)m.LParam);
                mousePoint.Y = (short)Win32.Bit.HiWord((int)m.LParam);
                if (OnNCLButtonDown((int)m.WParam, mousePoint))
                {
                    //m.Result = new IntPtr ( (resizingForm || movingForm) ? 1 : 0 );
                    m.Result = (IntPtr)((resizingForm || movingForm) ? 1 : 0);
                    return(true);
                }
                break;
            }
            }

            return(false);
        }
Exemplo n.º 25
0
 private void buttonItem4_Click_1(object sender, EventArgs e)
 {
     try
     {
         if (rptBinfo == null || rptBinfo.MdiParent == null)
         {
             rptBinfo = new rptBhikkuReport();
             // rptBinfo.MdiParent = this;
             rptBinfo.Location = new Point(0, 0);
             rptBinfo.Show();
         }
         else
         {
             rptBinfo.Activate();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 26
0
        private void UIShowMsgBox(string strMsg)
        {
            Form fmP = this; Control c = this;

            while (true)
            {
                c = c.Parent; if (c != null && c is Form)
                {
                    fmP = (Form)c;
                }
                if (c == null)
                {
                    break;
                }
            }
            if (fmP != null)
            {
                fmP.Activate();
            }
            MsgBox.ShowInfoMsg2(strMsg);
        }
Exemplo n.º 27
0
        void navBarItem_LinkClicked(object sender, NavBarLinkEventArgs e)
        {
            VusermenuDto barItemMenu = GetMenuFromMenus(e.Link.Item.Name);

            if (barItemMenu == null)
            {
                return;
            }
            if (barItemMenu.Menurule == null)
            {
                return;
            }
            foreach (var item in assemblies)
            {
                Type formType = item.GetType(barItemMenu.Menurule);
                if (formType != null)
                {
                    if (typeof(Form).IsAssignableFrom(formType))
                    {
                        int    inx      = (barItemMenu.Menurule).LastIndexOf(".") + 1;
                        string formname = (barItemMenu.Menurule).Substring(inx);
                        Form   frm      = GetMdiForm(formname);
                        if (frm == null)
                        {
                            frm           = (Form)Activator.CreateInstance(formType);
                            frm.MdiParent = this;
                        }
                        frm.Activate();
                        ActiveRibbonPage(e.Link.Item.Name);
                        frm.Show();
                    }
                    else
                    {
                        XtraMessageBox.Show("指定的类型不能是从Form类型继承", "温馨提示");
                    }
                    return;
                }
            }
            XtraMessageBox.Show("指定的类型不存在", "温馨提示");
        }
Exemplo n.º 28
0
        /// <summary>
        /// Modal para realizar el alta de operaciones de forma masiva
        /// </summary>
        /// <returns></returns>
        public static DialogResult Show()
        {
            _OperacionesCargaBatch = new frmOperacionesCargaBatch();
            Form frmSet = Application.OpenForms["FPrincipal"];

            int x = Math.Max(frmSet.Location.X, frmSet.Location.X + (frmSet.Width - _OperacionesCargaBatch.Width) / 2);
            int y = frmSet.Location.Y + 1;

            _OperacionesCargaBatch.Location = new Point(x, y);



            _OperacionesCargaBatch.Activate();
            _OperacionesCargaBatch.ShowDialog();
            frmSet.Activate();



            //_OperacionesCargaBatch.ShowDialog();

            return(_DialogResult);
        }
Exemplo n.º 29
0
 private void btnXemPhieu_Click(object sender, EventArgs e)
 {
     try
     {
         Cursor.Current = Cursors.WaitCursor;
         Form form = GetOpenedForm("FormSuaPhieuNhap");
         if (form != null)
         {
             form.Activate();
         }
         else
         {
             form = new FormSuaPhieuNhap();
             form.Show();
         }
         Cursor.Current = Cursors.Default;
     }
     catch
     {
         MessageBox.Show("Lỗi kết nối");
     }
 }
Exemplo n.º 30
0
 private void barButtonItem_PN_CoNgay_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     try
     {
         if (kiemTraDangNhap() == true)
         {
             if (nv_bll.LayQuyenNhanVien(t) == "PQQuanLy" || nv_bll.LayQuyenNhanVien(t) == "PQThuNgan" ||
                 nv_bll.LayQuyenNhanVien(t) == "PQKho")
             {
                 Form frm = this.KiemtraTonTai(typeof(frm_BaoHanh));
                 if (frm != null)
                 {
                     frm.Activate();
                 }
                 else
                 {
                     frm_BaoCao_PN_TheoNgay f = new frm_BaoCao_PN_TheoNgay();
                     f.MdiParent = this;
                     f.Show();
                 }
             }
             else
             {
                 MessageBox.Show("Bạn Không Có Quyền Truy Cập Vào ", "Thông báo");
             }
         }
         else
         {
             MessageBox.Show("Bạn Cần Đăng Nhập ", "Thông báo");
             frm_DangNhap frmdn = new frm_DangNhap();
             this.Hide();
             frmdn.Show();
         }
     }
     catch
     {
         MessageBox.Show("Lỗi", "Thông báo");
     }
 }
Exemplo n.º 31
0
    public bool DownloadLWJGL()
    {
        Debug.WriteLine("[DownloadLWJGL] Creating DownloadLWJGLStatusForm form.");
        DownloadLWJGLStatusForm = new Form();
        Label DownloadStatusLabel = new Label();
        DownloadLWJGLStatusForm.SuspendLayout();
        DownloadStatusLabel.Text = "Downloading LWJGL...";
        DownloadStatusLabel.Name = "DownloadStatusLabel";
        DownloadStatusLabel.Location = new System.Drawing.Point(12, 0);
        DownloadStatusLabel.Height = 48;
        DownloadStatusLabel.Width = 192;
        DownloadStatusLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
        DownloadStatusLabel.BackColor = System.Drawing.SystemColors.Control;
        DownloadStatusLabel.ForeColor = System.Drawing.SystemColors.ControlText;
        DownloadStatusLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8);
        DownloadLWJGLStatusForm.Height = 72;
        DownloadLWJGLStatusForm.Width = 216;
        DownloadLWJGLStatusForm.Controls.Add(DownloadStatusLabel);
        DownloadLWJGLStatusForm.FormBorderStyle = FormBorderStyle.FixedToolWindow;
        DownloadLWJGLStatusForm.ResumeLayout(false);
        DownloadLWJGLStatusForm.Text = "launcher²";
        DownloadLWJGLStatusForm.Icon = global::launcher2.Properties.Resources.l2_ico;
        DownloadLWJGLStatusForm.FormClosing += new FormClosingEventHandler(DownloadLWJGLStatusForm_FormClosing);
        DownloadLWJGLStatusForm.Refresh();
        DownloadLWJGLStatusForm.Show();
        DownloadLWJGLStatusForm.Activate();

        DownloadLWJGLThread = new BackgroundWorker();
        DownloadLWJGLThread.WorkerReportsProgress = true;
        DownloadLWJGLThread.WorkerSupportsCancellation = true;
        DownloadLWJGLThread.DoWork += new DoWorkEventHandler(DownloadLWJGLThread_DoWork);
        DownloadLWJGLThread.ProgressChanged += new ProgressChangedEventHandler(DownloadLWJGLThread_ProgressChanged);
        DownloadLWJGLThread.RunWorkerCompleted += new RunWorkerCompletedEventHandler(DownloadLWJGLThread_RunWorkerCompleted);
        DownloadLWJGLThread.RunWorkerAsync();
        return true;
    }