Esempio n. 1
0
        public MainForm()
        {
            InitializeComponent();
            this.FormBorderStyle = FormBorderStyle.FixedSingle;
            this.StartPosition   = FormStartPosition.CenterScreen;
            //this.StartPosition = FormStartPosition.Manual;
            //this.Location = new Point(150, GlobalFunc.h / 2 - 330);
            this.ControlBox   = false;
            this.FormClosing += Form1_Closing;

            versionLabel.Text = Application.ProductVersion;

            myBGWorker.DoWork               += myBGWorker_DoWork;
            myBGWorker.ProgressChanged      += myBGWorker_ProgressChanged;
            myBGWorker.RunWorkerCompleted   += myBGWorker_RunWorkerCompleted;
            myBGWorker.WorkerReportsProgress = true;

            skipBGWorker.DoWork             += skipBGWorker_DoWork;
            skipBGWorker.RunWorkerCompleted += skipBGWorker_RunWorkerCompleted;

            GlobalFunc.mainFormHeight = GlobalFunc.h / 2 - 330;
            scsBtn.Enabled            = false;
            //quitBtn.Enabled = false;
            GlobalFunc.LoadProfile();
            GlobalFunc.LoadProfileDetail();
            SetProfile();
        }
Esempio n. 2
0
        private void SaveProfileMasterDetail()
        {
            ProfileDetail thisPD = new ProfileDetail();

            thisPD.operationName = profileCB.Text;
            thisPD.dataFolder    = dataFolderTxt.Text;
            if (string.IsNullOrEmpty(prefixTxt.Text))
            {
                prefixTxt.Text = profileCB.Text;
                thisPD.prefix  = profileCB.Text;
            }
            else
            {
                thisPD.prefix = prefixTxt.Text;
            }
            thisPD.sampleNo              = noOfSampleCB.Text != "" ? Convert.ToInt32(noOfSampleCB.Text) : 0;
            thisPD.sampleDefinitionFile  = sampleDefinitionFileTxt.Text;
            thisPD.commonSDF             = sdfCommonCB.Checked;
            thisPD.calibrationFile       = calibrationFileTxt.Text;
            thisPD.commonCalibrationFile = calibrarionCommonCB.Checked;
            thisPD.qtyUnit            = sampleQtyUnitCB.Text;
            thisPD.commonQtyUnit      = sampleQtyUnitCommonCB.Checked;
            thisPD.qty                = sampleQtyTxt.Text != "" ? Convert.ToDouble(sampleQtyTxt.Text) : 0.000;
            thisPD.commonQty          = sampleQtyCommonCB.Checked;
            thisPD.countingTime       = countingTime.Text != "" ? Convert.ToInt32(countingTime.Text) : 0;
            thisPD.commonCountingTime = countingTimeCommonCB.Checked;
            thisPD.activityUnit       = activityUnitCB.Text;
            thisPD.commonActivityUnit = activityUnitCommonCB.Checked;
            thisPD.libraryFile        = libraryFileTxt.Text;
            thisPD.commonLibrary      = libraryCommonCB.Checked;

            thisPD.disableDecayCorrection = decayCorrectionCB.Checked;
            thisPD.commonDecayCorrection  = decayCorrectionCommonCB.Checked;

            //if (decayCorrectionCommonCB.Checked && !decayCorrectionCB.Checked)
            //{
            //    thisPD.commonDecayCorrection = false;
            //    decayCorrectionCommonCB.Checked = false;
            //}

            //
            //thisPD.decayCorrectionDate = decayCorrectionDTPicker.Value.ToString();
            //thisPD.commonDecayDate = decayDateCommonCB.Checked;
            thisPD.sampleDetailList        = SaveProfileSamplesDetail(); //each sample
            GlobalFunc.toggleProfileDetail = thisPD;
            string json = js.Serialize(thisPD);

            File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory + @"ProfileDetail\" + thisPD.operationName + ".json", json);
            MessageBox.Show("Save " + profileCB.Text + " successful");
            GlobalFunc.LoadProfileDetail(); //load each profile json
        }