Example #1
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            DirectoryInfo di = new DirectoryInfo(Application.StartupPath + @"\日志");
            if (!di.Exists)
            {
                di.Create();
            }
            LogHelper.Initial(Application.StartupPath + @"\日志\" + DateTime.Now.ToString(@"yyyyMMdd-HH-mm-ss") + @".txt");
            LogHelper.AddLogEvent += new LogHelper.AddLogHandler(AddLogToTextBox);
            LogHelper.UpdateProgressEvent += new LogHelper.UpdateProgressHandler(UpdateProgressDisplay);
            LogHelper.UpdateFileNameDisplayEvent += new LogHelper.UpdateFileNameDisplayHandler(ToolStripStatusLabel_SetText);

            SuperDog.SuperDogSeries myDog = new SuperDog.SuperDogSeries();
            myDog.RunDogTesting();
            if (myDog.DogFlag)
            {
                Signitue_Write(myDog.Signiture);
                person = myDog.Person;
            }
            else if (checkSuperDog)
            {
                MessageBox.Show("Error:     " + myDog.Status.ToString() + "\nSuperDog disabled!");
                this.Close();
                return;
            }
            else
            {
                Signitue_Write(SuperDog.SuperDogAlpha.getInstance().Signiture);
                person = SuperDog.SuperDogAlpha.getInstance().Person;
            }

            ProgramConfiguration.Initial(Application.StartupPath);

            isWorking = false;
            isStopping = false;
            mi = DoWork;
            dod = new doOneDelegate(StandardizeOne);

            textBox6.Text = Application.StartupPath + @"\输出文件夹";
            
            comboBox1.SelectedIndex = 0;
            
            comboBox3.SelectedIndex = 0;

            timer1.Start();
        }
Example #2
0
        private void updateSelectionAndLabel()
        {
            string dpath = Util.PathExt.PathCombineClassified(System.Windows.Forms.Application.StartupPath + @"\试验记录模板\", comboBox1.SelectedIndex);
            string cpath = Util.PathExt.PathCombineClassified(System.Windows.Forms.Application.StartupPath + @"\试验证书模板\", comboBox1.SelectedIndex);
            string keyword = "";
            string dataType = "";
            //数据类型
            switch (comboBox1.SelectedIndex)
            {
                case 0://剂量
                    dataType = "Dose";
                    break;
                case 1://CT
                    dataType = "CT";
                    break;
                case 2://KV
                    dataType = "KV";
                    switch (comboBox3.Text)
                    {
                        case "4000M+":
                        case "TNT12000":
                        case "TNT12000D":
                            keyword = comboBox3.Text;
                            dpath = Path.Combine(dpath, @"FLUKE");
                            break;
                    }
                    break;
                default:
                    MessageBox.Show(@"没有选择类型:剂量/CT/KV");
                    break;
            }
            //设置记录模板
            DirectoryInfo mydir = new DirectoryInfo(dpath);
            FileInfo[] fis = mydir.GetFiles();
            comboBox4.Items.Clear();
            if (fis.Length == 0)
            {
                MessageBox.Show("记录模板文件夹为空,请检查!");
            }
            else
            {
                foreach (FileInfo fi in fis)
                {
                    if (fi.Name.Contains(keyword) && !fi.Name.Contains(@"~$"))
                    {
                        comboBox4.Items.Add(fi.Name);
                    }
                }
                if (comboBox4.Items.Count > 0)
                {
                    comboBox4.SelectedIndex = 0;
                }
                else
                {
                    MessageBox.Show("记录模板文件夹为空,请检查!");
                }
            }
            //设置证书模板
            mydir = new DirectoryInfo(cpath);
            fis = mydir.GetFiles();
            comboBox5.Items.Clear();
            if (fis.Length == 0)
            {
                MessageBox.Show("证书模板文件夹为空,请检查!");
            }
            else
            {
                foreach (FileInfo fi in fis)
                {
                    if (fi.Name.Contains(keyword) && !fi.Name.Contains(@"~$"))
                    {
                        comboBox5.Items.Add(fi.Name);
                    }
                }
                if (comboBox5.Items.Count > 0)
                {
                    comboBox5.SelectedIndex = 0;
                }
                else
                {
                    MessageBox.Show("证书模板文件夹为空,请检查!");
                }
            }
            //更新颜色显示
            if (comboBox2.SelectedIndex == 0)
            {
                //生成记录
                label7.ForeColor = Color.Red;
                if (comboBox1.SelectedIndex == 2)
                {
                    label15.ForeColor = Color.Black;
                }
                else
                {
                    label15.ForeColor = Color.Red;
                }
                label9.ForeColor = Color.Red;
                label10.ForeColor = Color.Black;
                checkBox1.ForeColor = Color.Black;
                dod = new doOneDelegate(GeneratingForm);
            }
            else if (comboBox2.SelectedIndex == 1)
            {
                //生成证书
                label7.ForeColor = Color.Black;
                label15.ForeColor = Color.Black;
                label9.ForeColor = Color.Black;
                label10.ForeColor = Color.Red;
                checkBox1.ForeColor = Color.Red;
                dod = new doOneDelegate(GeneratingCertificateOne);
            }
            else if (comboBox2.SelectedIndex == 2)
            {
                //标准化
                label7.ForeColor = Color.Black;
                label15.ForeColor = Color.Black;
                label9.ForeColor = Color.Red;
                label10.ForeColor = Color.Black;
                checkBox1.ForeColor = Color.Black;
                dod = new doOneDelegate(StandardizeOne);
            }
            else if (comboBox2.SelectedIndex == 3)
            {
                //存档合并
                label7.ForeColor = Color.Black;
                label15.ForeColor = Color.Black;
                label9.ForeColor = Color.Black;
                label10.ForeColor = Color.Black;
                checkBox1.ForeColor = Color.Black;
                dod = new doOneDelegate(ArchievingMergeOne);
            }
            else if (comboBox2.SelectedIndex == 4)
            {
                //校验
                label7.ForeColor = Color.Black;
                label15.ForeColor = Color.Black;
                label9.ForeColor = Color.Black;
                label10.ForeColor = Color.Black;
                checkBox1.ForeColor = Color.Black;
                dod = new doOneDelegate(VerificateOne);
            }

            //检查所涉及的标准仪器是否超期
            if (comboBox1.SelectedIndex > -1)
            {
                List<ListViewItem> lvItem = new List<ListViewItem>();
                ListViewItem lvi = null;
                Color textColor = Color.Black;
                int abnormalItemCount = 0;
                if (standardUsage.Count < 1)
                {
                    label19.Text = "未找到标准仪器信息!";
                    label19.ForeColor = Color.DarkOrange;
                }
                else
                {
                    foreach (string item in standardUsage[dataType])
                    {
                        if (standard[item].State == "正常")
                        {
                            textColor = Color.Green;
                        }
                        else if (standard[item].State == "即将过期")
                        {
                            textColor = Color.DarkOrange;
                            abnormalItemCount++;
                        }
                        else
                        {
                            textColor = Color.Red;
                            abnormalItemCount++;
                        }
                        lvi = new ListViewItem(new string[] { standard[item].Name, standard[item].Date, standard[item].State }, -1, textColor, System.Drawing.Color.Empty, null);
                        lvItem.Add(lvi);
                    }
                    listView1.Items.Clear();
                    foreach (ListViewItem item in lvItem)
                    {
                        listView1.Items.Add(item);
                    }
                    if (abnormalItemCount > 0)
                    {
                        label19.Text = "有标准仪器已超期或即将超期!";
                        label19.ForeColor = Color.DarkOrange;
                    }
                    else
                    {
                        label19.Text = "标准仪器状态正常!";
                        label19.ForeColor = Color.Green;
                    }
                }
            }
        }