Пример #1
0
 private void worder_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     try
     {
         if (this.dgvCarTextList.DataSource == null)
         {
             this.source.DataSource = this.dtText;
             this.dgvCarTextList.DataSource = this.source;
         }
         if ((this.dtText != null) && (this.dtText.Rows.Count > 0))
         {
             this.refleshData();
             this.cboxAccOn.Checked = !this.cboxAccOn.Checked;
             this.cboxAccOn.Checked = !this.cboxAccOn.Checked;
             this.lblDGVRowCount.Text = string.Format("总共 {0} 条记录", this.source.List.Count.ToString());
         }
         else
         {
             this.lblDGVRowCount.Text = "";
         }
         worker.DoWork -= new DoWorkEventHandler(this.worder_DoWork);
         worker.RunWorkerCompleted -= new RunWorkerCompletedEventHandler(this.worder_RunWorkerCompleted);
         worker = null;
         this.dgvCarTextList.ClearSelection();
         this.dgvCarTextList.CurrentCell = this.dgvCarTextList.Rows[0].Cells[this.dgvCarTextList.FirstDisplayedCell.ColumnIndex];
         this.dgvCarTextList.FirstDisplayedScrollingRowIndex = 0;
         this.dgvCarTextList.EndEdit();
         this.dgvCarTextList.Refresh();
     }
     catch (Exception exception)
     {
         Record.execFileRecord("文本位置->异步处理完成事件", exception.Message);
     }
     finally
     {
         WaitForm.Hide();
     }
 }
Пример #2
0
 private void CarTextList_Load(object sender, EventArgs e)
 {
     try
     {
         this.dgvCarTextList.AutoGenerateColumns = false;
         this.initClomun();
         this.initDataTable();
         this.doWorker();
         MainForm.myMap.execStopPlayTrackLine(this.sQueryTypeValue);
         this.tGetQueryTrackInfo = new System.Timers.Timer(2000.0);
         this.tGetQueryTrackInfo.Elapsed += new ElapsedEventHandler(this.tGetQueryTrackInfo_Elapsed);
         this.tGetQueryTrackInfo.Enabled = true;
         this.myGetTrackQueryInfo = new dGetTrackQueryInfo(this.getAddress);
     }
     catch (Exception exception)
     {
         Record.execFileRecord("文本界面->初期化", exception.ToString());
     }
     finally
     {
         WaitForm.Hide();
     }
 }
Пример #3
0
 private void dgvCarTextList_DataError(object sender, DataGridViewDataErrorEventArgs e)
 {
     Record.execFileRecord("文本界面->DataGridView_DataError", e.Exception.Message);
 }
Пример #4
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            string text     = this.cmbGroup.Text;
            string pathName = this.txtName.Text.Trim();

            if (text.Length <= 0)
            {
                MessageBox.Show("请选择组别");
                this.cmbGroup.Focus();
            }
            else if (text == "(无)")
            {
                MessageBox.Show("没有组别");
                this.cmbGroup.Focus();
            }
            else if (pathName.Length <= 0)
            {
                MessageBox.Show("请输入名称");
                this.txtName.Focus();
            }
            else if (this.preType == itmPreSetPath.PreType.预设报警路线)
            {
                int    pathType        = int.Parse(this.cmbPathType.SelectedValue.ToString());
                string factoryName     = this.txtBeginName.Text.Trim();
                string buildingSitName = this.txtEndName.Text.Trim();
                int    num2            = int.Parse(this.numRadius.Value.ToString());
                double num3            = 0.0;
                double num4            = 0.0;
                double num5            = 0.0;
                double num6            = 0.0;
                string pathStr         = "";
                if (pathName.IndexOf('^') >= 0)
                {
                    MessageBox.Show("路线名称中不允许包含字符('^')!");
                    this.txtName.Focus();
                }
                else
                {
                    if (pathType == 1)
                    {
                        if (factoryName.Length <= 0)
                        {
                            MessageBox.Show("请输入起点名称");
                            this.txtBeginName.Focus();
                            return;
                        }
                        if (buildingSitName.Length <= 0)
                        {
                            MessageBox.Show("请输入终点名称");
                            this.txtEndName.Focus();
                            return;
                        }
                    }
                    string[] strArray  = this.PathDot.Split(new char[] { ';' });
                    string[] strArray2 = strArray[0].Split(new char[] { ',' });
                    num3      = double.Parse(strArray2[0]);
                    num4      = double.Parse(strArray2[1]);
                    strArray2 = strArray[strArray.Length - 1].Split(new char[] { ',' });
                    num5      = double.Parse(strArray2[0]);
                    num6      = double.Parse(strArray2[1]);
                    foreach (string str6 in strArray)
                    {
                        string[] strArray3 = str6.Split(new char[] { ',' });
                        pathStr = (pathStr + this.getDotStr(strArray3[0]) + "*") + this.getDotStr(strArray3[1]) + "/";
                    }
                    if (!this._isUpdate)
                    {
                        switch (this.PreSetPath(pathStr, pathName, pathType, num2, factoryName, num3, num4, buildingSitName, num5, num6))
                        {
                        case 0:
                            this.PathDot    = pathStr;
                            this.PathName   = pathName;
                            this._group     = this.cmbGroup.SelectedValue.ToString();
                            this._pathType  = this.cmbPathType.SelectedValue.ToString();
                            this._beginName = this.txtBeginName.Text;
                            this._endName   = this.txtEndName.Text;
                            this._mark      = this.txtMark.Text;
                            if (!base.Modal)
                            {
                                if (this.dtPath != null)
                                {
                                    DataRow row = this.dtPath.NewRow();
                                    row["PathId"]       = this.PathId;
                                    row["PathName"]     = this.PathName;
                                    row["AlarmPathDot"] = this.PathDot;
                                    this.dtPath.Rows.Add(row);
                                }
                                base.Close();
                            }
                            base.DialogResult = DialogResult.OK;
                            return;

                        case 1:
                            base.DialogResult = DialogResult.Cancel;
                            base.Close();
                            return;
                        }
                    }
                    else
                    {
                        try
                        {
                            TrafficPath pathinfo = new TrafficPath {
                                pathStr         = pathStr,
                                pathName        = pathName,
                                PathId          = Convert.ToInt32(this.PathId),
                                pathType        = pathType,
                                region_Radius   = num2,
                                factoryName     = factoryName,
                                lon_Factory     = num3,
                                lat_Factory     = num4,
                                buildingSitName = buildingSitName,
                                lon_BuildingSit = num5,
                                lat_BuildingSit = num6,
                                isNewPath       = this.PathLonLatChange,
                                pathgroupID     = Convert.ToInt32(this.cmbGroup.SelectedValue),
                                PathSegments    = this.getSegment(),
                                remark          = this.txtMark.Text
                            };
                            switch (this.UpdatePathEx(pathinfo))
                            {
                            case 1:
                                this.PathDot      = pathStr;
                                this.PathName     = pathName;
                                this._group       = this.cmbGroup.SelectedValue.ToString();
                                this._pathType    = this.cmbPathType.SelectedValue.ToString();
                                this._beginName   = this.txtBeginName.Text;
                                this._endName     = this.txtEndName.Text;
                                this._mark        = this.txtMark.Text;
                                base.DialogResult = DialogResult.OK;
                                return;

                            case 0:
                                base.DialogResult = DialogResult.Cancel;
                                base.Close();
                                return;
                            }
                        }
                        catch (Exception exception)
                        {
                            Record.execFileRecord("预设路线-->路线添加页面", exception.Message);
                        }
                    }
                }
            }
            else
            {
                string regionStr      = "";
                int    iRegionFeature = 0;
                if (pathName.IndexOf('^') >= 0)
                {
                    MessageBox.Show("区域命名中不能包含字符('^')!");
                    this.txtName.Focus();
                }
                else
                {
                    if (this.PathDot.Split(new char[] { ';' }).Length == 1)
                    {
                        this.iRadius = int.Parse(this.numDistance.Value.ToString());
                        string[] strArray4 = this.PathDot.Split(new char[] { ',' });
                        regionStr = this.getDotStr(strArray4[0]) + @"\" + this.getDotStr(strArray4[1]) + @"\" + this.iRadius.ToString() + "*";
                    }
                    else
                    {
                        foreach (string str8 in this.PathDot.Split(new char[] { ';' }))
                        {
                            string[] strArray6 = str8.Split(new char[] { ',' });
                            regionStr = (regionStr + this.getDotStr(strArray6[0]) + @"\") + this.getDotStr(strArray6[1]) + "*";
                        }
                    }
                    if (this.preType == itmPreSetPath.PreType.预设多功能报警区域)
                    {
                        iRegionFeature = 1;
                    }
                    switch (this.PreSetRegion(regionStr, pathName, iRegionFeature))
                    {
                    case 1:
                        this.PathDot      = regionStr;
                        this.PathName     = pathName;
                        this._group       = this.cmbGroup.SelectedValue.ToString();
                        base.DialogResult = DialogResult.OK;
                        return;

                    case 0:
                        base.DialogResult = DialogResult.Cancel;
                        break;
                    }
                }
            }
        }