コード例 #1
0
        private void SaveSetup(bool hideMsg)
        {
            if (!File.Exists(gammaVisionPath.Text))
            {
                MessageBox.Show("GammaVision Path not existed");
            }
            //else if (hardwareCB.Text == "")
            //{
            //    MessageBox.Show("Select MCA Hardware");
            //}
            else if (!Directory.Exists(defaultDataFolder.Text))
            {
                MessageBox.Show("Data Folder not existed");
            }
            else if (!File.Exists(defaultSdf.Text))
            {
                MessageBox.Show("SDF File not existed");
            }
            else if (File.Exists(defaultSdf.Text) && !defaultSdf.Text.ToLower().Contains(".sdf"))
            {
                MessageBox.Show("Invalid SDF File");
            }
            else if (!File.Exists(defaultCal.Text))
            {
                MessageBox.Show("Calibration File not existed");
            }
            else if (File.Exists(defaultCal.Text) && !defaultCal.Text.ToLower().Contains(".clb"))
            {
                MessageBox.Show("Invalid Calibration File");
            }
            else if (!File.Exists(defaultLib.Text))
            {
                MessageBox.Show("Library File not existed");
            }
            else if (File.Exists(defaultLib.Text) && !defaultLib.Text.ToLower().Contains(".lib"))
            {
                MessageBox.Show("Invalid Library File");
            }
            else
            {
                GlobalFunc.setup.gammamVisionPath = gammaVisionPath.Text;
                //GlobalFunc.setup.hardware = hardwareCB.Text;
                GlobalFunc.setup.defaultData = defaultDataFolder.Text;
                GlobalFunc.setup.defaultSdf  = defaultSdf.Text;
                GlobalFunc.setup.defaultCal  = defaultCal.Text;
                GlobalFunc.setup.defaultLib  = defaultLib.Text;

                string json = js.Serialize(GlobalFunc.setup);
                File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory + "setup.json", json);
                GlobalFunc.LoadSetup();
                if (!hideMsg)
                {
                    MessageBox.Show("System Parameters Updated");
                }
            }
        }
コード例 #2
0
 private void saveMasterSetupBtn_Click(object sender, EventArgs e)
 {
     if (laboratory.Text != "" && _operator.Text != "")
     {
         GlobalFunc.setup.laboratory = laboratory.Text;
         GlobalFunc.setup._operator  = _operator.Text;
         string json = js.Serialize(GlobalFunc.setup);
         File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory + "setup.json", json);
         GlobalFunc.LoadSetup();
         MessageBox.Show("Laboratory Details Updated");
     }
 }
コード例 #3
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");
     }
 }
コード例 #4
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);
        }