Exemplo n.º 1
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();
            }
        }
Exemplo n.º 2
0
        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();
        }
Exemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void LogOut_btn_Click(object sender, EventArgs e)
        {
            messageData = new MessageData("llci00002", Properties.Resources.llci00002.ToString());
            Logger.Info(messageData);
            DialogResult dialogResult = popUpMessage.ConfirmationOkCancel(messageData, Text);

            if (dialogResult != DialogResult.OK)
            {
                return;
            }

            FormCollection forms = Application.OpenForms;

            for (int formCount = forms.Count - 1; formCount >= 0; formCount--)
            {
                if (forms[formCount].GetType().BaseType != typeof(FormCommonBase))
                {
                    FormCommon frmopen = (FormCommon)forms[formCount];
                    frmopen.Close();

                    if (frmopen.CanFocus)
                    {
                        break;
                    }
                    //if (forms[formCount] != null && forms[formCount].ContainsFocus)
                    //{
                    //    break;
                    //}
                }
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// showdialog with local settings
 /// </summary>
 /// <param name="fp"></param>
 /// <param name="arguments"></param>
 public void ShowDialog(FormCommon fp, object arguments = null)
 {
     if (fp != null)
     {
         this.InvokeAuthorityControl(fp.Controls);
     }
     this.ShowDialog();
 }