Пример #1
0
        public FormParent OpenForm(string txn_id, string txn_name)
        {
            //Austin 20190813 平行測試期間正式環境不開放維護功能
            if (GlobalDaoSetting.GetConnectionInfo.ConnectionName == "CI")
            {
                if (maintainItem.Contains(txn_id))
                {
                    MessageDisplay.Normal("維護功能暫不使用!");
                    accordionMenu.Focus();
                    accordionMenu.KeyNavHelperEx.SelectedElement = accordionMenu.SelectedElement;
                    return(null);
                }
            }
            if (txn_id == "Z2010")
            {
                OpenForm();
                return(new FormParent());
            }
            var    dllIndividual = Assembly.LoadFile(Application.ExecutablePath);
            string typeFormat    = "{0}.FormUI.Prefix{1}.W{2}";
            Type   myType        = dllIndividual.GetType(string.Format(typeFormat, Path.GetFileNameWithoutExtension(Application.ExecutablePath), txn_id.Substring(0, 1), txn_id));

            if (myType == null)
            {
                MessageDisplay.Error("無此程式");
                accordionMenu.Focus();
                accordionMenu.KeyNavHelperEx.SelectedElement = accordionMenu.SelectedElement;
                return(null);
            }

            object myObj = Activator.CreateInstance(myType, txn_id, txn_name);

            FormParent formInstance = (FormParent)myObj;

            //int width = SystemInformation.PrimaryMonitorSize.Width;
            //if (width <= 1600) {
            //    formInstance.WindowState = FormWindowState.Maximized;
            //}

            if (formInstance.BeforeOpen() == ResultStatus.Success)
            {
                formInstance.MdiParent          = this;
                formInstance.RibbonAlwaysAtBack = false;
                formInstance.FormClosed        += new FormClosedEventHandler(Child_FormClosed);
                formInstance.Icon          = (Icon)Icon.Clone();
                formInstance.StartPosition = FormStartPosition.Manual;
                //formInstance.WindowState = FormWindowState.Maximized;
                formInstance.Dock          = DockStyle.Fill;
                formInstance.AutoScaleMode = AutoScaleMode.None;
                formInstance.Show();
            }

            return(formInstance);
        }
Пример #2
0
        public FormParent OpenForm(string txn_id, string txn_name)
        {
            if (txn_id == "Z2010")
            {
                OpenForm();
                return(new FormParent());
            }
            var    dllIndividual = Assembly.LoadFile(Application.ExecutablePath);
            string typeFormat    = "{0}.FormUI.Prefix{1}.W{2}";
            Type   myType        = dllIndividual.GetType(string.Format(typeFormat, Path.GetFileNameWithoutExtension(Application.ExecutablePath), txn_id.Substring(0, 1), txn_id));

            if (myType == null)
            {
                MessageDisplay.Error("無此程式");
                accordionMenu.Focus();
                accordionMenu.KeyNavHelperEx.SelectedElement = accordionMenu.SelectedElement;
                return(null);
            }

            object myObj = Activator.CreateInstance(myType, txn_id, txn_name);

            FormParent formInstance = (FormParent)myObj;

            //int width = SystemInformation.PrimaryMonitorSize.Width;
            //if (width <= 1600) {
            //    formInstance.WindowState = FormWindowState.Maximized;
            //}

            if (formInstance.BeforeOpen() == ResultStatus.Success)
            {
                formInstance.MdiParent     = this;
                formInstance.FormClosed   += new FormClosedEventHandler(Child_FormClosed);
                formInstance.Icon          = (Icon)Icon.Clone();
                formInstance.BackColor     = Color.FromArgb(192, 220, 192);
                formInstance.StartPosition = FormStartPosition.Manual;
                formInstance.WindowState   = FormWindowState.Maximized;

                formInstance.Show();
            }

            return(formInstance);
        }