void m_viewModel_TrafficEventReceived(TrafficeEventInfoV3_1 obj)
 {
     if (InvokeRequired)
     {
         this.Invoke(new Action<TrafficeEventInfoV3_1>(m_viewModel_TrafficEventReceived), obj);
     }
     else
     {
         if (trafficEventList.Count >= 50)
         {
             var item = trafficEventList[trafficEventList.Count - 1];
             item.Dispose();
             trafficEventList.RemoveAt(trafficEventList.Count - 1);
             advTreeTrafficEvent.Nodes.RemoveAt(trafficEventList.Count - 1);
         }
         var property = new TrafficeEventProperty(obj);
         trafficEventList.Insert(0, property);
         //advTreeTrafficEvent.RefreshItems();
         DevComponents.AdvTree.Node n = new DevComponents.AdvTree.Node(property.EventType);
         n.Cells.Add(new DevComponents.AdvTree.Cell(property.StartTime));
         n.Cells.Add(new DevComponents.AdvTree.Cell(property.EndTime));
         n.Cells.Add(new DevComponents.AdvTree.Cell(property.PlateNum));
         n.Cells.Add(new DevComponents.AdvTree.Cell(property.VehicleColor));
         n.Cells.Add(new DevComponents.AdvTree.Cell(property.VehicleType));
         n.Cells.Add(new DevComponents.AdvTree.Cell(property.VehicleTypeDetail));
         n.Cells.Add(new DevComponents.AdvTree.Cell(property.VehicleLabel));
         n.Cells.Add(new DevComponents.AdvTree.Cell(property.VehicleLabelDetail));
         n.Cells.Add(new DevComponents.AdvTree.Cell(property.VehicleSpeed));
         n.Cells.Add(new DevComponents.AdvTree.Cell(property.CameraCode));
         n.Tag = property;
         advTreeTrafficEvent.Nodes.Insert(0,n);
     }
 }
Beispiel #2
0
        /// <summary>
        /// 新增节点
        /// </summary>
        public void AddLayer()
        {
            BaseDeptLayer deptlayer = new BaseDeptLayer();

            if (this.treeDeptLayer.SelectedNode != null && !string.IsNullOrEmpty(this.treeDeptLayer.SelectedNode.Name))
            {
                deptlayer.PId = Convert.ToInt32(this.treeDeptLayer.SelectedNode.Name);
            }
            else
            {
                deptlayer.PId = 0;
            }

            deptlayer.Name = "输入节点名称";
            //deptlayer.WorkId = Convert.ToInt32(cboWorker.SelectedValue);
            var result = InvokeController("SaveDeptLayer", deptlayer);
            var node   = new DevComponents.AdvTree.Node("输入节点名称");

            node.Name = result.ToString();
            if (this.treeDeptLayer.SelectedNode != null)
            {
                this.treeDeptLayer.SelectedNode.Nodes.Add(node);
            }
            else
            {
                this.treeDeptLayer.Nodes.Add(node);
            }

            this.treeDeptLayer.SelectNode(node, DevComponents.AdvTree.eTreeAction.Code);
            node.BeginEdit();
        }
 public DevComponents.AdvTree.Node CreateNode(Maticsoft.Model.SMT_FUN_MENUPOINT fun)
 {
     DevComponents.AdvTree.Node node = new DevComponents.AdvTree.Node(fun.FUN_NAME + " [" + fun.FUN_CODE + "]");
     node.Tag     = fun;
     node.Tooltip = fun.FUN_NAME + " [" + fun.FUN_CODE + "]";
     return(node);
 }
        public FormLoadSettings(Tileset[] tilesets)
        {
            InitializeComponent();

            this.tilesets = tilesets;

            foreach (var tileset in tilesets)
            {
                Node node = new Node(tileset.File);

                if (String.IsNullOrEmpty(tileset.File))
                {
                    node.Text = String.Format("Not Specified [w: {0}, h: {1}]", tileset.Size.X, tileset.Size.Y);
                }

                node.Cells.Add(new Cell("<browse for file>"));

                node.Cells[0].Editable = false;
                node.Cells[1].Editable = false;

                node.NodeDoubleClick += node_NodeDoubleClick;

                tilesetFilesList.Nodes.Add(node);
            }
        }
        public TreeDragDropEventArgs(eTreeAction action, Node[] nodes, Node oldParentNode, Node newParentNode, int insertPosition)
            : base(action, nodes)
		{
			this.NewParentNode = newParentNode;
			this.OldParentNode = oldParentNode;
            this.InsertPosition = insertPosition;
		}
        /// <summary>
        /// Called when the selected world changes
        /// </summary>
        void onWorldChange()
        {
            // closed last world open
            if (world == null)
            {
                layersList.Nodes.Clear();
                btnAddLayer.Enabled = false;
                return;
            }

            btnAddLayer.Enabled = true;

            // cache index before it gets changed from
            // modifying the list
            int index = world.SelectedLayer;

            layersList.Nodes.Clear();

            // collision layer
            Node collision = new Node("Collision Layer")
            {
                CheckBoxVisible = true,
                Checked = true,
                ImageIndex = 1,
                Editable = false
            };

            layersList.Nodes.Add(collision);
         
            // add layers from new world
            for (int i = world.LayerCount - 2; i >= 0; i--)
                addLayer(world.GetLayerName(i), i == world.SelectedLayer, world.GetLayerVisibility(i));

            SetLayer(index);
        }
 /// <summary>
 /// Initializes a new instance of the TreeDragFeedbackEventArgs class.
 /// </summary>
 /// <param name="parentNode"></param>
 /// <param name="insertPosition"></param>
 public TreeDragFeedbackEventArgs(Node parentNode, int insertPosition, Node dragNode, DragDropEffects effect)
 {
     ParentNode = parentNode;
     InsertPosition = insertPosition;
     _DragNode = dragNode;
     _Effect = effect;
 }
Beispiel #8
0
 private void AddCondition(Rotation rotation, AdvTree advTree)
 {
     var node = new Node();
     node.Text = rotation.Name;
     node.Tag = rotation;
     AddNode(node, advTree);
 }
        public FormSaveSettings(string saveLocation, FormWorld world)
        {
            InitializeComponent();

            this.saveLocation = saveLocation;
            this.world = world;

            var saveUri = new Uri(saveLocation);

            foreach (var tileset in world.Tilesets)
            {
                string relative = saveUri.MakeRelativeUri(new Uri(tileset.Filename)).ToString();

                Node node = new Node(Path.GetFileName(tileset.Filename))
                {
                    CheckBoxVisible = true,
                    Checked = tileset.ShouldBuild
                };

                Cell cell = new Cell()
                {
                    Text = tileset.BuildLocation != null ? tileset.BuildLocation : 
                           Path.Combine(Path.GetDirectoryName(relative), Path.GetFileNameWithoutExtension(relative)),
                    Editable = true
                };

                node.Cells[0].Editable = false;

                node.Cells.Add(cell);

                tilesetFilesList.Nodes.Add(node);
            }
        }
Beispiel #10
0
        /// <summary>
        /// 确定选择
        /// </summary>
        /// <param name="sender">事件发送者</param>
        /// <param name="e">事件参数</param>
        private void buttonX1_Click(object sender, EventArgs e)
        {
            DevComponents.AdvTree.Node selectedNode = advTree1.SelectedNode;

            if (selectedNode != null && selectedNode.Tag != null)
            {
                selectedValue = selectedNode.Tag.ToString();
                DataRow[] rows = m_table.Select(string.Format("[{0}] = '{1}'", returnField, selectedValue));
                if (rows.Length > 0)
                {
                    DataRow row = rows[0];
                    foreach (DataColumn column in m_table.Columns)
                    {
                        selectedValues[column.ColumnName] = row[column.ColumnName];
                    }
                }

                DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                MessageBox.Show("无效的选择!", "数据选择", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Beispiel #11
0
 /// <summary>
 /// 设置类型的变化
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void comboBoxExSet_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (ToolBtns != null)
     {
         advTree_AllTools.Nodes.Clear();
         for (int i = 0; i < ToolBtns.Length; i++)
         {
             DevComponents.AdvTree.Node temp = new DevComponents.AdvTree.Node();
             temp.Image           = ToolBtns[i].Image;
             temp.Text            = ToolBtns[i].Text;
             temp.Name            = ToolBtns[i].Name;
             temp.CheckBoxVisible = true;
             advTree_AllTools.Nodes.Add(temp);
         }
         if (comboBoxExSet.SelectedIndex == 0)
         {
             strOlds = App.Read_ConfigInfo("SYSTEMSET", "TOOLS", Application.StartupPath + "\\Config.ini");
         }
         else
         {
             strOlds = App.ReadSqlVal("select TOOL_BUTTON_SET from T_ACCOUNT_SET where ACCOUNT_ID=" + App.UserAccount.Account_id + "", 0, "TOOL_BUTTON_SET");
             if (strOlds == null)
             {
                 strOlds = "";
             }
         }
         ReSet(strOlds);
     }
 }
Beispiel #12
0
 /// <summary>
 /// 删除分组
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void buttonItemDeleteGroup_Click(object sender, EventArgs e)
 {
     DevComponents.AdvTree.Node selectedNode = advTreeMeshList.SelectedNode;
     if (selectedNode == null)
     {
         MessageBox.Show("未选择任何分组!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
         return;
     }
     if (selectedNode.Text == "默认分组")
     {
         MessageBox.Show("默认分组不能删除!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return;
     }
     if (selectedNode.Level == 0)
     {
         if (DialogResult.OK == MessageBox.Show("确认删除分组“" + selectedNode.Text + "”?", "提醒", MessageBoxButtons.OKCancel, MessageBoxIcon.Information))
         {
             try
             {
                 SQLiteHelper.GetInstance().MeshDeviceGroupDelete(selectedNode.Text);
                 advTreeMeshList.Nodes.Remove(selectedNode);
                 logger.Info("删除分组“" + selectedNode.Text + "”。");
             }
             catch (Exception ex)
             {
                 MessageBox.Show("删除分组“" + selectedNode.Text + "”失败!", "失败", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 logger.Error("删除分组“" + selectedNode.Text + "”失败!\n", ex);
             }
         }
     }
 }
Beispiel #13
0
 private void AddCondition(Rule rule, AdvTree advTree)
 {
     var node = new Node();
     node.Text = rule.Name;
     node.Tag = rule;
     AddNode(node, advTree);
 }
Beispiel #14
0
		/// <summary>
		/// Gets the last child tree node. The LastNode is the last child Node in the NodeCollection stored in the Nodes property of the current tree node. If the Node has no child tree node, the LastNode property returns a null reference (Nothing in Visual Basic).
		/// </summary>
		/// <param name="node">Reference node.</param>
		/// <returns>Last node if found or null if there is no last node.</returns>
		public static Node GetLastNode(Node node)
		{
			if(node.Nodes.Count>0)
			{
				return node.Nodes[node.Nodes.Count-1];
			}
			return null;
		}
Beispiel #15
0
 private void AddSchool(string name)
 {
     var add = new Node(name);
     add.Tag = name;
     ListSchoolItems.BeginUpdate();
     ListSchoolItems.Nodes.Add(add);
     ListSchoolItems.EndUpdate();
 }
		public TreeNodeMouseEventArgs(Node node, MouseButtons button, int clicks, int delta, int x, int y)
		{
			this.Node = node;
			this.Button = button;
			this.Clicks = clicks;
			this.Delta = delta;
			this.X = x;
			this.Y = y;
		}
Beispiel #17
0
 /// <summary>
 /// 鼠标按下事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void advTreeMeshList_MouseDown(object sender, MouseEventArgs e)
 {
     DevComponents.AdvTree.Node selectNode = advTreeMeshList.SelectedNode;
     if (selectNode != null && selectNode.Level == 0)
     {
         //拖动设备
         advTreeMeshList.DoDragDrop(selectNode, DragDropEffects.Copy);
     }
 }
Beispiel #18
0
 public Node CreateControl(string name, string tag, Control control)
 {
     var node = new Node();
     node.Expanded = true;
     node.Name = name;
     node.Tag = tag;
     node.HostedControl = control;
     node.DragDropEnabled = false;
     return node;
 }
Beispiel #19
0
 public Node CreateRadioButton(string name, string text, string tag, bool selected = false)
 {
     var node = new Node();
     node.CheckBoxStyle = eCheckBoxStyle.RadioButton;
     node.CheckBoxVisible = true;
     node.Expanded = true;
     node.Name = name;
     node.Text = text;
     node.Tag = tag;
     node.Checked = selected;
     node.DragDropEnabled = false;
     return node;
 }
Beispiel #20
0
        private void advTreeMeshList_DragDrop(object sender, DragEventArgs e)
        {
            AdvTree tree  = (AdvTree)sender;
            Point   point = tree.PointToClient(new Point(e.X, e.Y));

            DevComponents.AdvTree.Node targetNode = tree.GetNodeAt(point);
            DevComponents.AdvTree.Node dragNode   = (DevComponents.AdvTree.Node)e.Data.GetData("DevComponents.AdvTree.Node");
            if (targetNode != null)
            {
                targetNode.Nodes.Insert(targetNode.Nodes.Count, dragNode);
                advTreeMeshList.SelectedNode = dragNode;
                targetNode.Expand();
            }
        }
Beispiel #21
0
		/// <summary>
		/// Returns full path to the given node.
		/// </summary>
		/// <param name="node">Node to return path to.</param>
		/// <returns>Full path to the node.</returns>
		public static string GetFullPath(Node node,string pathSeparator)
		{
			if(node==null)
				throw new ArgumentNullException("node");
			
			StringBuilder sb=new StringBuilder(node.Text);
			node=node.Parent;
			while(node!=null)
			{
                sb.Insert(0, node.Text + pathSeparator);
				node=node.Parent;
			}

			return sb.ToString();
		}
        /// <summary>
        /// Adds a temporary property to the list
        /// </summary>
        void addProperty(string name = newPropertyText, string value = "", bool valueEditable = false)
        {
            Node node = new Node(name)
            {
                ContextMenu = propertyMenu
            };

            Cell cell = new Cell(value)
            {
                Editable = valueEditable
            };

            node.Cells.Add(cell);

            propertiesList.Nodes.Add(node);
        }
Beispiel #23
0
 private void frmToolItemSet_Load(object sender, EventArgs e)
 {
     comboBoxExSet.SelectedIndex = 0;
     if (ToolBtns != null)
     {
         advTree_AllTools.Nodes.Clear();
         for (int i = 0; i < ToolBtns.Length; i++)
         {
             DevComponents.AdvTree.Node temp = new DevComponents.AdvTree.Node();
             temp.Image           = ToolBtns[i].Image;
             temp.Text            = ToolBtns[i].Text;
             temp.Name            = ToolBtns[i].Name;
             temp.CheckBoxVisible = true;
             advTree_AllTools.Nodes.Add(temp);
         }
         strOlds = App.Read_ConfigInfo("SYSTEMSET", "TOOLS", Application.StartupPath + "\\Config.ini");
         ReSet(strOlds);
     }
 }
Beispiel #24
0
        /// <summary>
        /// 原始设置
        /// </summary>
        /// <param name="StrOlds"></param>
        private void ReSet(string StrOlds)
        {
            advTree_AllTools.Nodes.Clear();
            for (int i = 0; i < ToolBtns.Length; i++)
            {
                DevComponents.AdvTree.Node temp = new DevComponents.AdvTree.Node();
                temp.Image           = ToolBtns[i].Image;
                temp.Text            = ToolBtns[i].Text;
                temp.Name            = ToolBtns[i].Name;
                temp.CheckBoxVisible = true;
                advTree_AllTools.Nodes.Add(temp);
            }
            advTree_SelectedTools.Nodes.Clear();
            AdvTree TempadvTree = new AdvTree();

            if (StrOlds != "")
            {
                for (int i = 0; i < StrOlds.Split(',').Length; i++)
                {
                    for (int j = 0; j < advTree_AllTools.Nodes.Count; j++)
                    {
                        if (StrOlds.Split(',')[i] == advTree_AllTools.Nodes[j].Name)
                        {
                            advTree_AllTools.Nodes[j].Checked = true;
                            TempadvTree.Nodes.Add(advTree_AllTools.Nodes[j].Copy());
                        }
                    }
                }
                for (int i = 0; i < TempadvTree.Nodes.Count; i++)
                {
                    TempadvTree.Nodes[i].Checked = false;
                    advTree_SelectedTools.Nodes.Add(TempadvTree.Nodes[i].Copy());
                }


                AddOrRemoveNode(TempadvTree, advTree_AllTools);
            }
            else
            {
                AddOrRemoveNode(advTree_AllTools, advTree_SelectedTools);
            }
        }
Beispiel #25
0
        void menuClick(object sender, EventArgs e)
        {
            string targetForm = "";

            if (sender.GetType() == typeof(ToolStripMenuItem))
            {
                ToolStripMenuItem menuItem = (ToolStripMenuItem)sender;
                targetForm = menuItem.Tag.ToStringHasNull();
            }
            else
            {
                DevComponents.AdvTree.Node menuItem = (DevComponents.AdvTree.Node)sender;
                targetForm = menuItem.Tag.ToStringHasNull();
            }

            try
            {
                if (string.IsNullOrEmpty(targetForm))
                {
                    return;
                }

                string formName = targetForm.Substring(targetForm.LastIndexOf(".") + 1);
                Form   form     = this.MdiChildren.FirstOrDefault <Form>(a => a.Name == formName);
                if (form == null)
                {
                    form = Activator.CreateInstance(Type.GetType(targetForm)) as Form;
                    int count = this.MdiChildren.Where(a => a.Name == form.Name).Count();
                    if (form != null && count == 0)
                    {
                        form.MdiParent = this;
                    }
                }
                form.WindowState = FormWindowState.Maximized;
                form.BringToFront();
                form.Show();
            }
            catch (System.Exception exp)
            {
                MessageBox.Show(exp.Message);
            }
        }
        /// <summary>
        /// Adds new object to the collection and provides information about the source of the command
        /// </summary>
        /// <param name="node">Node to add</param>
        /// <param name="action">Source action</param>
        /// <returns></returns>
        public override int Add(Node node, eTreeAction action)
        {
            if (this.List.Contains(node)) return -1;

            if (TreeSelectionControl.MultiSelect)
            {
                if (TreeSelectionControl.MultiSelectRule == eMultiSelectRule.SameParent && this.Count>0)
                {
                    if (this[0].Parent != node.Parent)
                        throw new InvalidOperationException("Node being added does not belong to the same parent as currently selected nodes. See AdvTree.MultiSelectRule property");
                }
                if (!SuspendEvents)
                {
                    AdvTreeNodeCancelEventArgs cancelArgs = new AdvTreeNodeCancelEventArgs(action, node);
                    TreeSelectionControl.InvokeOnBeforeNodeSelect(cancelArgs);
                    if (cancelArgs.Cancel)
                        return -1;
                }
            }
            return base.Add(node, action);
        }
        private void GetSubTree(DevComponents.AdvTree.Node root, List <Maticsoft.Model.SMT_FUN_MENUPOINT> funs)
        {
            Maticsoft.Model.SMT_FUN_MENUPOINT        rootarea = (Maticsoft.Model.SMT_FUN_MENUPOINT)root.Tag;
            List <Maticsoft.Model.SMT_FUN_MENUPOINT> subAreas = funs.FindAll(m => m.PAR_ID == rootarea.ID);

            subAreas.ForEach(m => funs.Remove(m));
            foreach (var item in subAreas)
            {
                SYS_FUN_POINT point;
                if (Enum.TryParse <SYS_FUN_POINT>(item.FUN_CODE, out point))
                {
                    if (point == SYS_FUN_POINT.USER_PRIVATE_CONFIG)
                    {
                        continue;
                    }
                }
                DevComponents.AdvTree.Node node = CreateNode(item);
                GetSubTree(node, funs);
                root.Nodes.Add(node);
            }
        }
        public override void OnClick()
        {
            //设置成果库连接信息
            //获取树节点上工程节点的连接IP信息
            DevComponents.AdvTree.Node SelNode = m_Hook.ProjectTree.SelectedNode;
            string NodeType = SelNode.DataKey.ToString().Trim();

            if (EnumTreeNodeType.DATABASE.ToString() == NodeType)
            {
                if (SelNode.Name == "文件连接")
                {
                    XmlElement Ele = SelNode.Tag as XmlElement;
                    if (Ele == null)
                    {
                        frmConSet frmconset = new frmConSet("", "", "", "");
                        frmconset.ShowDialog();
                    }
                    else
                    {
                        string ConType = Ele.GetAttribute("实例名");
                        if (null == ConType || "" == ConType)
                        {
                            string    ip        = Ele.GetAttribute("服务器");
                            string    id        = Ele.GetAttribute("用户");
                            string    password  = Ele.GetAttribute("密码");
                            string    metaConn  = Ele.GetAttribute("MetaDBConn");
                            frmConSet frmconset = new frmConSet(ip, id, password, metaConn);
                            frmconset.ShowDialog();
                        }
                    }
                }
                else if (SelNode.Name == "空间连接")
                {
                }
            }
        }
        private void Populate()
        {
            nodeNewTables.Nodes.Clear();
            advTreeTables.BeginUpdate();

            try
            {
                // Fetch all schemas for
                IDatabaseLoader loader = FormDatabase.Instance.CreateDatabaseLoader();
                IDatabase newDb = loader.LoadDatabase(loader.DatabaseObjectsToFetch, null);

                foreach (var schema in newDb.Tables.Select(s => s.Schema).Distinct().Where(s => !ExistingSchemas.Contains(s)).OrderBy(s => s))
                {
                    Node schemaNode = new Node(schema)
                        {
                            CheckBoxVisible = true,
                            Checked = false
                        };
                    nodeNewTables.Nodes.Add(schemaNode);

                    foreach (var table in newDb.Tables.Where(t => t.Schema == schema).Select(t => t.Name).OrderBy(t => t))
                    {
                        Node tableNode = new Node(table)
                        {
                            CheckBoxVisible = true,
                            Checked = false
                        };
                        schemaNode.Nodes.Add(tableNode);
                    }
                }
            }
            finally
            {
                advTreeTables.EndUpdate();
            }
        }
Beispiel #30
0
        /// <summary>
        /// 根據總時數更新班級列表,同時考量到關鍵字搜尋
        /// </summary>
        private void RefreshByTotalHour(string idWhom)
        {
            int Total = 0;

            //根據分課的總時數進行分類
            SortedDictionary<int, List<string>> TotalWhoms = new SortedDictionary<int, List<string>>();

            foreach (Class Whom in schLocal.Classes)
            {
                if (Whom.Name.Equals("無"))
                    continue;

                int TotalHour = Whom.TotalHour;

                if (!TotalWhoms.ContainsKey(TotalHour))
                    TotalWhoms.Add(TotalHour, new List<string>());

                if (IsAddWhom(Whom.Name))
                    if (!TotalWhoms[TotalHour].Contains(Whom.ClassID))
                        TotalWhoms[TotalHour].Add(Whom.ClassID);
            }

            nodeTree.Nodes.Clear();

            Node nodeRoot = new Node("所有班級");
            nodeRoot.TagString = "所有班級";

            Node nodeNull = new Node("無班級");
            nodeNull.TagString = "無";

            nodeTree.Nodes.Add(nodeRoot);
            nodeTree.Nodes.Add(nodeNull);

            foreach (int vTotalHour in TotalWhoms.Keys.ToList().OrderByDescending(x => x))
            {
                Node nodeTotalHour = new Node("" + vTotalHour);
                List<string> Names = new List<string>();

                foreach (string vWhomID in TotalWhoms[vTotalHour])
                {
                    if (schLocal.Classes.Exists(vWhomID))
                    {
                        Class whomPaint = schLocal.Classes[vWhomID];

                        if (whomPaint.TotalHour > 0)
                        {
                            int UnAllocHour = whomPaint.TotalHour - whomPaint.AllocHour;

                            Node nodeWhom = new Node(whomPaint.Name + "(" + UnAllocHour + "/" + whomPaint.TotalHour + ")");
                            nodeWhom.TagString = whomPaint.ClassID;
                            Names.Add(whomPaint.ClassID);
                            nodeTotalHour.Nodes.Add(nodeWhom);
                            Total++;
                        }
                    }
                }

                if (nodeTotalHour.Nodes.Count > 0)
                {
                    nodeTotalHour.Text = nodeTotalHour.Text + "(" + nodeTotalHour.Nodes.Count + ")";
                    nodeTotalHour.TagString = string.Join(";", Names.ToArray());
                    nodeRoot.Nodes.Add(nodeTotalHour);
                    nodeRoot.Expand();
                }
            }

            nodeRoot.Text = nodeRoot.Text + "(" + schLocal.Classes.HasTotalHourCount + ")";
            nodeRoot.ExpandAll();
        }
Beispiel #31
0
        /// <summary>
        /// 根據學校更新班級列表,同時考量到關鍵字搜尋
        /// </summary>
        private void RefreshBySchool(string idWhom)
        {
            int Total = 0;

            //根據分課的總時數進行分類
            SortedDictionary<string, List<string>> TotalClasses = new SortedDictionary<string, List<string>>();

            foreach (Class Class in schLocal.Classes)
            {
                if (Class.Name.Equals("無"))
                    continue;

                string[] ClassIDs = Class.ClassID.Split(new char[] { ',' });

                string DSNS = ClassIDs[0];

                string SchoolName = DSNS;

                if (Global.AvailDSNSNames != null)
                {
                    SchoolDSNSName School = Global.AvailDSNSNames
                    .Find(x => x.DSNSName.Equals(DSNS));

                    if (School != null)
                        SchoolName = School.SchoolName;
                }

                if (!TotalClasses.ContainsKey(SchoolName))
                        TotalClasses.Add(SchoolName, new List<string>());

                    if (IsAddWhom(Class.Name))
                        if (!TotalClasses[SchoolName].Contains(Class.ClassID))
                            TotalClasses[SchoolName].Add(Class.ClassID);
            }

            nodeTree.Nodes.Clear();

            //Node nodeRoot = new Node("所有班級");
            //nodeRoot.TagString = "所有班級";

            //Node nodeNull = new Node("無班級");
            //nodeNull.TagString = "無";

            //nodeTree.Nodes.Add(nodeRoot);
            //nodeTree.Nodes.Add(nodeNull);

            foreach (string School in TotalClasses.Keys.ToList().OrderByDescending(x => x))
            {
                Node nodeTotalHour = new Node("" + School);
                List<string> Names = new List<string>();

                TotalClasses[School].Sort();

                foreach (string vWhomID in TotalClasses[School])
                {
                    if (schLocal.Classes.Exists(vWhomID))
                    {
                        Class whomPaint = schLocal.Classes[vWhomID];

                        if (whomPaint.TotalHour > 0)
                        {
                            int UnAllocHour = whomPaint.TotalHour - whomPaint.AllocHour;

                            Node nodeWhom = new Node(whomPaint.Name + "(" + UnAllocHour + "/" + whomPaint.TotalHour + ")");
                            nodeWhom.TagString = whomPaint.ClassID;
                            Names.Add(whomPaint.ClassID);
                            nodeTotalHour.Nodes.Add(nodeWhom);
                            Total++;
                        }
                    }
                }

                if (nodeTotalHour.Nodes.Count > 0)
                {
                    nodeTotalHour.Text = nodeTotalHour.Text + "(" + nodeTotalHour.Nodes.Count + ")";
                    nodeTotalHour.TagString = string.Join(";", Names.ToArray());
                    nodeTotalHour.Expand();

                    nodeTree.Nodes.Add(nodeTotalHour);

                    //nodeRoot.Nodes.Add(nodeTotalHour);
                    //nodeRoot.Expand();
                }
            }

            //nodeRoot.Text = nodeRoot.Text + "(" + schLocal.Classes.HasTotalHourCount + ")";
            //nodeRoot.ExpandAll();
        }
Beispiel #32
0
        /// <summary>
        /// 根據班級名稱更新班級列表,同時考量到關鍵字搜尋
        /// </summary>
        private void RefreshByName(string idWhom)
        {
            //根據分課的名稱進行分類
            SortedDictionary<string, string> Names = new SortedDictionary<string, string>();

            foreach (Class Whom in schLocal.Classes)
            {
                int TotalHour = Whom.TotalHour;

                //若班級名稱不在字典中則新增
                if (!Names.ContainsKey(Whom.Name))
                    Names.Add(Whom.Name,Whom.ClassID);
            }

            nodeTree.Nodes.Clear();

            Node nodeAll = new Node("所有班級");
            nodeAll.TagString = "所有班級";

            Node nodeNull = new Node("無班級");
            nodeNull.TagString = "無";

            nodeTree.Nodes.Add(nodeAll);
            nodeTree.Nodes.Add(nodeNull);

            foreach (string WhomName in Names.Keys)
            {
                if (WhomName.Equals("無"))
                    continue;

                if (IsAddWhom(WhomName))
                {
                    Class whomPaint = schLocal.Classes[Names[WhomName]];

                    if (whomPaint.TotalHour > 0)
                    {
                        int UnAllocHour = whomPaint.TotalHour - whomPaint.AllocHour;
                        Node nodeWhom = new Node(whomPaint.Name + "(" + UnAllocHour + "/" + whomPaint.TotalHour + ")");
                        nodeWhom.TagString = whomPaint.ClassID;
                        nodeAll.Nodes.Add(nodeWhom);
                    }
                }
            }

            nodeAll.Text = nodeAll.Text + "(" + schLocal.Classes.HasTotalHourCount + ")";
            nodeAll.Expand();
        }
Beispiel #33
0
        /// <summary>
        /// 根據年級更新班級表,同時考量到關鍵字搜尋
        /// </summary>
        private void GradeYear(string idWhom)
        {
            int Total = 0;

            //根據分課的年級進行分類
            SortedDictionary<string, List<string>> GradeYearWhoms = new SortedDictionary<string, List<string>>();

            foreach (Class vWhom in schLocal.Classes)
            {
                //取得年級
                string GradeYear = vWhom.GradeYear;

                //若年級名稱不在字典中則新增
                if (!GradeYearWhoms.ContainsKey(GradeYear))
                    GradeYearWhoms.Add(GradeYear, new List<string>());

                if (IsAddWhom(vWhom.ClassID))
                    if (!GradeYearWhoms[GradeYear].Contains(vWhom.ClassID))
                        GradeYearWhoms[GradeYear].Add(vWhom.ClassID);
            }

            nodeTree.Nodes.Clear();

            Node nodeRoot = new Node("所有年級");
            nodeRoot.TagString = "所有年級";
            Node nodeNull = new Node("無班級");
            nodeNull.TagString = "無";

            nodeTree.Nodes.Add(nodeRoot);
            nodeTree.Nodes.Add(nodeNull);

            foreach (string GradeYear in GradeYearWhoms.Keys)
            {
                Node nodeGradeYear = new Node(GradeYear);
                List<string> Names = new List<string>();

                foreach (string WhomID in GradeYearWhoms[GradeYear])
                {
                    if (schLocal.Classes.Exists(WhomID))
                    {
                        Class whomPaint = schLocal.Classes[WhomID];

                        if (whomPaint.TotalHour > 0)
                        {
                            int UnAllocHour = whomPaint.TotalHour - whomPaint.AllocHour;

                            Node nodeWho = new Node(whomPaint.Name + "(" + UnAllocHour + "/" + whomPaint.TotalHour + ")");
                            nodeWho.TagString = whomPaint.ClassID;
                            nodeGradeYear.Nodes.Add(nodeWho);
                            Names.Add(whomPaint.ClassID);
                            Total++;
                        }
                    }
                }

                if (nodeGradeYear.Nodes.Count > 0)
                {
                    nodeGradeYear.Text = nodeGradeYear.Text + "(" + nodeGradeYear.Nodes.Count + ")";
                    nodeGradeYear.TagString = string.Join(";", Names.ToArray());
                    nodeRoot.Nodes.Add(nodeGradeYear);
                    nodeRoot.Expand();
                }
            }

            nodeRoot.Text = nodeRoot.Text + "(" + schLocal.Classes.HasTotalHourCount + ")";
            nodeRoot.ExpandAll();
        }
 private void SetNodeDirty(Node node, bool dirty)
 {
     if (dirty)
         node.Text = "<b>" + node.Name + "</b>";
     else
         node.Text = node.Name;
 }
        private Node FindOrCreateNamespaceNode(string ns, NodeCollection collection)
        {
            var node = FindFirstNodeNamed(ns, collection);

            if (node == null)
            {
                node = new Node { Text = ns, Name = ns };
                collection.Add(node);
            }

            return node;
        }
        private Node CreateVirtualPropertyNode(UserOption virtualProperty)
        {
            var vpNode = new Node { Text = virtualProperty.VariableName, Name = virtualProperty.VariableName, Tag = virtualProperty };
            vpNode.Style = virtualPropertyNodeStyle;

            var defaultValueNode = new Node
                                    {
                                        Text = "Default Value Function",
                                        Name = DefaultValueNodeName,
                                        Tag = DefaultValueTag
                                    };

            var validatorNode = new Node
                                    {
                                        Text = "Validator Function",
                                        Name = ValidatorFunctionNodeName,
                                        Tag = ValidationTag
                                    };

            var displayToUserNode = new Node
                                {
                                    Text = "Display To User Function",
                                    Name = DisplayToUserFunctionNodeName,
                                    Tag = DisplayToUserTag
                                };

            vpNode.Nodes.Add(defaultValueNode);
            vpNode.Nodes.Add(validatorNode);
            vpNode.Nodes.Add(displayToUserNode);
            virtualPropertyNodes.Add(virtualProperty, vpNode);
            return vpNode;
        }
        private void CreateVirtualPropertiesNodes(IEnumerable<UserOption> properties, Node node)
        {
            foreach (var virtualProperty in properties)
            {
                Node vpNode = CreateVirtualPropertyNode(virtualProperty);

                node.Nodes.Add(vpNode);
            }
        }
        /// <summary>
        /// 把資料填入AdvTree
        /// </summary>
        /// <param name="items"></param>
        private void FillAdvTreeItem(GraduationPlanInfoCollection items)
        {
            string noSchoolYear = "未分類";
            Dictionary <string, DevComponents.AdvTree.Node> itemNodes = new Dictionary <string, DevComponents.AdvTree.Node>();

            // 先根據學年度分類
            #region 根據學年度分類
            foreach (GraduationPlanInfo item in items)
            {
                string schoolYear = item.SchoolYear;
                if (string.IsNullOrEmpty(item.SchoolYear))
                {
                    schoolYear = noSchoolYear;
                }

                if (!itemNodes.ContainsKey(schoolYear))
                {
                    itemNodes.Add(schoolYear, new DevComponents.AdvTree.Node());
                    itemNodes[schoolYear].Text      = (schoolYear == noSchoolYear) ? noSchoolYear : schoolYear + "學年度";
                    itemNodes[schoolYear].TagString = (schoolYear == noSchoolYear) ? "" : schoolYear;
                }

                DevComponents.AdvTree.Node childNode = new DevComponents.AdvTree.Node();

                childNode.Tag  = item;
                childNode.Text = item.TrimName;
                childNode.Name = item.ID;

                if (_AdvTreeExpandStatus.ContainsKey(itemNodes[schoolYear].TagString))
                {
                    itemNodes[schoolYear].Expanded = _AdvTreeExpandStatus[itemNodes[schoolYear].TagString];
                }

                itemNodes[schoolYear].Nodes.Add(childNode);

                _InfoDictionary.Add(item, childNode);
            }
            #endregion 根據學年度分類

            // 針對學年度排序
            #region 針對學年度排序
            List <string> sortedKey = itemNodes.Keys.ToList <string>();
            sortedKey.Sort(delegate(string key1, string key2)
            {
                if (key1 == "未分類")
                {
                    return(1);
                }
                if (key2 == "未分類")
                {
                    return(-1);
                }

                string sort1 = key1.PadLeft(10, '0');
                string sort2 = key2.PadLeft(10, '0');
                return(sort2.CompareTo(sort1));
            });
            #endregion 針對學年度排序

            // 把結果填入畫面
            #region 把結果填入畫面
            advTree1.BeginUpdate();
            advTree1.Nodes.Clear();
            foreach (string key in sortedKey)
            {
                itemNodes[key].Nodes.Sort();
                advTree1.Nodes.Add(itemNodes[key]);
            }

            if (_AdvTreeExpandStatus.Count == 0)
            {
                if (advTree1.Nodes.Count > 0)
                {
                    advTree1.Nodes[0].Expand();
                }
            }

            advTree1.EndUpdate();
            #endregion 把結果填入畫面

            if (_SelectItem != null)
            {
                advTree1.SelectedNode = _SelectItem;
            }
        }
		/// <summary>
		/// Default constructor.
		/// </summary>
		/// <param name="action">Default action</param>
		/// <param name="node">Default node.</param>
		public AdvTreeNodeCancelEventArgs(eTreeAction action, Node node):base(action,node)
		{
		}
Beispiel #40
0
        /// <summary>
        /// 根據未排時數更新班級列表,同時考量到關鍵字搜尋
        /// </summary>
        private void RefreshByUnAlloc(string idWho)
        {
            int Total = 0;

            //根據分課的未排時數進行分類
            SortedDictionary<int, List<string>> UnAllocWhos = new SortedDictionary<int, List<string>>();

            foreach (Class Whom in schLocal.Classes)
            {
                if (Whom.Name.Equals("無"))
                    continue;

                int UnAlloc = Whom.TotalHour - Whom.AllocHour;

                //若未排時數不在字典中則新增
                if (!UnAllocWhos.ContainsKey(UnAlloc))
                    UnAllocWhos.Add(UnAlloc, new List<string>());

                if (IsAddWhom(Whom.ClassID))
                    if (!UnAllocWhos[UnAlloc].Contains(Whom.ClassID))
                        UnAllocWhos[UnAlloc].Add(Whom.ClassID);
            }

            nodeTree.Nodes.Clear();

            Node nodeRoot = new Node("所有班級");
            nodeRoot.TagString = "所有班級";

            Node nodeNull = new Node("無班級");
            nodeNull.TagString = "無";

            nodeTree.Nodes.Add(nodeRoot);
            nodeTree.Nodes.Add(nodeNull);

            foreach (int vUnAlloc in UnAllocWhos.Keys.ToList().OrderByDescending(x => x))
            {
                Node UnAlloc = new Node("" + vUnAlloc);
                List<string> Names = new List<string>();

                foreach (string vWhomID in UnAllocWhos[vUnAlloc])
                {
                    if (schLocal.Classes.Exists(vWhomID))
                    {
                        Class whomPaint = schLocal.Classes[vWhomID];

                        if (whomPaint.TotalHour > 0)
                        {
                            int UnAllocHour = whomPaint.TotalHour - whomPaint.AllocHour;

                            Node nodeWhom = new Node(whomPaint.Name + "(" + UnAllocHour + "/" + whomPaint.TotalHour + ")");
                            nodeWhom.TagString = whomPaint.ClassID;
                            Names.Add(whomPaint.ClassID);
                            UnAlloc.Nodes.Add(nodeWhom);
                            Total++;
                        }
                    }
                }

                if (UnAlloc.Nodes.Count > 0)
                {
                    UnAlloc.Text = UnAlloc.Text + "(" + UnAlloc.Nodes.Count + ")";
                    UnAlloc.TagString = string.Join(";", Names.ToArray());
                    nodeRoot.Nodes.Add(UnAlloc);
                    nodeRoot.Expand();
                }
            }

            nodeRoot.Text = nodeRoot.Text + "(" + schLocal.Classes.HasTotalHourCount + ")";
            nodeRoot.ExpandAll();
        }
Beispiel #41
0
        public static string buildFromNodeContext(AdvTree NodeTree, List <CAAC_LawLibrary.Entity.Node> nodes)
        {
            StringBuilder contentBuilder = new StringBuilder();

            contentBuilder.Append("<html><head>");
            contentBuilder.Append("<script>function btnclick(nodeId,tagLabelType,selectedText,text){window.external.CallFunction(nodeId,tagLabelType,selectedText,text);}</script>");
            contentBuilder.Append("<link rel=\"stylesheet\" href=\"" + Environment.CurrentDirectory + "\\CSS\\mystyle.css\">");
            contentBuilder.Append("</head><body>");
            DevComponents.AdvTree.Node perTreeNode = null;
            foreach (CAAC_LawLibrary.Entity.Node node in nodes)
            {
                DevComponents.AdvTree.Node treeNode = new DevComponents.AdvTree.Node();
                treeNode.Text = node.nodeNumber == string.Empty ? node.title : node.nodeNumber + "." + node.title;
                treeNode.Tag  = node;
                //添加标题关系
                string nodeClass = string.Empty;
                string nodeDef   = string.Empty;
                string nodeKey   = string.Empty;
                string nodeRef   = string.Empty;
                if (!string.IsNullOrEmpty(node.nodeClass))
                {
                    nodeClass = getTitleButtonHtml("class", node.Id, node.title, node.nodeClass);
                }
                if (!string.IsNullOrEmpty(node.nodeDef))
                {
                    nodeDef = getTitleButtonHtml("define", node.Id, node.title, node.nodeDef);
                }
                if (!string.IsNullOrEmpty(node.nodeKey))
                {
                    nodeKey = getTitleButtonHtml("key", node.Id, node.title, node.nodeKey);
                }
                if (!string.IsNullOrEmpty(node.nodeRef))
                {
                    nodeRef = getTitleButtonHtml("ref", node.Id, node.title, node.nodeRef);
                }
                string btnTag = getContentButtonHtml("征", node.Id, "", convertGTLT(node.title));
                btnTag += getContentButtonHtml("评", node.Id, "", convertGTLT(node.title));
                string        realContent = Global.online ? node.content : node.offlineContent.Replace("CurrentLoginUser", Global.user.Id).Replace("CurrentApplicationPath", Environment.CurrentDirectory);//将离线内容中的CurrentApplicationPath替换为应用程序执行路径,CurrentLoginUser替换为当前用户id,用于加载离线图片
                List <string> list        = realContent.Split(new string[] { "</s>" }, StringSplitOptions.RemoveEmptyEntries).ToList();
                foreach (string part in list)
                {
                    //添加正文关系
                    if (part.Contains("<s data-obj="))
                    {
                        string s            = part.Substring(part.IndexOf("<s data-obj="));
                        string selectedText = s.Substring(s.IndexOf(">") + 1);
                        //string stringToReplace = s.Substring(0,s.IndexOf(">") + 1);
                        int    sIndex     = s.IndexOf("\"") + 1;
                        int    eIndex     = s.LastIndexOf("\"");
                        string dataObject = string.Empty;
                        if (eIndex > sIndex)
                        {
                            dataObject = s.Substring(sIndex, eIndex - sIndex);
                            List <string> kv = dataObject.Split(new string[] { "-" }, StringSplitOptions.RemoveEmptyEntries).ToList();
                            if (kv.Count > 1)
                            {
                                string buttonHtml = getContentButtonHtml(kv[0], node.Id, selectedText, kv[1]);
                                realContent = realContent.Replace(s, buttonHtml);
                            }
                        }
                    }
                }

                if (node.nodeNumber == string.Empty && node.title == string.Empty)//如果标题和标题号都为空,就直接显示正文
                {
                    contentBuilder.Append(realContent);
                }
                else
                {
                    contentBuilder.Append("<p style=\"text - align: center; \" " + getStyle(node.nodeLevel) + ">");//按照节点级别添加样式
                    contentBuilder.Append((node.nodeNumber == string.Empty ? convertGTLT(node.title) : node.nodeNumber + "." + convertGTLT(node.title)) + nodeClass + nodeDef + nodeKey + nodeRef + btnTag + Environment.NewLine + realContent + Environment.NewLine);
                    contentBuilder.Append("</p>");
                }


                if (perTreeNode == null)//第一个节点
                {
                    treeNode.Image = global::CAAC_LawLibrary.Properties.Resources.Folder;
                    NodeTree.Nodes.Add(treeNode);
                }
                else
                {
                    if (node.nodeLevel == 1)//如果是一级节点,直接加到树,图标为文件夹
                    {
                        treeNode.Image = global::CAAC_LawLibrary.Properties.Resources.Folder;
                        NodeTree.Nodes.Add(treeNode);
                    }
                    else
                    {
                        //如果当前节点比上一节点nodeLevel大,说明是上一节点的子节点,此时将当前节点加入上一节点的子节点,且将上一节点图标设为文件夹
                        if (node.nodeLevel > (perTreeNode.Tag as CAAC_LawLibrary.Entity.Node).nodeLevel)
                        {
                            treeNode.Image = global::CAAC_LawLibrary.Properties.Resources.Document;
                            perTreeNode.Nodes.Add(treeNode);
                            perTreeNode.Image = global::CAAC_LawLibrary.Properties.Resources.Folder;
                        }
                        //如果当前节点和上一节点nodeLevel相同,说明是上一节点的兄弟节点,此时将当前节点加入上一节点的父节点
                        else if (node.nodeLevel == (perTreeNode.Tag as CAAC_LawLibrary.Entity.Node).nodeLevel)
                        {
                            treeNode.Image = global::CAAC_LawLibrary.Properties.Resources.Document;
                            perTreeNode.Parent.Nodes.Add(treeNode);
                        }
                        else
                        {
                            treeNode.Image = global::CAAC_LawLibrary.Properties.Resources.Document;
                            int levelDis = (perTreeNode.Tag as CAAC_LawLibrary.Entity.Node).nodeLevel - node.nodeLevel;
                            if (levelDis == 1)
                            {
                                perTreeNode.Parent.Parent.Nodes.Add(treeNode);
                            }
                            if (levelDis == 2)
                            {
                                perTreeNode.Parent.Parent.Parent.Nodes.Add(treeNode);
                            }
                            if (levelDis == 3)
                            {
                                perTreeNode.Parent.Parent.Parent.Parent.Nodes.Add(treeNode);
                            }
                        }
                    }
                }

                perTreeNode = treeNode;
            }
            contentBuilder.Append("</body>");
            string content = contentBuilder.ToString();

            return(content);
        }
Beispiel #42
0
        /// <summary>
        /// 单击节点,跳转到设备所在的位置。
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void advTreeMeshList_NodeClick(object sender, TreeNodeMouseEventArgs e)
        {
            DevComponents.AdvTree.Node selectNode = advTreeMeshList.SelectedNode;

            //设备不在线,不执行后续操作
            if (selectNode == null || selectNode.Level != 1)
            {
                return;
            }

            Cell selectCell = selectNode.GetCellAt(e.X, e.Y);

            if (selectCell == null)
            {
                return;
            }

            if (selectNode.Level == 1 && selectCell.Images != null)
            {
                MeshAllInfo mai = (MeshAllInfo)selectNode.Tag;
                GPSInfo     vp  = mai.MeshGPSInfo;
                //GPS坐标为(0,0),不能执行定位操作
                if (selectCell.Images.ImageIndex == 9 && BuddyBMapControl != null)
                {//点中了离线设备
                    BuddyBMapControl.SelectMeshDevice(null);
                }
                if (selectCell.Images.ImageIndex == 10 &&
                    vp.Lat != 0 && vp.Lon != 0 &&
                    BuddyBMapControl != null)
                {
                    //地图上跳转到设备所在的位置
                    BuddyBMapControl.Center = new LatLngPoint(vp.Lon, vp.Lat);
                    BuddyBMapControl.Locate(false);
                    //选中目标Mesh设备
                    BuddyBMapControl.SelectMeshDevice(mai.BuddyBMeshPoint);
                }
                else if (selectCell.Images.ImageIndex == 11)
                {
                    MessageBox.Show("设备不在线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else if (selectCell.Images.ImageIndex == 12 && selectNode.Cells[1].Text.Equals("在线"))
                {
                    if (BuddyBMapControl != null)
                    {
                        BuddyBMapControl_OnOpenVideo(mai.BuddyBMeshPoint);
                    }
                    else if (BuddyGrid != null)
                    {
                        VideoInject inject = new VideoInject(mFormMain.AllApplicationSetting[ApplicationSettingKey.VideoServerIPV4],
                                                             mFormMain.AllApplicationSetting[ApplicationSettingKey.VideoServerUserName],
                                                             mFormMain.AllApplicationSetting[ApplicationSettingKey.VideoServerPassword]);
                        Panel   panel   = BuddyGrid.GetNextAvailablePanel();
                        Process process = inject.injectPanel(panel,
                                                             mFormMain.GetVideoFullScreenLocation(),
                                                             BuddyGrid.GetFullScreenPanel(),
                                                             mai.PlanInfo.Model265ID, "0");
                        BuddyGrid.BindPanelProcess(panel, process);
                        mFormMain.VideoProcesses.Add(process);
                        logger.Info(string.Format("在第{0}个Panel中打开了视频。", panel.Tag.ToString()));
                    }
                }
                else if (selectCell.Images.ImageIndex == 13 && BuddyBMapControl != null)
                {
                    bool isDrawingRoute = (bool)selectCell.Tag;
                    if (isDrawingRoute)
                    {//已经绘制,再次点击的时候隐藏已绘制的轨迹
                        BuddyBMapControl.DeleteDeviceRoute(mai.PlanInfo.Model265ID);
                        selectCell.Tag = false;
                    }
                    else
                    {
                        //在地图上绘制轨迹记录
                        FGPSTimeSelect fgpsts = new FGPSTimeSelect();
                        fgpsts.StartDateTime = DateTime.Today.Subtract(new TimeSpan(1, 0, 0, 0));
                        fgpsts.StopDateTime  = DateTime.Today;
                        if (DialogResult.OK == fgpsts.ShowDialog() && BuddyBMapControl != null)
                        {
                            BMeshRoute bmr = FileUtils.ReadMeshRouteFromGPSLogs(
                                mai.PlanInfo.Model265ID,
                                fgpsts.StartDateTime, fgpsts.StopDateTime);
                            if (bmr.DeviceLocationList.Count > 0)
                            {
                                BuddyBMapControl.AddDeviceRoute(bmr);
                                //地图上跳转到设备所在的位置
                                BuddyBMapControl.Center = bmr.DeviceLocationList[0];
                                BuddyBMapControl.Locate(false);
                                BuddyBMapControl.Zoom = 16;
                                selectCell.Tag        = true; //标识已经绘制了路径
                                logger.Info(string.Format("查看{0}设备的GPS轨迹记录,供{1}条GPS记录。",
                                                          mai.PlanInfo.Model265ID, bmr.DeviceLocationList.Count));
                            }
                            else
                            {
                                MessageBox.Show("无历史轨迹记录。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                            }
                        }
                    }
                }
            }
        }
Beispiel #43
0
        /// <summary>
        /// 重新加载界面数据
        /// </summary>
        private void ReloadTree()
        {
            if (m_table == null)
            {
                try
                {
                    if (conn.State == ConnectionState.Closed)
                    {
                        conn.Open();
                    }
                    string sqlString = tableName;
                    m_table = GetDataTable(sqlString);
                }
                catch (SqlException ex)
                {
                    MessageBox.Show("在读取数据表时产生sql[" + tableName + "]异常:" + ex.ToString());
                }
                finally
                {
                    if (conn.State == ConnectionState.Open)
                    {
                        conn.Close();
                    }
                }
            }

            advTree1.Nodes.Clear();
            string[] fields = classifyField.Split(new char[] { ',' });
            DevComponents.AdvTree.NodeCollection nodes;
            DevComponents.AdvTree.Node           newNode;
            bool find = false;

            foreach (DataRow row in m_table.Rows)
            {
                nodes = advTree1.Nodes;

                //支持过滤器
                if (filter != "")
                {
                    string s = row[fields[fields.Length - 1].ToString()].ToString();
                    if (s.ToLower().IndexOf(filter.ToLower()) == -1 &&
                        Chinese2Spell.GetHeadOfChs(s).ToLower().IndexOf(filter.ToLower()) == -1
                        )
                    {
                        continue;
                    }
                }

                for (int i = 0; i < fields.Length; i++)
                {
                    string field = fields[i];
                    find = false;

                    foreach (DevComponents.AdvTree.Node node in nodes)
                    {
                        if (node.Text == row[field].ToString())
                        {
                            nodes = node.Nodes;
                            find  = true;
                            break;
                        }
                    }

                    if (!find)
                    {
                        newNode      = new DevComponents.AdvTree.Node();
                        newNode.Text = row[field].ToString();
                        nodes.Add(newNode);
                        nodes = newNode.Nodes;

                        if (i == fields.Length - 1)
                        {
                            newNode.Tag = row[returnField].ToString();
                            //if(newNode.Tag.ToString() == oldValue)
                            //{
                            //    selectedNode = newNode;
                            //}
                        }
                    }
                }
            }

            // 选中旧值代表的树结点
            //advTree1.SelectedNode = selectedNode;
            //if(selectedNode != null)
            //{
            //    advTree1.SelectedNode.EnsureVisible();
            //}
        }
Beispiel #44
0
        public void Fill(DatabaseMergeResult results, IDatabase db1, IDatabase db2)
        {
            if (InvokeRequired)
            {
                Invoke(new MethodInvoker(() => Fill(results, db1, db2)));
                return;
            }
            DB1 = db1;
            DB2 = db2;

            advTreeTables.BeginUpdate();
            nodeNewEntities.Nodes.Clear();
            nodeModifiedEntities.Nodes.Clear();
            nodeRemovedEntities.Nodes.Clear();

            nodeNewEntities.Checked = true;
            nodeModifiedEntities.Checked = true;
            nodeRemovedEntities.Checked = false;

            try
            {
                #region Database-only

                foreach (TableAdditionOperation addedTableOperation in results.TableOperations.Where(r => r is TableAdditionOperation))
                {
                    Node node = new Node(string.Format("{0}.{1}", addedTableOperation.Object.Schema, addedTableOperation.Object.Name));
                    node.Tag = addedTableOperation;
                    node.CheckBoxVisible = true;
                    node.Checked = false;
                    node.ImageIndex = IMG_NEW;
                    nodeRemovedEntities.Nodes.Add(node);
                }

                #endregion

                #region Model-only
                IList<SynchroGrid.SynchroCanvas.TableMatch> MatchesModelOnly = new List<SynchroGrid.SynchroCanvas.TableMatch>();

                foreach (TableRemovalOperation removedTableOperation in results.TableOperations.Where(r => r is TableRemovalOperation))
                {
                    Node node = new Node(string.Format("{0}.{1}", removedTableOperation.Object.Schema, removedTableOperation.Object.Name));
                    node.Tag = removedTableOperation;
                    node.CheckBoxVisible = true;
                    node.Checked = true;
                    node.ImageIndex = IMG_REMOVED;
                    nodeNewEntities.Nodes.Add(node);
                }

                #endregion

                #region Changes
                HashSet<string> changedTables = new HashSet<string>();

                #region Get tables with changes
                foreach (var result in results.ColumnOperations)
                    changedTables.Add(string.Format("{0}.{1}", result.Object.Parent.Schema, result.Object.Parent.Name));

                foreach (var result in results.IndexOperations)
                    changedTables.Add(string.Format("{0}.{1}", result.Object.Parent.Schema, result.Object.Parent.Name));

                foreach (var result in results.KeyOperations)
                    changedTables.Add(string.Format("{0}.{1}", result.Object.Parent.Schema, result.Object.Parent.Name));

                //foreach (var result in results.RelationshipOperations)
                //    changedTables.Add(string.Format("{0}.{1}", result.Object.PrimaryTable.Schema, result.Object.PrimaryTable.Name));

                #endregion

                foreach (string changedTable in changedTables)
                {
                    Node node = new Node(changedTable);
                    node.Tag = changedTable;
                    node.CheckBoxVisible = true;
                    node.Checked = true;
                    node.ImageIndex = IMG_CHANGED;
                    nodeModifiedEntities.Nodes.Add(node);

                    #region Columns
                    foreach (ColumnAdditionOperation newColumn in results.ColumnOperations.Where(r => r is ColumnAdditionOperation).Where(c => string.Format("{0}.{1}", c.Object.Parent.Schema, c.Object.Parent.Name) == changedTable))
                    {
                        Node columnnode = new Node(string.Format("Remove column from database: [{0}]", newColumn.Object.Name));
                        columnnode.Tag = newColumn;
                        node.Nodes.Add(columnnode);
                    }
                    foreach (ColumnChangeOperation changedColumn in results.ColumnOperations.Where(r => r is ColumnChangeOperation).Where(c => string.Format("{0}.{1}", c.Object.Parent.Schema, c.Object.Parent.Name) == changedTable))
                    {
                        Node columnnode = new Node(string.Format("Update column in database [{0}]", changedColumn.Object.Name));
                        columnnode.Tag = changedColumn;
                        node.Nodes.Add(columnnode);

                        foreach (string d in changedColumn.Description.Split(','))
                            columnnode.Nodes.Add(new Node(d));
                    }
                    foreach (ColumnRemovalOperation removedColumn in results.ColumnOperations.Where(r => r is ColumnRemovalOperation).Where(c => string.Format("{0}.{1}", c.Object.Parent.Schema, c.Object.Parent.Name) == changedTable))
                    {
                        Node columnnode = new Node(string.Format("Add column to database: [{0}]", removedColumn.Object.Name));
                        columnnode.Tag = removedColumn;
                        node.Nodes.Add(columnnode);
                    }
                    #endregion

                    #region Indexes
                    foreach (IndexAdditionOperation newIndex in results.IndexOperations.Where(r => r is IndexAdditionOperation).Where(c => string.Format("{0}.{1}", c.Object.Parent.Schema, c.Object.Parent.Name) == changedTable))
                    {
                        Node indexNode = new Node(string.Format("Remove index from database: [{0}]", newIndex.Object.Name));
                        indexNode.Tag = newIndex;
                        node.Nodes.Add(indexNode);
                    }
                    foreach (IndexChangeOperation changedIndex in results.IndexOperations.Where(r => r is IndexChangeOperation).Where(c => string.Format("{0}.{1}", c.Object.Parent.Schema, c.Object.Parent.Name) == changedTable))
                    {
                        Node indexNode = new Node(string.Format("Update index in database [{0}]", changedIndex.Object.Name));
                        indexNode.Tag = changedIndex;
                        node.Nodes.Add(indexNode);

                        foreach (string d in changedIndex.Description.Split(','))
                            indexNode.Nodes.Add(new Node(d));
                    }
                    foreach (IndexRemovalOperation removedIndex in results.IndexOperations.Where(r => r is IndexRemovalOperation).Where(c => string.Format("{0}.{1}", c.Object.Parent.Schema, c.Object.Parent.Name) == changedTable))
                    {
                        Node indexNode = new Node(string.Format("Add index to database: [{0}]", removedIndex.Object.Name));
                        indexNode.Tag = removedIndex;
                        node.Nodes.Add(indexNode);
                    }
                    #endregion

                    #region Keys
                    foreach (KeyAdditionOperation newKey in results.KeyOperations.Where(r => r is KeyAdditionOperation).Where(c => string.Format("{0}.{1}", c.Object.Parent.Schema, c.Object.Parent.Name) == changedTable))
                    {
                        Node keyNode = new Node(string.Format("Remove key from database: [{0}]", newKey.Object.Name));
                        keyNode.Tag = newKey;
                        node.Nodes.Add(keyNode);
                    }
                    foreach (KeyChangeOperation changedKey in results.KeyOperations.Where(r => r is KeyChangeOperation).Where(c => string.Format("{0}.{1}", c.Object.Parent.Schema, c.Object.Parent.Name) == changedTable))
                    {
                        Node keyNode = new Node(string.Format("Update key in database [{0}]", changedKey.Object.Name));
                        keyNode.Tag = changedKey;
                        node.Nodes.Add(keyNode);

                        foreach (string d in changedKey.Description.Split(','))
                            keyNode.Nodes.Add(new Node(d));
                    }
                    foreach (KeyRemovalOperation removedKey in results.KeyOperations.Where(r => r is KeyRemovalOperation).Where(c => string.Format("{0}.{1}", c.Object.Parent.Schema, c.Object.Parent.Name) == changedTable))
                    {
                        Node keyNode = new Node(string.Format("Add key to database: [{0}]", removedKey.Object.Name));
                        keyNode.Tag = removedKey;
                        node.Nodes.Add(keyNode);
                    }
                    #endregion

                    #region Relationships
                    //foreach (RelationshipAdditionOperation newRelationship in results.RelationshipOperations.Where(r => r is RelationshipAdditionOperation).Where(c => string.Format("{0}.{1}", c.Object.PrimaryTable.Schema, c.Object.PrimaryTable.Name) == changedTable).Distinct())
                    //{
                    //    Node relationshipNode = new Node(string.Format("Remove relationship from database, with {0}: [{1}]", newRelationship.Object.ForeignTable.Name, newRelationship.Object.Name));
                    //    relationshipNode.Tag = newRelationship;
                    //    node.Nodes.Add(relationshipNode);
                    //}
                    //foreach (RelationshipChangeOperation changedRelationship in results.RelationshipOperations.Where(r => r is RelationshipChangeOperation).Where(c => string.Format("{0}.{1}", c.Object.PrimaryTable.Schema, c.Object.PrimaryTable.Name) == changedTable))
                    //{
                    //    Node relationshipNode = new Node(string.Format("Update relationship in database, with {0}:  [{1}]", changedRelationship.Object.ForeignTable.Name, changedRelationship.Object.Name));
                    //    relationshipNode.Tag = changedRelationship;
                    //    node.Nodes.Add(relationshipNode);

                    //    foreach (string d in changedRelationship.Description.Split(','))
                    //        relationshipNode.Nodes.Add(new Node(d));
                    //}
                    //foreach (RelationshipRemovalOperation removedRelationship in results.RelationshipOperations.Where(r => r is RelationshipRemovalOperation).Where(c => string.Format("{0}.{1}", c.Object.PrimaryTable.Schema, c.Object.PrimaryTable.Name) == changedTable))
                    //{
                    //    Node relationshipNode = new Node(string.Format("Add relationship to database, with {0}: [{1}]", removedRelationship.Object.ForeignTable.Name, removedRelationship.Object.Name));
                    //    relationshipNode.Tag = removedRelationship;
                    //    node.Nodes.Add(relationshipNode);
                    //}
                    #endregion
                }
                #endregion

                nodeNewEntities.Visible = nodeNewEntities.Nodes.Count > 0;
                nodeModifiedEntities.Visible = nodeModifiedEntities.Nodes.Count > 0;
                nodeRemovedEntities.Visible = nodeRemovedEntities.Nodes.Count > 0;

                if (!nodeNewEntities.Visible && !nodeModifiedEntities.Visible && !nodeRemovedEntities.Visible)
                {
                    nodeEmpty.Text = "The database has no changes";
                    nodeEmpty.Visible = true;
                }
                else
                    nodeEmpty.Visible = false;
            }
            finally
            {
                advTreeTables.EndUpdate();
            }
        }
        private void CreateExtensionMethodNodes(Type type, Node node)
        {
            foreach (var method in ExtensionAttributeHelper.GetExtendableMethods(type))
            {
                var methodNode = new Node { Text = method.Name, Name = method.Name, Tag = method };

                string description = ExtensionAttributeHelper.GetExtensionDescription(method);

                if (string.IsNullOrEmpty(description) == false)
                {
                    SetToolTip(methodNode, description);
                }
                node.Nodes.Add(methodNode);

                methodNodes.Add(method, methodNode);
            }
        }
 /// <summary>
 /// Default constructor.
 /// </summary>
 /// <param name="action">Default action</param>
 /// <param name="node">Default node.</param>
 public AdvTreeMultiNodeCancelEventArgs(eTreeAction action, Node[] nodes)
     : base(action, nodes[0])
 {
     Nodes = nodes;
 }
        private Node CreateTypeNode(Type type, IEnumerable<UserOption> virtualProperties)
        {
            var node = new Node { Text = type.Name, Name = type.Name, Tag = type };
            typeNodes.Add(type, node);

            CreateExtensionMethodNodes(type, node);
            CreateVirtualPropertiesNodes(virtualProperties, node);

            return node;
        }