Пример #1
0
        private void tvSample_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
        {
            DataRow row;
            bool    dropOnNewControl = false;

            try
            {
                UI.Hourglass(true);

                TreeViewUtil.DragDrop((TreeView)sender, e, ref dropOnNewControl);

                if (dropOnNewControl)
                {
                    //row = (DataRow)tvSample2.Nodes[0].Tag;
                    //Rules.CommitHierarchy(DBConStr, row.Table.DataSet);
                    row = (DataRow)tvSample.Nodes[0].Tag;
                    Rules.CommitHierarchy(DBConStr, row.Table.DataSet);
                }

                //   this.LoadAllTrees();

                UI.Hourglass(false);
            }
            catch (Exception err) { UI.ShowError(err.Message); }
            finally { UI.Hourglass(false); }
        }
Пример #2
0
        private void tvSample1RightClickNudgeDown(object sender, System.EventArgs e)
        {
            UI.Hourglass(true);

            try
            {
                TreeViewUtil.NudgeDown(tvSample.SelectedNode);
            }
            catch (Exception err) { UI.ShowError(err.Message); }
            finally { UI.Hourglass(false); }
        }
Пример #3
0
        private void tvSample1RightClickDelete(object sender, System.EventArgs e)
        {
            UI.Hourglass(true);

            try
            {
                TreeViewUtil.DeleteNode(tvSample, true);
            }
            catch (Exception err) { UI.ShowError(err.Message); }
            finally { UI.Hourglass(false); }
        }
Пример #4
0
        private void tvSample_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            TreeViewUtil.SetSelectedNodeByPosition(tvSample, e.X, e.Y);

            if (tvSample.SelectedNode == null)
            {
                return;
            }

            if (e.Button == MouseButtons.Right)
            {
                return;
            }
        }
Пример #5
0
        private void InsertNewNode(TreeNode node)
        {
            DataRow   row       = null;
            DataRow   ParentRow = null;
            DataTable dt        = null;
            int       newindex  = 0;

            try
            {
                ParentRow = (DataRow)node.Tag;

                if (ParentRow == null)
                {
                    return;
                }

                newindex = int.Parse(ParentRow["SortOrder"].ToString()) + 1;

                dt = ParentRow.Table;

                row = dt.NewRow();

                row["ObjectID"]           = Guid.NewGuid().ToString();
                row["ObjectTypeID"]       = 1;
                row["ModelID"]            = int.Parse(ParentRow["ModelID"].ToString());
                row["NodeID"]             = Guid.NewGuid().ToString();
                row["ParentNodeID"]       = ParentRow[dt.PrimaryKey[0].ColumnName].ToString();
                row["Description"]        = "New Node";
                row["ForeColor"]          = "#000000";
                row["BackColor"]          = "#FFFFFF";
                row["ImageIndex"]         = 0;
                row["SelectedImageIndex"] = 1;
                row["Checked"]            = true;
                row["ActiveID"]           = 1;
                row["NamedRange"]         = "";
                row["NodeValue"]          = "";
                row["LastUpdateTime"]     = DateTime.Now;
                row["SortOrder"]          = newindex;

                dt.Rows.Add(row);

                node.Nodes.Add(TreeViewUtil.GetTreeNodeFromDataRow(row, "Description"));
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #6
0
        private void LoadTree(TreeView tv, DataSet ds)
        {
            UI.Hourglass(true);

            try
            {
                TreeViewUtil.LoadFromDataSet(tv, ds, "Description");

                if (tv.Nodes.Count > 0)
                {
                    tv.Nodes[0].Expand();
                }
            }
            catch (Exception) { throw; }
            finally
            {
                UI.Hourglass(false);
            }
        }
Пример #7
0
 private void tvSample_DragOver(object sender, System.Windows.Forms.DragEventArgs e)
 {
     TreeViewUtil.DragOver((TreeView)sender, e);
 }