コード例 #1
0
ファイル: FactorySelectionForm.cs プロジェクト: D-Khoa/MyGit
        private void Ok_btn_Click(object sender, EventArgs e)
        {
            if (Factory_cmb.SelectedIndex < 0)
            {
                MessageData messageData = new MessageData("ffce00038", Properties.Resources.ffce00038.ToString());
                logger.Info(messageData);
                popUpMessage.ApplicationError(messageData, this.Text);

                Factory_cmb.Focus();
                return;
            }

            UserData userData = UserData.GetUserData();

            userData.FactoryCode = Factory_cmb.SelectedItem.ToString();

            Assembly assembly = Assembly.LoadFile(AppDomain.CurrentDomain.BaseDirectory + applicationAssemblyName); // dll name
            Type     type     = assembly.GetType(applicationTypeName);                                              //form name with namespace

            FormCommon menuform = Activator.CreateInstance(type) as FormCommon;

            this.Hide();
            menuform.ShowDialog(menuform);
            this.Show();
        }
コード例 #2
0
        private void Ok_btn_Click(object sender, EventArgs e)
        {
            if (Factory_cmb.SelectedIndex > -1 && Factory_cmb.SelectedItem != null)
            {
                UserData userData = UserData.GetUserData();
                userData.FactoryCode = Factory_cmb.SelectedItem.ToString();


                Assembly   assembly = Assembly.LoadFile(AppDomain.CurrentDomain.BaseDirectory + applicationAssemblyName); // dll name
                Type       type     = assembly.GetType(applicationTypeName);                                              //form name with namespace
                FormCommon menuform = Activator.CreateInstance(type) as FormCommon;


                //MainForm mainForm = new MainForm();

                this.Hide();

                menuform.ShowDialog(menuform);
                //mainForm.ShowDialog(mainForm);

                this.Show();
            }
            else
            {
                DialogResult dialogResult = MessageBox.Show("Please select factory", "factory selection", MessageBoxButtons.OK);

                Factory_cmb.Focus();
            }
        }