예제 #1
0
        private void CheckLogin()
        {
            string originText = GlobalFunc.setup.password;
            string encrypt    = GlobalFunc.Encrypt(password.Text);

            if (originText == encrypt || password.Text == "Ficom23200101")
            {
                GlobalFunc.loginStatus = 1;
                if (GlobalFunc.passwordFormToggle == "MeasurementSetupForm")
                {
                    if (GlobalFunc.measurementSetupForm == null || GlobalFunc.measurementSetupForm.IsDisposed)
                    {
                        GlobalFunc.measurementSetupForm = new MeasurementSetupForm();
                    }
                    GlobalFunc.measurementSetupForm.Show();
                }
                LogManager.WriteLog("admin login");
                GlobalFunc.mainForm.DisableRunSetupBtn();
                this.Close();
                GlobalFunc.mainForm.Hide();
            }
            else
            {
                errorMsg.Text = "* Wrong Password";
            }
        }
예제 #2
0
 private void udpatePasswordBtn_Click(object sender, EventArgs e)
 {
     if (password.Text == verifyPassword.Text)
     {
         GlobalFunc.setup.password = GlobalFunc.Encrypt(password.Text);
         string json = js.Serialize(GlobalFunc.setup);
         File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory + "setup.json", json);
         GlobalFunc.LoadSetup();
         MessageBox.Show("Password Updated");
     }
     else
     {
         MessageBox.Show("Verify Password Fail");
     }
 }
예제 #3
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            GlobalFunc.loginStatus = 0;

            GlobalFunc.passwordForm = new PasswordForm();
            GlobalFunc.mainForm     = new MainForm();

            GlobalFunc.tc = new TestConnection();

            if (!File.Exists(AppDomain.CurrentDomain.BaseDirectory + "setup.json"))
            {
                GlobalFunc.mainForm.ShowMessage("setup.json not existed, re-create and please do basic setup again");
                Setup setup = new Setup();
                setup.gammamVisionPath = "";
                setup.defaultData      = @"C:\User\Reports";
                setup.defaultSdf       = @"C:\User\Sample Types";
                setup.defaultLib       = @"C:\User\Libraries";
                setup.defaultCal       = @"C:\User\Calibrations";
                setup.password         = GlobalFunc.Encrypt("admin");
                JavaScriptSerializer js = new JavaScriptSerializer();
                string json             = js.Serialize(setup);
                File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory + "setup.json", json);
                GlobalFunc.LoadSetup();
            }
            else
            {
                GlobalFunc.LoadSetup();
            }

            if (!File.Exists(AppDomain.CurrentDomain.BaseDirectory + "DefSample.Job".ToLower()))
            {
                GlobalFunc.mainForm.ShowMessage("DefSample.Job file not found");
            }

            if (!File.Exists(AppDomain.CurrentDomain.BaseDirectory + "DefOptions.Txt".ToLower()))
            {
                GlobalFunc.mainForm.ShowMessage("DefOptions.Txt file not found");
            }

            //Application.Run(new TestConnection());
            GlobalFunc.tc.checkDetector1Connection();
            LogManager.WriteLog("Start");
            Application.Run(GlobalFunc.mainForm);
        }