Exemple #1
0
 public void AddAreaNodeHashTable(ThreeStateTreeNode myNode)
 {
     if (myNode != null)
     {
         if (myNode.Parent == null)
         {
             if (!this.areaNodeHashTable.ContainsKey(myNode.Name))
             {
                 this.areaNodeHashTable.Add(myNode.Name, myNode);
             }
         }
         else if (myNode.Parent.IsExpanded)
         {
             if (!this.areaNodeHashTable.ContainsKey(myNode.Name))
             {
                 this.areaNodeHashTable.Add(myNode.Name, myNode);
                 do
                 {
                     myNode = (ThreeStateTreeNode)myNode.Parent;
                     this.AddAreaNodeHashTable(myNode);
                 }while (myNode.Parent != null);
             }
         }
         else
         {
             do
             {
                 myNode = (ThreeStateTreeNode)myNode.Parent;
                 this.AddAreaNodeHashTable(myNode);
             }while (myNode.Parent != null);
         }
     }
 }
Exemple #2
0
 public void DelAreaNodeHashTable(ThreeStateTreeNode myNode)
 {
     if (this.areaNodeHashTable.ContainsKey(myNode.Name))
     {
         this.areaNodeHashTable.Remove(myNode.Name);
     }
 }
 public void AddAreaNodeHashTable(ThreeStateTreeNode myNode)
 {
     if (myNode != null)
     {
         if (myNode.Parent == null)
         {
             if (!this.areaNodeHashTable.ContainsKey(myNode.Name))
             {
                 this.areaNodeHashTable.Add(myNode.Name, myNode);
             }
         }
         else if (myNode.Parent.IsExpanded)
         {
             if (!this.areaNodeHashTable.ContainsKey(myNode.Name))
             {
                 this.areaNodeHashTable.Add(myNode.Name, myNode);
                 do
                 {
                     myNode = (ThreeStateTreeNode) myNode.Parent;
                     this.AddAreaNodeHashTable(myNode);
                 }
                 while (myNode.Parent != null);
             }
         }
         else
         {
             do
             {
                 myNode = (ThreeStateTreeNode) myNode.Parent;
                 this.AddAreaNodeHashTable(myNode);
             }
             while (myNode.Parent != null);
         }
     }
 }
 private void setCarOnline(string sStatus)
 {
     if (sStatus != this.sCarStatus)
     {
         if ((sStatus != sOffLine) && (this.sCarStatus != sOffLine))
         {
             this.sCarStatus = sStatus;
             this.setCarImg();
         }
         else
         {
             this.sCarStatus = sStatus;
             this.setCarImg();
             int num = 0;
             if (this.sCarStatus == sOffLine)
             {
                 this.iOnlineCnt = 0;
                 num             = -1;
             }
             else
             {
                 this.iOnlineCnt = 1;
                 num             = 1;
             }
             ThreeStateTreeNode parent = this;
             while (parent.Level >= 1)
             {
                 parent             = parent.Parent as ThreeStateTreeNode;
                 parent.iOnlineCnt += num;
             }
             (base.TreeView as ThreeStateTreeView).AddAreaNodeHashTable((ThreeStateTreeNode)base.Parent);
         }
     }
 }
Exemple #5
0
 public void RecursiveSetNodeTriState(ThreeStateTreeNode node)
 {
     this.SimapleSetNodeTriState(node);
     if (node.Parent != null)
     {
         this.RecursiveSetNodeTriState((ThreeStateTreeNode)node.Parent);
     }
 }
Exemple #6
0
 public void Set(ThreeStateTreeNode myNode, DataRow dr)
 {
     string str;
     try
     {
         string str1 = string.Concat("Attach_", myNode.CarId);
         string str2 = string.Concat("Attach_", dr["OrderID"].ToString(), "_", dr["CarID"].ToString());
         if (dr.Table.ExtendedProperties.ContainsKey(str1))
         {
             str = dr.Table.ExtendedProperties[str1].ToString();
         }
         else
         {
             str = (dr.Table.ExtendedProperties.ContainsKey(str2) ? dr.Table.ExtendedProperties[str2].ToString() : "");
         }
         string str3 = str;
         if (str3.Length > 0)
         {
             AttachData attachDatum = new AttachData(str3);
             string str4 = attachDatum.ParseAttachData("1", "");
             if (str4.Trim().Length <= 0)
             {
                 str4 = attachDatum.ParseAttachData("01", "");
                 if (str4.Trim().Length > 0)
                 {
                     myNode.DynamicAttr["oil"] = string.Concat(str4, "L");
                 }
             }
             else
             {
                 myNode.DynamicAttr["oil"] = string.Concat(str4, "L");
             }
             str4 = attachDatum.ParseAttachData("D1", "1");
             if (str4.Trim().Length <= 0 || !str4.Equals("1"))
             {
                 str4 = attachDatum.ParseAttachData("D1", "0");
                 if (str4.Trim().Length <= 0 || !str4.Equals("1"))
                 {
                     myNode.DynamicAttr["罐子状态"] = "停转";
                 }
                 else
                 {
                     myNode.DynamicAttr["罐子状态"] = "卸料";
                 }
             }
             else
             {
                 myNode.DynamicAttr["罐子状态"] = "搅拌";
             }
         }
     }
     catch (Exception exception)
     {
         Record.execFileRecord(string.Concat("附加报文解析异常:", exception.ToString()));
     }
 }
Exemple #7
0
 public void SetNodeTriState(ThreeStateTreeNode currNode)
 {
     currNode.CheckState = ((ThreeStateTreeNode)currNode.Parent).CheckState;
     if (currNode.Nodes.Count > 0)
     {
         foreach (ThreeStateTreeNode node in currNode.Nodes)
         {
             node.CheckState = currNode.CheckState;
             this.SetNodeTriState(node);
         }
     }
 }
Exemple #8
0
        public ThreeStateTreeNode getNextNode(ThreeStateTreeNode tnNode)
        {
            if (base.Nodes.Count == 0)
            {
                return(null);
            }
            ThreeStateTreeNode nextVisibleNode = tnNode.NextVisibleNode as ThreeStateTreeNode;

            if (nextVisibleNode == null)
            {
                nextVisibleNode = base.Nodes[0] as ThreeStateTreeNode;
            }
            return(nextVisibleNode);
        }
Exemple #9
0
        public ThreeStateTreeNode getCar(ThreeStateTreeNode tnNode, string sSearchType, string sSearchValue)
        {
            ThreeStateTreeNode node;

            if (tnNode == null)
            {
                node = base.Nodes[0] as ThreeStateTreeNode;
            }
            else
            {
                node = this.getNextNode(tnNode);
            }
            ThreeStateTreeNode node2 = node;

            do
            {
                string carId = "";
                string str2  = sSearchType;
                if (str2 != null)
                {
                    if (!(str2 == "CarNum"))
                    {
                        if (str2 == "CarId")
                        {
                            carId = node.CarId;
                        }
                        else if (str2 == "SimNum")
                        {
                            carId = node.SimNum;
                        }
                    }
                    else
                    {
                        carId = node.CarNum;
                    }
                }
                if (carId.IndexOf(sSearchValue) >= 0)
                {
                    return(node);
                }
                node = this.getNextNode(node);
            }while (node2 != node);
            return(null);
        }
Exemple #10
0
 public void CheckChang(ThreeStateTreeNode currNode)
 {
     this.AllowCheck  = true;
     currNode.Checked = !currNode.Checked;
     this.AllowCheck  = false;
     if (currNode.Checked)
     {
         currNode.CheckState = TriState.Checked;
     }
     else
     {
         currNode.CheckState = TriState.Unchecked;
     }
     foreach (ThreeStateTreeNode node in currNode.Nodes)
     {
         this.SetNodeTriState(node);
     }
     this.RecursiveSetNodeTriState(currNode);
 }
Exemple #11
0
        public void SimapleSetNodeTriState(ThreeStateTreeNode currNode)
        {
            int num   = 0;
            int num2  = 0;
            int num3  = 0;
            int count = currNode.Nodes.Count;

            if (currNode.Nodes.Count > 0)
            {
                foreach (ThreeStateTreeNode node in currNode.Nodes)
                {
                    if (node.Checked)
                    {
                        num2++;
                    }
                    else if (!node.Checked)
                    {
                        num3++;
                    }
                    if (node.CheckState == TriState.Indeterminate)
                    {
                        num++;
                        break;
                    }
                }
            }
            if ((num > 0) || ((num2 > 0) && (num3 > 0)))
            {
                currNode.CheckState = TriState.Indeterminate;
            }
            else if ((num2 > 0) && (num3 == 0))
            {
                currNode.CheckState = TriState.Checked;
            }
            else if ((num2 == 0) && (num3 > 0))
            {
                currNode.CheckState = TriState.Unchecked;
            }
        }
Exemple #12
0
 public void SimapleSetNodeTriState(ThreeStateTreeNode currNode)
 {
     int num = 0;
     int num2 = 0;
     int num3 = 0;
     int count = currNode.Nodes.Count;
     if (currNode.Nodes.Count > 0)
     {
         foreach (ThreeStateTreeNode node in currNode.Nodes)
         {
             if (node.Checked)
             {
                 num2++;
             }
             else if (!node.Checked)
             {
                 num3++;
             }
             if (node.CheckState == TriState.Indeterminate)
             {
                 num++;
                 break;
             }
         }
     }
     if ((num > 0) || ((num2 > 0) && (num3 > 0)))
     {
         currNode.CheckState = TriState.Indeterminate;
     }
     else if ((num2 > 0) && (num3 == 0))
     {
         currNode.CheckState = TriState.Checked;
     }
     else if ((num2 == 0) && (num3 > 0))
     {
         currNode.CheckState = TriState.Unchecked;
     }
 }
Exemple #13
0
 public void SetNodeTriState(ThreeStateTreeNode currNode)
 {
     currNode.CheckState = ((ThreeStateTreeNode) currNode.Parent).CheckState;
     if (currNode.Nodes.Count > 0)
     {
         foreach (ThreeStateTreeNode node in currNode.Nodes)
         {
             node.CheckState = currNode.CheckState;
             this.SetNodeTriState(node);
         }
     }
 }
Exemple #14
0
 public ThreeStateTreeNode getNextNode(ThreeStateTreeNode tnNode)
 {
     if (base.Nodes.Count == 0)
     {
         return null;
     }
     ThreeStateTreeNode nextVisibleNode = tnNode.NextVisibleNode as ThreeStateTreeNode;
     if (nextVisibleNode == null)
     {
         nextVisibleNode = base.Nodes[0] as ThreeStateTreeNode;
     }
     return nextVisibleNode;
 }
Exemple #15
0
 public void DelAreaNodeHashTable(ThreeStateTreeNode myNode)
 {
     if (this.areaNodeHashTable.ContainsKey(myNode.Name))
     {
         this.areaNodeHashTable.Remove(myNode.Name);
     }
 }
Exemple #16
0
 private void getTreeNodeIsChecked(ThreeStateTreeNode tn, ref DataTable dt)
 {
     foreach (ThreeStateTreeNode node in tn.Nodes)
     {
         if ((node.Tag != null) && node.Tag.Equals("CAR"))
         {
             if (node.Checked)
             {
                 string str = (node.AccOn == "0") ? "关" : "开";
                 object[] values = new object[14];
                 values[0] = node.CarNum;
                 values[1] = node.SimNum;
                 values[2] = (node.CarAreaName == node.WordCompany) ? node.CarAreaName : (node.WordCompany + "-" + node.CarAreaName);
                 values[3] = node.Longitude;
                 values[4] = node.Latitude;
                 values[5] = node.ALLDiff;
                 values[6] = node.ReceTime;
                 values[7] = node.GpsTime;
                 values[9] = node.Speed;
                 values[10] = str;
                 values[11] = node.DriverName;
                 values[12] = node.CarId;
                 values[13] = node.AreaType;
                 dt.Rows.Add(values);
                 if (!string.IsNullOrEmpty(node.Longitude))
                 {
                     if (!this.bRefresh)
                     {
                         this.iCurrentCnt++;
                         worker.ReportProgress(this.iCurrentCnt / this.iNodeCnt, node.SimNum + "|" + node.Longitude + "," + node.Latitude);
                     }
                     else
                     {
                         MainForm.myMap.execExcuteTrackPointQuerty(this.sQueryTypeValue, node.SimNum, node.Longitude, node.Latitude);
                     }
                 }
             }
         }
         else
         {
             this.getTreeNodeIsChecked(node, ref dt);
         }
     }
 }
Exemple #17
0
 private void updCarPlace(int iType, ThreeStateTreeNode node)
 {
     try
     {
         string showText = string.Empty;
         if (!Variable.sJGShowCar.Equals("0"))
         {
             string reg = "[\u4e00-\u9fa5][A-Z][A-Z0-9]{5}$";
             if (Variable.sJGShowCar.Equals("1"))
             {
                 showText = new Regex(reg).Replace(node.CarNum, "").TrimEnd(new char[]{' ', '-'});
             }
             else
             {
                 showText = new Regex(reg).Match(node.CarNum).Value;
             }
         }
         if (string.IsNullOrEmpty(showText))
         {
             showText = node.CarNum;
         }
         if (iType == 0)
         {
             MainForm.myMap.excuteSpatialQueryById(node.CarId, node.Longitude, node.Latitude);
         }
         else if (iType == 1)
         {
             node.SetNodeText(string.Format("{0}({1})", showText, node.Place));
             ThreeStateTreeNode node2 = this.tvTrackCar.getNodeById(node.CarId);
             if (node2 != null)
             {
                 node2.SetNodeText(string.Format("{0}({1})", showText, node.Place));
             }
             node2 = null;
         }
     }
     catch (Exception exception)
     {
         if (Variable.bLogin)
         {
             Record.execFileRecord("设置车辆位置信息updCarPlace", exception.Message);
         }
     }
 }
Exemple #18
0
        private void ShowCarDetail(ThreeStateTreeNode tn)
        {
            if (((tn != null) && (tn.Tag != null)) && tn.Tag.Equals("CAR"))
            {
                this.sDetailCarId = tn.CarId;
                int num = 0;
                int num2 = int.Parse(Variable.sGetNodeDetailShowType);
                StringBuilder builder = new StringBuilder();
                if (num2 == 0)
                {
                    this.rtxtCarDetail.Text = tn.ToolTipText;
                }
                else
                {
                    if ((num2 & 1) != 0)
                    {
                        builder.Append(string.Format("基本信息:{0}|*", tn.CarNum ));//+ "  " + tn.CarAreaName
                        num++;
                    }
                    builder.Append(string.Format("罐子状态:{0}|*", (tn.DynamicAttr.ContainsKey("罐子状态") ? tn.DynamicAttr["罐子状态"] : "")));
                    num++;
                    builder.Append(string.Format("当前油量:{0}|*", (tn.DynamicAttr.ContainsKey("oil") ? tn.DynamicAttr["oil"] : "")));
                    num++;
                    if ((num2 & 2) != 0)
                    {
                        builder.Append(string.Format("上报时间:{0}|*", tn.ReceTime));
                        num++;
                    }
                    if ((num2 & 4) != 0)
                    {
                        builder.Append(string.Format("定位时间:{0}|*", tn.GpsTime));
                        num++;
                    }
                    if ((num2 & 8) != 0)
                    {
                        builder.Append(string.Format("当前位置:{0}|*", tn.Address));
                        num++;
                    }

                    //自定义附加消息显示 周立山 2014.1.7
                    string[] status = TransAddMsgTxt(tn.AddMsgTxt);
                    foreach (var s in status)
                    {
                        if (s.StartsWith("制动"))
                            builder.Append(string.Format("制    动:{0}|*", s.EndsWith("开") ? "开启" : "关闭"));
                        if (s.StartsWith("左转向灯"))
                            builder.Append(string.Format("左转向灯:{0}|*", s.EndsWith("开") ? "开启" : "关闭"));
                        if (s.StartsWith("右转向灯"))
                            builder.Append(string.Format("右转向灯:{0}|*", s.EndsWith("开") ? "开启" : "关闭"));
                        if (s.StartsWith("远光灯"))
                            builder.Append(string.Format("远 光 灯:{0}|*", s.EndsWith("开") ? "开启" : "关闭"));
                        if (s.StartsWith("近光灯"))
                            builder.Append(string.Format("近 光 灯:{0}|*", s.EndsWith("开") ? "开启" : "关闭"));
                    }

                    if ((num2 & 16) != 0)
                    {
                        builder.Append(string.Format("速    度:{0}|*", tn.Speed));
                        num++;
                    }
                    if ((num2 & 32) != 0)
                    {
                        builder.Append(string.Format("累计里程:{0}|*", tn.ALLDiff));
                        num++;
                    }
                    if ((num2 & 64) != 0)
                    {
                        builder.Append(string.Format("经 纬 度:{0}|*", tn.Longitude + ";" + tn.Latitude));
                        num++;
                    }
                    if ((num2 & 128) != 0)
                    {
                        builder.Append(string.Format("运营状态:{0}|*", tn.TransportStatu));
                        num++;
                    }
                    if ((num2 & 256) != 0)
                    {
                        builder.Append(string.Format("方 向 角:{0}|*", tn.Direction));
                        num++;
                        builder.Append(string.Format("海拔高度:{0}|*", tn.Altitude));
                        num++;
                    }
                    if ((num2 & 512) != 0)
                    {
                        builder.Append(string.Format("到期时间:{0}|*", tn.EndTime));
                        num++;
                    }
                    string str = builder.ToString();
                    str = str.Substring(0, str.Length - 2).Replace("|*", "\r\n");
                    this.rtxtCarDetail.Text = str;
                    builder = null;
                    this.rtxtCarDetail.Height = (num * 16) + 21;
                }
            }
            else
            {
                this.sDetailCarId = "";
                this.rtxtCarDetail.Text = "";
                if (tn == null)
                {
                    Record.execFileRecord("左下角车辆信息栏有时会空白显示", " 树节点值为NULL");
                }
                else if (tn.Tag == null)
                {
                    Record.execFileRecord("左下角车辆信息栏有时会空白显示", " 节点ID-" + tn.Name + " 节点名称-" + tn.Text + "树节点Tag值为NULL");
                }
                else
                {
                    Record.execFileRecord("左下角车辆信息栏有时会空白显示", " 节点ID-" + tn.Name + " 节点名称-" + tn.Text + "节点Tag-" + tn.Tag.ToString());
                }
            }
        }
Exemple #19
0
        private void setNodeValue(ThreeStateTreeNode myNode, DataRow dr)
        {
            myNode.SetIsFill = dr["IsFill"].ToString();
            myNode.AccOn = dr["AccOn"].ToString();
            myNode.Longitude = dr["Longitude"].ToString();
            myNode.Latitude = dr["Latitude"].ToString();
            myNode.GpsTime = dr["GpsTime"].ToString();
            myNode.Speed = dr["Speed"].ToString();
            myNode.GpsValid = dr["GpsValid"].ToString();
            myNode.AlarmType = dr["AlarmType"].ToString();
            myNode.ReceTime = dr["ReceTime"].ToString();
            myNode.ALLDiff = dr["Distance"].ToString();
            myNode.Direction = dr["Direct"].ToString();
            try
            {
                myNode.Altitude = dr["Altitude"].ToString();
            }
            catch
            {

            }
            try
            {
                myNode.TransportStatu = dr["TransportStatu"].ToString();
            }
            catch
            {

            }

            //自定义附加消息显示 周立山 2014.1.7
            try
            {
                if ((myNode.CarStatusValue == null)
                    ||
                    !myNode.CarStatusValue.Equals(dr["StatuName"].ToString())
                    ||
                    myNode.AddMsgTxt != dr["AddMsgTxt"].ToString()
                    )
                {
                    if (!string.IsNullOrEmpty(dr["StatuName"].ToString()))
                    {
                        myNode.CarStatusValue = dr["StatuName"].ToString();
                    }
                    else
                    {
                        Record.execFileRecord(string.Format("StatuName is null RecordTime-{0},GpsTime-{1},GpsValid-{2},ReceTime-{3},CarId-{4},CarNum-{5}", new object[] { DateTime.Now.ToString(), myNode.GpsTime, myNode.GpsValid, myNode.ReceTime, myNode.CarId, myNode.CarNum }));
                    }
                    if (myNode.AddMsgTxt != dr["AddMsgTxt"].ToString())
                    {
                        myNode.AddMsgTxt = dr["AddMsgTxt"].ToString();
                    }
                    this.setCarTipShowType(myNode);
                }
            }
            catch
            {
                //Record.execFileRecord("解析服务端收到的数据时发生异常,可能是服务端未发送相关字段所导致");
            }

            //if ((myNode.CarStatusValue == null) || !myNode.CarStatusValue.Equals(dr["StatuName"].ToString()))
            //{
            //    if (!string.IsNullOrEmpty(dr["StatuName"].ToString()))
            //    {
            //        myNode.CarStatusValue = dr["StatuName"].ToString();
            //        this.setCarTipShowType(myNode);
            //    }
            //    else
            //    {
            //        Record.execFileRecord(string.Format("StatuName is null RecordTime-{0},GpsTime-{1},GpsValid-{2},ReceTime-{3},CarId-{4},CarNum-{5}", new object[] { DateTime.Now.ToString(), myNode.GpsTime, myNode.GpsValid, myNode.ReceTime, myNode.CarId, myNode.CarNum }));
            //    }
            //}

            if (myNode.CarId == this.sDetailCarId)
            {
                this.ChangeNodeAddress();
            }
        }
Exemple #20
0
 private void setCarStatus(ThreeStateTreeNode tn, DataRow dr, bool isAlarm)
 {
     bool flag = false;
     if ("1".Equals(dr["AccOn"].ToString()))
     {
         flag = true;
     }
     if ("1".Equals(dr["CarStatus"].ToString()))
     {
         string strB = dr["ReceTime"].ToString();
         if (tn.LastAlarmStopTime.CompareTo(strB) <= 0)
         {
             tn.LastAlarmSetTime = strB;
             if (isAlarm)
             {
                 this.AddAlermList(tn.Name, dr);
             }
             if (flag)
             {
                 base.Invoke(this.mySetCarStatus, new object[] { tn, m_sAlarmKey });
             }
             else
             {
                 base.Invoke(this.mySetCarStatus, new object[] { tn, m_sStopAlarmKey });
             }
             tn.IsAlarm = true;
         }
     }
     else if (tn.IsAlarm)
     {
         if (flag)
         {
             base.Invoke(this.mySetCarStatus, new object[] { tn, m_sAlarmKey });
         }
         else
         {
             base.Invoke(this.mySetCarStatus, new object[] { tn, m_sStopAlarmKey });
         }
     }
     else if ("0".Equals(dr["GpsValid"].ToString()) && flag)
     {
         //修改为只有ACC开时,定位状态无效,才设置图标为警告图标 huzh 2014.2.14
         base.Invoke(this.mySetCarStatus, new object[] { tn, m_sFaultKey });
     }
     else if ("1".Equals(dr["IsFill"].ToString()))
     {
         if (flag)
         {
             base.Invoke(this.mySetCarStatus, new object[] { tn, m_sFillKey });
         }
         else
         {
             base.Invoke(this.mySetCarStatus, new object[] { tn, m_sStopFillKey });
         }
     }
     else if (flag)
     {
         base.Invoke(this.mySetCarStatus, new object[] { tn, m_sOnLineKey });
     }
     else
     {
         base.Invoke(this.mySetCarStatus, new object[] { tn, m_sStopOnLineKey });
     }
 }
Exemple #21
0
        internal void TreeViewAfterTriStateUpdate(ThreeStateTreeNode node)
        {
            TriStateEventArgs e = new TriStateEventArgs(node, node.CheckState);

            this.OnAfterTriStateChanged(e);
        }
Exemple #22
0
 public void SetSelectedNodes(ThreeStateTreeNode myNode)
 {
     this.m_coll.Clear();
     this.m_coll.Add(myNode);
 }
Exemple #23
0
 private void setNodeShow(ThreeStateTreeNode myNode)
 {
     myNode.setNodeShow();
 }
Exemple #24
0
 public void AddAlerm(DataRow myRow)
 {
     try
     {
         if (this.tvTrackCar.Nodes.Count == 0)
         {
             ThreeStateTreeNode node = new ThreeStateTreeNode("报警车辆")
             {
                 Name = "001",
                 Tag = "AREA",
                 ContextMenuStrip = this.m_menuList
             };
             this.tvTrackCar.Nodes.Add(node);
             this.tvTrackCar.setSelectNode(node);
             this.tvTrackCar.Sort();
             this.tvTrackCar.ExpandAll();
         }
         if (this.m_dtCarAlermList == null)
         {
             ((ThreeStateTreeNode)this.tvTrackCar.Nodes[0]).SetNodeText("报警车辆(0)");
             this.tvTrackCar.Enabled = false;
         }
         else
         {
             this.tvTrackCar.Enabled = true;
             bool flag = false;
             if (myRow != null)
             {
                 if (this.AddAlarmNode(myRow))
                 {
                     flag = true;
                     ((ThreeStateTreeNode)this.tvTrackCar.Nodes[0]).SetNodeText("报警车辆(" + this.tvTrackCar.Nodes[0].Nodes.Count + ")");
                 }
             }
             else
             {
                 foreach (DataRow row in this.m_dtCarAlermList.Copy().Rows)
                 {
                     if (this.AddAlarmNode(row))
                     {
                         flag = true;
                     }
                 }
                 this.tvTrackCar.Sort();
                 ((ThreeStateTreeNode)this.tvTrackCar.Nodes[0]).SetNodeText("报警车辆(" + this.tvTrackCar.Nodes[0].Nodes.Count + ")");
                 this.tvTrackCar.ExpandAll();
             }
             if (flag)
             {
                 this.tsbAlarmAffirm.Image = Resources.AlarmSound;
                 AlarmSound.GetInstance().IsCustomAlarmSound(this.m_dtCarAlermList);
                 this.IsPlayAlarmSound = true;
                 this.tPlayAlarmSount.Enabled = true;
             }
             this.OpenAlarmWindow();
         }
     }
     catch (Exception exception)
     {
         if (Variable.bLogin)
         {
             Record.execFileRecord("添加到报警车辆树", exception.ToString());
         }
     }
 }
Exemple #25
0
 private void setWatchCar(ThreeStateTreeNode node)
 {
     foreach (ThreeStateTreeNode node2 in node.Nodes)
     {
         if (node2.CheckState == TriState.Checked)
         {
             execSetWatchCar(new object[] { node2.Name, !node2.Tag.Equals("CAR"), true });
         }
         else if (node2.CheckState == TriState.Indeterminate)
         {
             this.setWatchCar(node2);
         }
     }
 }
Exemple #26
0
 private void GetChildAreaValue(ThreeStateTreeNode node, ref DataTable dtAllArea)
 {
     DataRow row;
     foreach (ThreeStateTreeNode node2 in node.Nodes)
     {
         if (!node2.Tag.Equals("CAR"))
         {
             row = dtAllArea.NewRow();
             row["AreaName"] = node2.AreaName;
             row["AreaCode"] = node2.Name;
             dtAllArea.Rows.Add(row);
             this.GetChildAreaValue(node2, ref dtAllArea);
         }
     }
     row = null;
 }
Exemple #27
0
 public void CreateCarList(DataTable dtList)
 {
     try
     {
         ThreeStateTreeNode node;
         if (dtList == null)
         {
             WaitForm.Hide();
             Record.execFileRecord("CreateCarList", "下载区域信息失败!");
             return;
         }
         if (this.IsFresh)
         {
             WaitForm.Show("正在创建车辆列表,请稍候...", this);
         }
         else
         {
             WaitForm.Show("正在创建车辆列表,请稍候...");
         }
         this.tvList.hasCarPath.Clear();
         this.tvList.hasAreaPath.Clear();
         string key = "";
         string strAreaId = "";
         string str3 = "";
         string str4 = "";
         string sAreaId = "";
         for (int i = 0; i < dtList.Rows.Count; i++)
         {
             ThreeStateTreeNode node2;
             key = dtList.Rows[i]["AreaCode"].ToString().Trim();
             strAreaId = dtList.Rows[i]["AreaId"].ToString().Trim();
             str3 = dtList.Rows[i]["TotalCount"].ToString().Trim();
             str4 = dtList.Rows[i]["AreaName"].ToString().Trim();
             node = new ThreeStateTreeNode(string.Format("{0}(0/{1})", str4, str3))
             {
                 CarCnt = int.Parse(str3),
                 Name = key,
                 AreaName = str4,
                 Tag = "AREA",
                 NodeIndex = i
             };
             if (dtList.Columns.Contains("AreaType"))
             {
                 node.AreaType = dtList.Rows[i]["AreaType"].ToString().Trim();
             }
             node.ContextMenuStrip = this.m_menuList;
             sAreaId = key;
             do
             {
                 sAreaId = sAreaId.Remove(sAreaId.Length - 2);
                 node2 = this.tvList.getAreaById(sAreaId);
             }
             while ((node2 == null) && (sAreaId.Length > 1));
             if (sAreaId.Length == 0)
             {
                 node.AreaPath = key;
                 this.tvList.hasAreaPath.Add(key, node);
                 this.tvList.Nodes.Add(node);
             }
             else
             {
                 this.tvList.hasAreaPath.Add(key, node);
                 int index = 0;
                 foreach (TreeNode node3 in node2.Nodes)
                 {
                     if (node3.Tag.Equals("AREA"))
                     {
                         index++;
                     }
                 }
                 node2.Nodes.Insert(index, node);
             }
             this.setAreaCar(node, strAreaId);
         }
         foreach (TreeNode node4 in this.tvList.Nodes)
         {
             node4.Expand();
         }
         node = null;
         if (!"1".Equals(Variable.sAllowRefresh))
         {
             this.tsbRefreshList.Visible = false;
         }
     }
     catch (InvalidOperationException)
     {
     }
     catch (Exception exception)
     {
         MessageBox.Show("创建车辆列表失败!");
         Record.execFileRecord("CreateCarList", exception.Message);
     }
     WaitForm.Hide();
 }
Exemple #28
0
 private void GetChildValue(ThreeStateTreeNode node, ref DataTable dtAllCar)
 {
     DataRow row;
     foreach (ThreeStateTreeNode node2 in node.Nodes)
     {
         if (node2.Tag.Equals("CAR"))
         {
             row = dtAllCar.NewRow();
             row["CarNum"] = node2.CarNum;
             row["SimNum"] = node2.SimNum;
             row["CarId"] = node2.CarId;
             dtAllCar.Rows.Add(row);
         }
         else
         {
             this.GetChildValue(node2, ref dtAllCar);
         }
     }
     row = null;
 }
Exemple #29
0
 public void setAreaText()
 {
     if (this.tvList.areaNodeHashTable.Count != 0)
     {
         try
         {
             ThreeStateTreeNode[] array = new ThreeStateTreeNode[this.tvList.areaNodeHashTable.Count];
             this.tvList.areaNodeHashTable.Values.CopyTo(array, 0);
             foreach (ThreeStateTreeNode node in array)
             {
                 base.Invoke(this.mySetAreaText, new object[] { node });
             }
             array = null;
         }
         catch (Exception exception)
         {
             Record.execFileRecord("统计在线车辆并刷新树节点文本", exception.Message);
         }
     }
 }
Exemple #30
0
 private void GetChildValue(string sGetType, ThreeStateTreeNode node, ref string sCarValues)
 {
     foreach (ThreeStateTreeNode node2 in node.Nodes)
     {
         if (!node2.Tag.Equals("CAR"))
         {
             this.GetChildValue(sGetType, node2, ref sCarValues);
             continue;
         }
         string str = "";
         string str2 = sGetType;
         if (str2 != null)
         {
             if (!(str2 == "CarNum"))
             {
                 if (str2 == "CarId")
                 {
                     str = str + node2.CarId + ",";
                 }
                 if (str2 == "SimNum")
                 {
                     str = str + node2.SimNum + ",";
                 }
             }
             else
             {
                 str = str + node2.CarNum + ",";
             }
         }
         sCarValues = sCarValues + str;
     }
 }
Exemple #31
0
 public void CheckChang(ThreeStateTreeNode currNode)
 {
     this.AllowCheck = true;
     currNode.Checked = !currNode.Checked;
     this.AllowCheck = false;
     if (currNode.Checked)
     {
         currNode.CheckState = TriState.Checked;
     }
     else
     {
         currNode.CheckState = TriState.Unchecked;
     }
     foreach (ThreeStateTreeNode node in currNode.Nodes)
     {
         this.SetNodeTriState(node);
     }
     this.RecursiveSetNodeTriState(currNode);
 }
Exemple #32
0
 private string getSubCheckCar(ThreeStateTreeNode tn)
 {
     string str = "";
     try
     {
         foreach (ThreeStateTreeNode node in tn.Nodes)
         {
             if ((node.Tag != null) && node.Tag.Equals("CAR"))
             {
                 if (node.Checked)
                 {
                     str = str + node.CarId + ",";
                 }
             }
             else
             {
                 str = str + this.getSubCheckCar(node);
             }
         }
     }
     catch
     {
     }
     return str;
 }
Exemple #33
0
 public ThreeStateTreeNode getCar(ThreeStateTreeNode tnNode, string sSearchType, string sSearchValue)
 {
     ThreeStateTreeNode node;
     if (tnNode == null)
     {
         node = base.Nodes[0] as ThreeStateTreeNode;
     }
     else
     {
         node = this.getNextNode(tnNode);
     }
     ThreeStateTreeNode node2 = node;
     do
     {
         string carId = "";
         string str2 = sSearchType;
         if (str2 != null)
         {
             if (!(str2 == "CarNum"))
             {
                 if (str2 == "CarId")
                 {
                     carId = node.CarId;
                 }
                 else if (str2 == "SimNum")
                 {
                     carId = node.SimNum;
                 }
             }
             else
             {
                 carId = node.CarNum;
             }
         }
         if (carId.IndexOf(sSearchValue) >= 0)
         {
             return node;
         }
         node = this.getNextNode(node);
     }
     while (node2 != node);
     return null;
 }
Exemple #34
0
 private string getWaybillCodeList(ThreeStateTreeNode tn)
 {
     string str = "";
     if (Variable.sShippingEnable.Equals("1") && (this.m_dtShippingList != null))
     {
         try
         {
             DataView view = new DataView(this.m_dtShippingList, string.Format("SimNum={0}", tn.SimNum), "WaybillCode", DataViewRowState.CurrentRows);
             if (view.Count <= 0)
             {
                 return str;
             }
             str = "\r\n------------------------------------";
             str = str + string.Format("\r\n运单列表:{0}:{1}-->{2}", view[0]["WaybillCode"].ToString(), view[0]["ShippingLocation"].ToString(), view[0]["Destination"].ToString());
             for (int i = 1; i < view.Count; i++)
             {
                 str = str + string.Format("\r\n          {0}:{1}-->{2}", view[i]["WaybillCode"].ToString(), view[i]["ShippingLocation"].ToString(), view[i]["Destination"].ToString());
             }
         }
         catch
         {
         }
     }
     return str;
 }
Exemple #35
0
 public void RecursiveSetNodeTriState(ThreeStateTreeNode node)
 {
     this.SimapleSetNodeTriState(node);
     if (node.Parent != null)
     {
         this.RecursiveSetNodeTriState((ThreeStateTreeNode) node.Parent);
     }
 }
Exemple #36
0
 private bool searchTrackCarByDriver(string searchkey)
 {
     try
     {
         DataView view = new DataView(this.m_dtCarList, searchkey, "AreaCode,CarNum", DataViewRowState.CurrentRows);
         if (view.Count == 0)
         {
             this.txtCarNo.Focus();
             return false;
         }
         view[0]["CarNum"].ToString();
         int nodeIndex = -1;
         if (this.tvTrackCar.CurrentNode != null)
         {
             nodeIndex = ((ThreeStateTreeNode)this.tvTrackCar.CurrentNode).NodeIndex;
         }
         ThreeStateTreeNode node = new ThreeStateTreeNode();
         bool flag = false;
         foreach (DataRowView view2 in view)
         {
             string sCarId = view2["CarId"].ToString();
             ThreeStateTreeNode node2 = this.tvTrackCar.getNodeById(sCarId);
             if ((node2 != null) && (node2.NodeIndex > nodeIndex))
             {
                 node = node2;
                 flag = true;
                 break;
             }
         }
         if (!flag)
         {
             string str2 = view[0]["CarId"].ToString();
             ThreeStateTreeNode node3 = this.tvTrackCar.getNodeById(str2);
             if (node3 == null)
             {
                 this.txtCarNo.Focus();
                 return false;
             }
             node = node3;
         }
         this.tvTrackCar.setSelectNode(node);
         node.EnsureVisible();
         this.tvTrackCar.Focus();
         view = null;
     }
     catch
     {
     }
     return true;
 }
Exemple #37
0
 public void SetSelectedNodes(ThreeStateTreeNode myNode)
 {
     this.m_coll.Clear();
     this.m_coll.Add(myNode);
 }
Exemple #38
0
        private void setAreaCar(ThreeStateTreeNode myNode, string strAreaId)
        {
            ThreeStateTreeNode node;
            string text = "";
            string key = "";
            string str3 = "";
            DataView view = new DataView(this.m_dtCarList, "AreaId='" + strAreaId + "'", "CarNum", DataViewRowState.CurrentRows);
            for (int i = 0; i < view.Count; i++)
            {
                text = view[i]["CarNum"].ToString();
                key = view[i]["CarId"].ToString();
                str3 = view[i]["SimNum"].ToString();

                string showCarNum = string.Empty;
                if (!Variable.sJGShowCar.Equals("0"))
                {
                    string reg = "[\u4e00-\u9fa5][A-Z][A-Z0-9]{5}$";
                    if (Variable.sJGShowCar.Equals("1"))
                    {
                        showCarNum = new Regex(reg).Replace(view[i]["CarNum"].ToString(), "").Trim(new char[] { ' ', '-' });
                    }
                    else
                    {
                        showCarNum = new Regex(reg).Match(view[i]["CarNum"].ToString()).Value;
                    }
                }
                if (string.IsNullOrEmpty(showCarNum))
                {
                    showCarNum = view[i]["CarNum"].ToString();
                }

                node = new ThreeStateTreeNode(text)
                {
                    Tag = "CAR",
                    Name = key,
                    SimNum = str3,
                    CarId = key,
                    CarAreaName = myNode.AreaName,
                    ImageKey = m_sOffLineKey,
                    SelectedImageKey = m_sOffLineKey,
                    EndTime = view[i]["SvrEndTime"].ToString(),
                    CarType = view[i]["CarTypeName"].ToString(),
                    CarColor = view[i]["CarColor"].ToString(),
                    CarPName = view[i]["OwnerName"].ToString(),
                    CarPTel = view[i]["OwnerSimNum"].ToString(),
                    CarEmail = view[i]["OwnerEmail"].ToString(),
                    WordCompany = view[i]["CorpName"].ToString(),
                    CarPID = view[i]["PersonID"].ToString(),
                    FirstName = view[i]["FirstConnectorName"].ToString(),
                    FirstTel = view[i]["FirstConnectTele"].ToString(),
                    SecondName = view[i]["ConnectorName"].ToString(),
                    SecondTel = view[i]["ConnectTele"].ToString(),
                    Text = showCarNum
                };
                if (view.Table.Columns.Contains("TerminalType"))
                {
                    node.TerminalType = view[i]["TerminalType"].ToString();
                }
                node.ReceTime = view[i]["ReceTime"].ToString();
                node.GpsTime = view[i]["GpsTime"].ToString();
                node.Longitude = view[i]["Longitude"].ToString();
                node.Latitude = view[i]["Latitude"].ToString();
                node.Direction = view[i]["Direct"].ToString();
                node.Speed = view[i]["Speed"].ToString();
                node.ALLDiff = view[i]["DistanceDiff"].ToString();
                if (view.Table.Columns.Contains("DriverName"))
                {
                    node.DriverCode = view[i]["DriverCode"].ToString();
                    node.DriverName = view[i]["DriverName"].ToString();
                }
                if (view.Table.Columns.Contains("Altitude"))
                {
                    node.Altitude = view[i]["Altitude"].ToString();
                }
                if (view.Table.Columns.Contains("AreaType"))
                {
                    node.AreaType = view[i]["AreaType"].ToString();
                }
                if (view.Table.Columns.Contains("PlateColor"))
                {
                    node.PlateColor = view[i]["PlateColor"].ToString();
                }
                if (view.Table.Columns.Contains("Company"))
                {
                    node.Company = view[i]["Company"].ToString();
                }
                if (view.Table.Columns.Contains("TermSerial"))
                {
                    node.TermSerial = view[i]["TermSerial"].ToString();
                }
                if (view.Table.Columns.Contains("TransportStatu"))
                {
                    node.TransportStatu = view[i]["TransportStatu"].ToString();
                }
                node.NodeIndex = this.iIndex;
                this.iIndex++;
                node.ContextMenuStrip = this.m_menuList;
                this.setCarTipShowType(node);
                this.tvList.hasCarPath.Add(key, node);
                myNode.Nodes.Add(node);
            }
            node = null;
        }
Exemple #39
0
 internal void TreeViewAfterTriStateUpdate(ThreeStateTreeNode node)
 {
     TriStateEventArgs e = new TriStateEventArgs(node, node.CheckState);
     this.OnAfterTriStateChanged(e);
 }
Exemple #40
0
 private void setCarStatus(ThreeStateTreeNode node, string sKey)
 {
     try
     {
         if ((this.tvList != null) && (this.tvList.Nodes.Count != 0))
         {
             if (node.CarStatus != sKey)
             {
                 node.CarStatus = sKey;
             }
             if (sKey.Equals(m_sOffLineKey))
             {
                 MainForm.myMap.execDeleteCar(node.Name);
             }
         }
     }
     catch
     {
     }
 }
Exemple #41
0
 private void getTreeNodeIsChecked(ThreeStateTreeNode tn, ref DataTable dt)
 {
     foreach (ThreeStateTreeNode node in tn.Nodes)
     {
         if ((node.Tag != null) && node.Tag.Equals("CAR"))
         {
             if (node.Checked)
             {
                 dt.Rows.Add(new object[] { node.CarNum, node.SimNum });
             }
         }
         else
         {
             this.getTreeNodeIsChecked(node, ref dt);
         }
     }
 }
Exemple #42
0
 public TriStateEventArgs(ThreeStateTreeNode currNode, TriState currThreeCheckedState)
 {
     this.node = currNode;
     this.threeCheckedState = currThreeCheckedState;
 }