예제 #1
0
        private void set_params(TestVar tv)
        {
            try
            {
                this.tbServer.Text            = tv.Server;
                this.cbbRoutingChartName.Text = tv.RoutingChartName;
                this.cbbLinkName.Text         = tv.LinkName;
                this.cbbStationName.Text      = tv.StationName;

                this.tbAddrPLC.Text      = tv.AddrPLC;
                this.tbAddrCCD1.Text     = tv.AddrCCD1;
                this.tbAddrCCD2.Text     = tv.AddrCCD2;
                this.tbAddrCCD3.Text     = tv.AddrCCD3;
                this.tbAddrCCD4.Text     = tv.AddrCCD4;
                this.cbbAddrScanner.Text = tv.AddrScanner;
                this.cbbAddrPrinter.Text = tv.AddrPrinter;
                this.cbbAddrRobot.Text   = tv.AddrRobot;

                this.tbSOP.Text      = tv.FileSOP;
                this.tbMainTain.Text = tv.FileMainTain;

                this.numAlarmPersent.Value = (decimal)tv.AlarmPersent;
            }
            catch (Exception ex) { throw ex; }
        }
예제 #2
0
        private bool get_params(ref TestVar tv, ref string err)
        {
            err = "";
            try
            {
                tv = new TestVar();

                tv.Server           = this.tbServer.Text.Trim();
                tv.RoutingChartName = this.cbbRoutingChartName.Text;
                tv.LinkName         = this.cbbLinkName.Text;
                tv.StationName      = this.cbbStationName.Text;

                tv.AddrPLC     = this.tbAddrPLC.Text;
                tv.AddrCCD1    = this.tbAddrCCD1.Text;
                tv.AddrCCD2    = this.tbAddrCCD2.Text;
                tv.AddrCCD3    = this.tbAddrCCD3.Text;
                tv.AddrCCD4    = this.tbAddrCCD4.Text;
                tv.AddrScanner = this.cbbAddrScanner.Text;
                tv.AddrPrinter = this.cbbAddrPrinter.Text;
                tv.AddrRobot   = this.cbbAddrRobot.Text;

                tv.FileSOP      = this.tbSOP.Text;
                tv.FileMainTain = this.tbMainTain.Text;

                tv.AlarmPersent = (int)this.numAlarmPersent.Value;

                return(true);
            }
            catch (Exception ex)
            {
                err = ex.Message;
                return(false);
            }
        }
예제 #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                string  err = "";
                TestVar tv  = null;
                if (!get_params(ref tv, ref err))
                {
                    MessageBox.Show("获取设置失败. " + err, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                if (!RunStatus.DBManager.SaveClass("TestVar", tv, out err))
                {
                    MessageBox.Show("保存设置失败. " + err, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                MessageBox.Show("保存设置成功.", "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #4
0
        private void UILoad(object sender, EventArgs e)
        {
            try
            {
                string err = "";
                if (!RunStatus.DBManager.LoadClass("TestVar", ref Tar, ref err))
                {
                    MessageBox.Show("加载设置错误." + err, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Tar = new TestVar();
                }

                set_params(Tar);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }