Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "mpob1234")
            {
                if (RedirectToForm == null)
                {
                    try
                    {
                        WFUtils.SyncToServer();
                        MessageBox.Show("Sinkronisasi data dengan Server selesai.");

                        string directory = AppDomain.CurrentDomain.BaseDirectory + string.Format(@"\Logs\AppLogs\{0}\", DateTime.Now.ToString("MM.yyyy"));
                        System.Diagnostics.Process.Start(directory);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.GetFullMessage());
                    }
                }

                else
                {
                    DisplayForm(SourceMdiParent, RedirectToForm);
                    this.Close();
                }

                //else if (RedirectToForm == typeof(VariableSettingForm))
                //{
                //    foreach (Form f in SourceMdiParent.MdiChildren)
                //    {
                //        if (f.GetType() == typeof(VariableSettingForm))
                //        {
                //            f.Close();
                //            //f.Activate();
                //            //return;
                //        }
                //    }
                //    Form form = new VariableSettingForm();
                //    form.MdiParent = SourceMdiParent;
                //    form.Show();
                //}

                //MessageBox.Show("OK");
            }
            else
            {
                MessageBox.Show("Harap masukkan code dengan benar.");
            }
        }