EnsureVisible() public method

public EnsureVisible ( ) : void
return void
Example #1
0
 internal void ShowTreeNode(TreeNode treeNode)
 {
     if (treeNode != null)
     {
         tvHtmlDoc.SelectedNode = treeNode;
         tvHtmlDoc.Focus();
         treeNode.EnsureVisible();
     }
     else {
         MessageBox.Show("Tree: Element was not found");
     }
 }
 /// <summary>
 /// 添加一个节点,并使其可见
 /// </summary>
 /// <param name="treeView"></param>
 /// <param name="newNode"></param>
 /// <param name="parentNode"></param>
 public static void AddTreeNode(TreeView treeView, TreeNode newNode, TreeNode parentNode)
 {
     if (parentNode != null)
     {
         parentNode.Nodes.Add(newNode);
         treeView.SelectedNode = parentNode;
         parentNode.Expand();
         // 让新添加节点可视
     }
     else
     {
         treeView.Nodes.Add(newNode);
         treeView.SelectedNode = newNode;
         newNode.Expand();
     }
     newNode.EnsureVisible();
 }
		/// <summary>
		/// Adds the new logger view as a child of the current view and returns the new view.
		/// </summary>
		/// <param name="text">The text to initialize the view with.</param>
		/// <param name="logger">The logger that this instance is a view of.</param>
		/// <returns></returns>
		public ILoggerView AddNew(string text, LoggerItem logger)
		{
			// Creating a new node.
			TreeNode node = new TreeNode(text) {Checked = true, Tag = logger};

			if (_isRoot)
			{
				_treeView.Nodes.Add(node);
			}
			else
			{
				_node.Nodes.Add(node);
			}

			node.EnsureVisible();

			return new TreeViewLoggerView(_treeView, node);
		}
Example #4
0
        private void mAddItemSales(string vstrRoot)
        {
            string strChild = "";

            System.Windows.Forms.TreeNode oNodex  = null;
            List <AccountsLedger>         oaccLed = accms.GetSalesLedgerTreefromCustomer(strComID, vstrRoot).ToList();

            foreach (AccountsLedger oLed in oaccLed)
            {
                strChild                  = oLed.strLedgerName;
                oNodex                    = tvwGroup.Nodes.Find(mcGROUP_PREFIX + vstrRoot, true)[0].Nodes.Add(mcLEDGER_PREFIX + strChild, strChild, "leaf");
                oNodex.ImageIndex         = 1;
                oNodex.SelectedImageIndex = 1;
                oNodex.EnsureVisible();
                oNodex.ExpandAll();
                oNodex.Expand();
            }
        }
        public void DisplayCourse(Course course)
        {
            var courseNode = new TreeNode(course.Title) { Tag = course };

            foreach (var module in course.Modules)
            {
                var moduleNode = new TreeNode(module.Title) { Tag = module };

                foreach (var lesson in module.Lessons)
                {
                    var lessonNode = new TreeNode(lesson.Title) { Tag = lesson };

                    moduleNode.Nodes.Add(lessonNode);
                }

                courseNode.Nodes.Add(moduleNode);
            }

            treeView1.Nodes.Add(courseNode);
            treeView1.ExpandAll();
            courseNode.EnsureVisible();
        }
        public void RestoreScrollState()
        {
            if (base.Nodes.Count < 1)
            {
                return;
            }

            TreeNode bottomNode = FindClosestPath(bottomPath);
            TreeNode topNode    = FindClosestPath(topPath);

            if (bottomNode != null)
            {
                bottomNode.EnsureVisible();
            }

            if (topNode != null)
            {
                topNode.EnsureVisible();
            }

            // manually scroll all the way to the left
            Win32.Scrolling.scrollToLeft(this);
        }
        internal TreeNode AddToPageDefinitions(WebElementDefinition element)
        {
            var newNode = new TreeNode();
            newNode.Text = element.ToString();
            newNode.Tag = element;

            var action = (MethodInvoker)delegate
            {

                tvWebElements.Nodes[0].Nodes.Add(newNode);
                newNode.EnsureVisible();
            };

            if (tvWebElements.InvokeRequired)
            {
                tvWebElements.Invoke(action);
            }
            else
            {
                action();
            }

            return newNode;
        }
        private void SelectSingleNode( TreeNode node )
        {
            if( node == null )
            {
                return;
            }

            ClearSelectedNodes();
            ToggleNode( node, true );
            node.EnsureVisible();
        }
 public void ReplaceSelectionWith(TreeNode node)
 {
     try
     {
         if (!OnBeforeSingleSelect(node))
             return;
         if (node == null || node.TreeView == null)
             return;
         removePaintFromNodes();
         SelectedNodes.Clear();
         if (node != null)
         {
             SelectedNodes.Add(node);
         }
         paintSelectedNodes();
         CallEvents();
         node.EnsureVisible();
     }
     catch (Exception e) {
         OnError(e);
     }
 }
Example #10
0
 public void SelectNode(TreeNode node)
 {
     node.EnsureVisible();
     _treeView.SelectedNode = node;
 }
Example #11
0
 private void btnAddSep_Click(object sender, EventArgs e) {
     TreeNode selectedNode = treeViewGroup.SelectedNode;
     if((selectedNode != null) && (selectedNode.Level != 2)) {
         TreeNode node = new TreeNode("----------- Separator -----------");
         node.Tag = MIA_GROUPSEP;
         node.ForeColor = SystemColors.GrayText;
         node.ImageKey = node.SelectedImageKey = "noimage";
         treeViewGroup.BeginUpdate();
         if(selectedNode.Level == 1) {
             tnGroupsRoot.Nodes.Insert(selectedNode.Index + 1, node);
         }
         else if(selectedNode.Level == 0) {
             tnGroupsRoot.Nodes.Add(node);
         }
         treeViewGroup.EndUpdate();
         node.EnsureVisible();
     }
 }
Example #12
0
        private void mloadTreeView(int intSttsus)
        {
            string strGroup;


            if (strType != "S" && strType != "M" && strType != "C" & strType != "N")
            {
                frmLabel.Text = "     Chart of Accounts";
                System.Windows.Forms.TreeNode oNodex = null;
                tvwGroup.ImageList = imageList1;
                oNodex             = tvwGroup.Nodes.Add(mcGROUP_PREFIX + "Assets", "Assets", "closed");
                oNodex.Expand();
                oNodex = tvwGroup.Nodes.Add(mcGROUP_PREFIX + "Liabilities", "Liabilities", "closed");
                oNodex.Expand();
                oNodex = tvwGroup.Nodes.Add(mcGROUP_PREFIX + "Income", "Income", "closed");
                oNodex.Expand();
                oNodex = tvwGroup.Nodes.Add(mcGROUP_PREFIX + "Expenses", "Expenses", "closed");
                oNodex.Expand();
                List <AccountdGroup> oogrp = accms.GetAccountsTreeview(strComID).ToList();
                foreach (AccountdGroup ogrp in oogrp)
                {
                    strGroup                  = ogrp.GroupName.ToString();
                    oNodex                    = tvwGroup.Nodes.Find(mcGROUP_PREFIX + ogrp.ParentName.ToString(), true)[0].Nodes.Add(mcGROUP_PREFIX + strGroup, strGroup, "closed");
                    oNodex.ImageIndex         = 0;
                    oNodex.SelectedImageIndex = 0;
                    oNodex.Expand();
                    oNodex.EnsureVisible();
                    mAddItem(strGroup, intSttsus);
                }
            }
            else if (strType == "N")
            {
                frmLabel.Text = "Chart of Cost Center";
                System.Windows.Forms.TreeNode oNodex = null;
                tvwGroup.ImageList = imageList1;
                //oNodex = tvwGroup.Nodes.Add(mcGROUP_PREFIX + "Sundry Debtors", "Sundry Debtors", "closed");
                //oNodex.Expand();
                List <VectorCategory> oogrp = accms.mFillVectorCategory(strComID).ToList();
                foreach (VectorCategory ogrp in oogrp)
                {
                    strGroup                  = ogrp.strVectorcategory.ToString();
                    oNodex                    = tvwGroup.Nodes.Add(mcGROUP_PREFIX + strGroup, ogrp.strVectorcategory, "closed");
                    oNodex.ImageIndex         = 0;
                    oNodex.SelectedImageIndex = 0;
                    oNodex.ExpandAll();
                    oNodex.EnsureVisible();
                    mAddItemCostCenter(strGroup);
                }
            }
            else if (strType == "M")
            {
                frmLabel.Text = "Chart of Medical Representative";
                System.Windows.Forms.TreeNode oNodex = null;
                tvwGroup.ImageList = imageList1;
                oNodex             = tvwGroup.Nodes.Add(mcGROUP_PREFIX + "Sundry Debtors", "Sundry Debtors", "closed");
                oNodex.Expand();
                List <AccountdGroup> oogrp = accms.GetAccountsTreeviewDR(strComID).ToList();
                foreach (AccountdGroup ogrp in oogrp)
                {
                    strGroup = ogrp.GroupName.ToString();
                    oNodex   = tvwGroup.Nodes.Find(mcGROUP_PREFIX + ogrp.ParentName.ToString(), true)[0].Nodes.Add(mcGROUP_PREFIX + strGroup, strGroup, "closed");
                    //oNodex = tvwGroup.Nodes.Add(mcGROUP_PREFIX + strGroup, strGroup, "closed");
                    oNodex.ImageIndex         = 0;
                    oNodex.SelectedImageIndex = 0;
                    oNodex.ExpandAll();
                    oNodex.EnsureVisible();
                    mAddItemMR(strGroup, intSttsus);
                }
            }
            else if (strType == "C")
            {
                frmLabel.Text = "Chart of Sundry Creditors";
                System.Windows.Forms.TreeNode oNodex = null;
                tvwGroup.ImageList = imageList1;
                oNodex             = tvwGroup.Nodes.Add(mcGROUP_PREFIX + "Sundry Creditors", "Sundry Creditors", "closed");
                oNodex.Expand();
                List <AccountdGroup> oogrp = accms.GetAccountsTreeviewCR(strComID).ToList();
                foreach (AccountdGroup ogrp in oogrp)
                {
                    strGroup = ogrp.GroupName.ToString();
                    oNodex   = tvwGroup.Nodes.Find(mcGROUP_PREFIX + ogrp.ParentName.ToString(), true)[0].Nodes.Add(mcGROUP_PREFIX + strGroup, strGroup, "closed");
                    //oNodex = tvwGroup.Nodes.Add(mcGROUP_PREFIX + strGroup, strGroup, "closed");
                    oNodex.ImageIndex         = 0;
                    oNodex.SelectedImageIndex = 0;
                    oNodex.ExpandAll();
                    oNodex.EnsureVisible();
                    mAddItem(strGroup, intSttsus);
                }
            }
            else
            {
                frmLabel.Text = "Doctor/Customer Treeview";
                System.Windows.Forms.TreeNode oNodex = null;
                tvwGroup.ImageList = imageList1;
                List <AccountsLedger> oogrp = accms.GetSalesLedgerTree(strComID).ToList();
                foreach (AccountsLedger ogrp in oogrp)
                {
                    strGroup                  = ogrp.strRepName.ToString();
                    oNodex                    = tvwGroup.Nodes.Add(mcGROUP_PREFIX + strGroup, ogrp.strParentGroup, "closed");
                    oNodex.ImageIndex         = 0;
                    oNodex.SelectedImageIndex = 0;
                    oNodex.ExpandAll();
                    oNodex.EnsureVisible();
                    mAddItemSales(strGroup);
                }
            }
        }
Example #13
0
 public void selectTree(TreeNode node, List<SignalInfo> res)
 {
     node.BackColor = Color.White;
     foreach (SignalInfo si in res) {
         if (node.Name == si.KKS) {
             node.EnsureVisible();
             node.BackColor = Color.DarkGray;
         }
     }
     foreach (TreeNode ch in node.Nodes) {
         selectTree(ch, res);
     }
 }
        protected override void OnDragOver(DragEventArgs drgevent)
        {
            if (!DraggingInProgress)
            {
                drgevent.Effect = DragDropEffects.None;
                return;
            }

            drgevent.Effect = DragDropEffects.Move;

            TreeNode prevDN = _dropNode;
            NodeRelationship prevDNL = _dropNodeLocation;

            // Get actual drop node
            _dropNode = GetNodeAt(PointToClient(new Point(drgevent.X, drgevent.Y)));
            if (_dropNode != null)
            {

                int OffsetY = PointToClient(Cursor.Position).Y - _dropNode.Bounds.Top;

                if (IsFolder(_dropNode))
                {
                    if (OffsetY < (_dropNode.Bounds.Height / 3))
                        _dropNodeLocation = NodeRelationship.ChildGoesAbove;
                    else if (OffsetY > (_dropNode.Bounds.Height * 2 / 3))
                        _dropNodeLocation = NodeRelationship.ChildGoesUnder;
                    else
                        _dropNodeLocation = NodeRelationship.ChildGoesInside;
                }
                else
                {
                    if (OffsetY < (_dropNode.Bounds.Height / 2))
                        _dropNodeLocation = NodeRelationship.ChildGoesAbove;
                    else
                        _dropNodeLocation = NodeRelationship.ChildGoesUnder;
                }

                //Check if we are allowed to put this into that
                if (!IsAllowedToHaveRelation(_dropNode, _dragNode, _dropNodeLocation))
                {
                    drgevent.Effect = DragDropEffects.None;
                    _dropNodeLocation = NodeRelationship.Null;
                }

                if (_dropNode == _dragNode && _dropNodeLocation == NodeRelationship.ChildGoesInside)
                {
                    drgevent.Effect = DragDropEffects.None;
                    _dropNodeLocation = NodeRelationship.Null;
                }

                // Avoid that drop node is child of drag node
                TreeNode tmpNode = _dropNode;
                while (tmpNode.Parent != null)
                {
                    if (tmpNode.Parent == this._dragNode)
                    {
                        drgevent.Effect = DragDropEffects.None;
                        _dropNodeLocation = NodeRelationship.Null;
                    }
                    tmpNode = tmpNode.Parent;
                }

            }

            //Mechanism to scroll when reaching the end
            if (_dropNode != null)
            {
                //Always ensure that the node we are dropping over/in/under is visible
                _dropNode.EnsureVisible();
                //Highlight previous node if it exists and...
                if (_dropNode.PrevNode != null)
                {
                    //If previous node has no nodes or isnt expanded then this node is a single node and should be visible
                    if (_dropNode.PrevNode.Nodes.Count == 0 || !_dropNode.PrevNode.IsExpanded)
                        _dropNode.PrevNode.EnsureVisible();
                    //If previous node has nodes and is expanded then its last visible child should be made visible
                    else
                    {
                        //Find last visible child recursively
                        TreeNode lastChild = _dropNode.PrevNode.Nodes[_dropNode.PrevNode.Nodes.Count - 1];
                        while (lastChild.Nodes.Count > 0 && lastChild.IsExpanded)
                            lastChild = lastChild.Nodes[lastChild.Nodes.Count - 1];
                        lastChild.EnsureVisible();
                    }
                }
                //Highlight parent node if previous node doesnt exist (meaning node above this node is its parent)
                else
                {
                    if (_dropNode.Parent != null)
                        _dropNode.Parent.EnsureVisible();
                }
                //Highlight next node if it exists and...
                if (_dropNode.NextNode != null)
                {
                    //If this node has no nodes or isnt expanded then it is single, and next node should be visible
                    if (_dropNode.Nodes.Count == 0 || !_dropNode.IsExpanded)
                        _dropNode.NextNode.EnsureVisible();
                    //If this node has nodes and is expanded then we should select its first child
                    else
                        _dropNode.Nodes[0].EnsureVisible();
                }
                //Highlight next node after parent node if there is no next node
                else
                {
                    if (_dropNode.Nodes.Count == 0 || !_dropNode.IsExpanded)
                        if (_dropNode.Parent != null && _dropNode.Parent.NextNode != null)
                            _dropNode.Parent.NextNode.EnsureVisible();
                }
            }

            if (prevDNL != _dropNodeLocation || prevDN != _dropNode)
            {
                PaintDragDestinationGraphics(prevDNL, prevDN);
                PaintDragDestinationGraphics();
            }

            base.OnDragOver(drgevent);
        }
 void LoadMapFromNode(TreeNode node)
 {
     if (node != null && node.Nodes.Count == 0 && node.Tag != null)
     {
         if (PGMEBackend.Program.LoadMap(node.Tag) != 0)
         {
             mapListTreeView.SelectedNode = currentTreeNode;
             return;
         }
         if (currentTreeNode != null)
         {
             currentTreeNode.ImageKey = "Map";
             currentTreeNode.SelectedImageKey = "Map";
         }
         node.ImageKey = "Map Selected";
         node.SelectedImageKey = "Map Selected";
         currentTreeNode = node;
         node.EnsureVisible();
     }
 }
        private void ReBuildTree(Collection<TaskDescription> rootDescriptions)
        {
            //clear the tree
            treeView.Nodes.Clear();

            //create a root
            TreeNode root = new TreeNode("Task Descriptions", imageList.Images.Count - 1, imageList.Images.Count - 1);
            root.Tag = rootDescriptions;
            treeView.Nodes.Add(root);

            foreach (TaskDescription taskDescription in rootDescriptions)
            {
                TreeNode treeNode = new TreeNode(taskDescription.Name);
                treeNode.ToolTipText = taskDescription.Description;
                treeNode.Tag = taskDescription;
                BuildTree(taskDescription, treeNode);
                treeView.Nodes[0].Nodes.Add(treeNode);
                treeNode.EnsureVisible();
                if (taskDescription.Enabled == false)
                {
                    treeNode.ForeColor = Color.Gray;
                }
                if (_currentNode != null)
                {
                    treeView.SelectedNode = _currentNode;
                    _currentNode.EnsureVisible();
                }
            }
        }
Example #17
0
        /// <summary>
        /// Change SelNode to the TreeNode supplied.
        /// </summary>
        /// <param name="tn">TreeNode to change SelNode into.</param>
        /// <param name="bTriggerSelNodeEvents">True if calling this method should make the SelNodeInt property raise the OnBeforeSelNodeChanged/OnAfterSelNodeChanged events or false otherwise.</param>
        protected void ChangeSelNode(TreeNode tn, bool bTriggerSelNodeEvents)
        {
            if(bTriggerSelNodeEvents)
            {
                this.SelNodeInt = tn;
            }
            else
            {
                this.SelNodeIntSilent = tn;
            }

            if(this.ScrollToSelNode && !bRubberbandHasBeenPainted)
            {
                if(tn != null)
                {
                    tn.EnsureVisible();
                }
            }
        }
Example #18
0
    private void addButton_Click(object sender, EventArgs e)
    {
      if (currentlySelectedNode != null)
      {
        if (currentlySelectedNode == globalNode)
        {
          //
          // Add an action to the global node
          //
          KeyAction action = new KeyAction(0, "", "<New Action>", "");
          globalActions.Add(action);

          TreeNode actionNode = new TreeNode(action.Description + " (" + action.Id + ")");

          actionNode.Nodes.Add("Action = " + GetActionName(action.Id));
          actionNode.Nodes.Add("Key = " + action.Key);
          actionNode.Nodes.Add("Sound = " + action.Sound);

          actionNode.Tag = action;

          globalNode.Nodes.Add(actionNode);

          //
          // Make node visible and select it
          //
          actionNode.EnsureVisible();
          keyTreeView.SelectedNode = actionNode;
        }
        else if (currentlySelectedNode == windowsNode)
        {
          //
          // Add window
          //
          ActionWindow window = new ActionWindow();
          windowActions.Add(window);

          window.Id = 0;
          window.Description = "<New Window>";

          TreeNode windowNode = new TreeNode(window.Description + " (" + window.Id + ")");

          windowNode.Tag = window;

          windowsNode.Nodes.Add(windowNode);

          //
          // Make node visible and select it
          //
          windowNode.EnsureVisible();
          keyTreeView.SelectedNode = windowNode;
        }
        else if (currentlySelectedNode.Tag is ActionWindow)
        {
          ActionWindow window = currentlySelectedNode.Tag as ActionWindow;

          //
          // Add an action to the selected window
          //
          KeyAction action = new KeyAction(0, "", "<New Action>", "");
          window.Actions.Add(action);

          TreeNode actionNode = new TreeNode(action.Description + " (" + action.Id + ")");

          actionNode.Nodes.Add("Action = " + GetActionName(action.Id));
          actionNode.Nodes.Add("Key = " + action.Key);
          actionNode.Nodes.Add("Sound = " + action.Sound);

          actionNode.Tag = action;

          currentlySelectedNode.Nodes.Add(actionNode);

          //
          // Make node visible and select it
          //
          actionNode.EnsureVisible();
          keyTreeView.SelectedNode = actionNode;
        }
      }
    }
Example #19
0
        private void AddFolderButton_Click(object sender, EventArgs e)
        {
            TreeNode n = new TreeNode(Strings.NewFolder, RepositoryIcons.RES_FOLDER, RepositoryIcons.RES_FOLDER);
            n.Tag = new ResourceItem("", "", "");
            (n.Tag as ResourceItem).EntryType = EntryTypeEnum.Added;
            (n.Tag as ResourceItem).IsFolder = true;

            if (ResourceTree.SelectedNode == null || ResourceTree.SelectedNode.Parent == null)
                ResourceTree.Nodes[0].Nodes.Add(n);
            else if (ResourceTree.SelectedNode.Tag as ResourceItem != null)
            {
                if ((ResourceTree.SelectedNode.Tag as ResourceItem).IsFolder)
                    ResourceTree.SelectedNode.Nodes.Add(n);
                else if (ResourceTree.SelectedNode.Parent == null)
                    ResourceTree.Nodes[0].Nodes.Add(n);
                else
                    ResourceTree.SelectedNode.Parent.Nodes.Add(n);
            }

            n.EnsureVisible();
            ResourceTree.SelectedNode = n;
            ResourceTree.Focus();
        }
Example #20
0
        private void AddResourceButton_Click(object sender, EventArgs e)
        {
            var dlg = new AddResourceEntryDialog();
            if (dlg.ShowDialog(this) == DialogResult.OK)
            {
                int imageindex = RepositoryIcons.GetImageIndexForResourceType((ResourceTypes)Enum.Parse(typeof(ResourceTypes), Path.GetExtension(dlg.ResourceName).Replace(".", "")));
                TreeNode n = new TreeNode(dlg.ResourceName, imageindex, imageindex);
                ResourceItem i = new ResourceItem("", dlg.HeaderFilepath, dlg.ContentFilepath);
                i.EntryType = EntryTypeEnum.Added;
                n.Tag = i;

                if (ResourceTree.SelectedNode == null || ResourceTree.SelectedNode.Parent == null)
                    ResourceTree.Nodes[0].Nodes.Add(n);
                else if (ResourceTree.SelectedNode.Tag as ResourceItem != null)
                {
                    if ((ResourceTree.SelectedNode.Tag as ResourceItem).IsFolder)
                        ResourceTree.SelectedNode.Nodes.Add(n);
                    else if (ResourceTree.SelectedNode.Parent == null)
                        ResourceTree.Nodes[0].Nodes.Add(n);
                    else
                        ResourceTree.SelectedNode.Parent.Nodes.Add(n);
                }

                n.EnsureVisible();
                ResourceTree.SelectedNode = n;
                ResourceTree.Focus();
            }
        }
Example #21
0
        // Добавление, удаление, исправление анимации
        private void AddAnim(int index)
        {
            if (Animdata.GetAnimData(index) == null)
                {
                    Animdata.AnimData[index] = new Animdata.Data(new sbyte[64], 0, 1, 0, 0);
                    TreeNode node = new TreeNode();
                    node.Tag = index;
                    node.Text = String.Format("0x{0:X4} {1}", index, TileData.ItemTable[index].Name);
                    if ((TileData.ItemTable[index].Flags & TileFlag.Animation) == 0)
                        node.ForeColor = Color.Blue;
                    treeViewAnim.Nodes.Add(node);
                    TreeNode subnode = new TreeNode();
                    subnode.Text = String.Format("0x{0:X4} {1}", index, TileData.ItemTable[index].Name);
                    node.Nodes.Add(subnode);
                    node.EnsureVisible();
                    treeViewAnim.SelectedNode = node;
                    Options.ChangedUltimaClass["Animdata"] = true;

                    tabcontrol.SelectedTab = tabPageAnim;
                }
        }
Example #22
0
        private async Task<bool> DoExport()
        {
            Tools.UpdateCheckBox(chkManifest, Loader.Core.RootNode, "babylonjs_generatemanifest");
            Tools.UpdateCheckBox(chkCopyTextures, Loader.Core.RootNode, "babylonjs_copytextures");
            Tools.UpdateCheckBox(chkHidden, Loader.Core.RootNode, "babylonjs_exporthidden");
            Tools.UpdateCheckBox(chkAutoSave, Loader.Core.RootNode, "babylonjs_autosave");

            Loader.Core.RootNode.SetLocalData(txtFilename.Text);

            exporter = new BabylonExporter();

            treeView.Nodes.Clear();

            exporter.OnImportProgressChanged += progress =>
            {
                progressBar.Value = progress;
                Application.DoEvents();
            };

            exporter.OnWarning += (warning, rank) =>
            {
                try
                {
                    currentNode = CreateTreeNode(rank, warning, Color.DarkOrange);
                    currentNode.EnsureVisible();
                }
                catch
                {
                }
                Application.DoEvents();
            };

            exporter.OnError += (error, rank) =>
            {
                try
                {
                    currentNode = CreateTreeNode(rank, error, Color.Red);
                    currentNode.EnsureVisible();
                }
                catch
                {
                }
                Application.DoEvents();
            };

            exporter.OnMessage += (message, color, rank, emphasis) =>
            {
                try
                {
                    currentNode = CreateTreeNode(rank, message, color);

                    if (emphasis)
                    {
                        currentNode.EnsureVisible();
                    }
                }
                catch
                {
                }
                Application.DoEvents();
            };

            butExport.Enabled = false;
            butExportAndRun.Enabled = false;
            butCancel.Enabled = true;

            bool success = true;
            try
            {
                exporter.AutoSave3dsMaxFile = chkAutoSave.Checked;
                exporter.ExportHiddenObjects = chkHidden.Checked;
                exporter.CopyTexturesToOutput = chkCopyTextures.Checked;
                await exporter.ExportAsync(txtFilename.Text, chkManifest.Checked, this);
            }
            catch (OperationCanceledException)
            {
                progressBar.Value = 0;
                success = false;
            }
            catch (Exception ex)
            {
                currentNode = CreateTreeNode(0, "Exportation cancelled: " + ex.Message, Color.Red);

                currentNode.EnsureVisible();
                progressBar.Value = 0;
                success = false;
            }

            butCancel.Enabled = false;
            butExport.Enabled = true;
            butExportAndRun.Enabled = WebServer.IsSupported;

            BringToFront();

            return success;
        }
Example #23
0
        private void OnClickAddReplace(object sender, EventArgs e)
        {
            int id;
            if (Utils.ConvertStringToInt(textBoxID.Text, out id, 1, 0xFFF))
            {
                string name = textBoxName.Text;
                if (name != null)
                {
                    if (name.Length > 32)
                        name = name.Substring(0, 32);
                    string filename = textBoxWav.Text;
                    if (File.Exists(filename))
                    {
                        Ultima.Sounds.Add(id - 1, name, filename);

                        TreeNode node = new TreeNode(String.Format("0x{0:X3} {1}", id, name));
                        if (checkBox.Checked)
                            node.Text = String.Format("{1} 0x{0:X3}", id, name);
                        node.Tag = id;
                        bool done = false;
                        for (int i = 0; i < treeView.Nodes.Count; ++i)
                        {
                            if ((int)treeView.Nodes[i].Tag == id)
                            {
                                done = true;
                                treeView.Nodes.RemoveAt(i);
                                treeView.Nodes.Insert(i, node);
                                break;
                            }
                        }
                        if (!done)
                        {
                            treeView.Nodes.Add(node);
                            treeView.Sort();
                        }

                        node.EnsureVisible();
                        treeView.SelectedNode = node;
                        treeView.Invalidate();
                        Options.ChangedUltimaClass["Sound"] = true;
                    }
                    else
                    {
                        MessageBox.Show(
                            "Invalid Filename",
                            "Add/Replace",
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Error,
                            MessageBoxDefaultButton.Button1);
                    }
                }
                else
                {
                    MessageBox.Show(
                        "Invalid Name",
                        "Add/Replace",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Error,
                        MessageBoxDefaultButton.Button1);
                }

            }
            else
            {
                MessageBox.Show(
                    "Invalid ID",
                    "Add/Replace",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error,
                    MessageBoxDefaultButton.Button1);
            }
        }
Example #24
0
        /// <summary>
        /// Set the selected node.
        /// </summary>
        /// <param name="tn">the selected node.</param>
        /// <param name="isChanged">the flag whether SelectChanged is executed.</param>
        /// <param name="isScroll">the flag whether EnsureVisible is executed.</param>
        public void SelectNode(TreeNode tn, bool isChanged, bool isScroll)
        {
            if (m_isUpdate || tn == null)
                return;
            ClearSelNode();
            if (!this.SelNodes.Contains(tn))
            {
                this.SelNodes.Add(tn);
            }

            this.SelectedNode = null;
            HighLight(tn);

            if (isScroll)
                tn.EnsureVisible();

            m_RangeNode = null;
            if (isChanged)
                return;
            if (tn.Tag != null)
            {
                TagData t = tn.Tag as TagData;
                if (t != null)
                {
                    m_isUpdate = true;
                    m_env.PluginManager.SelectChanged(t.ModelID, t.Key, t.Type);
                    m_isUpdate = false;
                }
            }
        }
        /// <summary>
        /// Add a new match expression
        /// </summary>
        /// <param name="sender">The sender of the event</param>
        /// <param name="e">The event arguments</param>
        private void btnAdd_Click(object sender, EventArgs e)
        {
            TreeViewCancelEventArgs te = new TreeViewCancelEventArgs(tvExpressions.SelectedNode, false,
                TreeViewAction.Unknown);
            tvExpressions_BeforeSelect(tvExpressions, te);

            if(te.Cancel)
                return;

            TreeNode node = new TreeNode
            {
                Text = "T:MyNamespace.MyClass1",
                Tag = new MemberIdMatchExpression
                {
                    MatchExpression = "T:MyNamespace.MyClass1",
                    ReplacementValue = "T:MyNamespace.MyClass2"
                }
            };

            tvExpressions.Nodes.Add(node);
            tvExpressions.SelectedNode = node;
            node.EnsureVisible();
            txtMatchExpression.Focus();

            btnDelete.Enabled = txtMatchExpression.Enabled = txtReplacementValue.Enabled =
                chkMatchAsRegEx.Enabled = true;
        }
		/// <summary>
		/// Adds the given path to the root node in the folder treeview, so it looks
		/// like a shortcut.
		/// </summary>
		/// <param name="name">Name of folder</param>
		/// <param name="path">Full path of folder</param>
		private void AddFolderShortcut(string name, string path)
		{
			// Special image with index 18 only used in shortcuts:
			var shortcutNode = new TreeNode {Tag = path, Text = name, ImageIndex = 18, SelectedImageIndex = 18};

			_treeNodeRootNode.Nodes.Add(shortcutNode);

			AddChildFolders(shortcutNode);

			shortcutNode.TreeView.SelectedNode = shortcutNode;
			shortcutNode.EnsureVisible();
			shortcutNode.TreeView.Focus();
		}
Example #27
0
 private void SelectTreeNode(TreeView tree, TreeNode node) {
   _treeClickDisabled = true;
   tree.SelectedNode = node;
   if (node != null)
     node.EnsureVisible();
   _treeClickDisabled = false;
 }
Example #28
0
        /// <summary>
        /// Adds Graphic with type and name to List
        /// </summary>
        /// <param name="graphic"></param>
        /// <param name="type"></param>
        /// <param name="name"></param>
        public void AddGraphic(int graphic, int type, string name)
        {
            TreeViewMobs.BeginUpdate();
            TreeViewMobs.TreeViewNodeSorter = null;
            TreeNode nodeparent = new TreeNode(name);
            nodeparent.Tag = new int[] { graphic, type };
            nodeparent.ToolTipText = Animations.GetFileName(graphic);
            if (type == 4)
            {
                TreeViewMobs.Nodes[1].Nodes.Add(nodeparent);
                type = 3;
            }
            else
                TreeViewMobs.Nodes[0].Nodes.Add(nodeparent);

            TreeNode node;
            for (int i = 0; i < AnimNames[type].GetLength(0); ++i)
            {
                if (Animations.IsActionDefined(graphic, i, 0))
                {
                    node = new TreeNode(i.ToString() + " " + AnimNames[type][i]);
                    node.Tag = i;
                    nodeparent.Nodes.Add(node);
                }
            }
            if (!sortalpha)
                TreeViewMobs.TreeViewNodeSorter = new GraphicSorter();
            else
                TreeViewMobs.TreeViewNodeSorter = new AlphaSorter();
            TreeViewMobs.Sort();
            TreeViewMobs.EndUpdate();
            LoadListView();
            TreeViewMobs.SelectedNode = nodeparent;
            nodeparent.EnsureVisible();
        }
Example #29
0
		internal void BeginEdit (TreeNode node)
		{
			if (edit_node != null)
				EndEdit (edit_node);

			if (edit_text_box == null) {
				edit_text_box = new LabelEditTextBox ();
				edit_text_box.BorderStyle = BorderStyle.FixedSingle;
				edit_text_box.Visible = false;
				edit_text_box.EditingCancelled += new EventHandler (LabelEditCancelled);
				edit_text_box.EditingFinished += new EventHandler (LabelEditFinished);
				edit_text_box.TextChanged += new EventHandler (LabelTextChanged);
				Controls.Add (edit_text_box);
			}

			node.EnsureVisible ();

			edit_text_box.Bounds = node.Bounds;
			edit_text_box.Text = node.Text;
			edit_text_box.Visible = true;
			edit_text_box.Focus ();
			edit_text_box.SelectAll ();

			edit_args = new NodeLabelEditEventArgs (node);
			OnBeforeLabelEdit (edit_args);

			edit_node = node;
			
			if (edit_args.CancelEdit) {
				edit_node = null;
				EndEdit (node);
			}
		}
Example #30
0
        public void BuildUserHierarchy()
        {
            treeView1.BeginUpdate();
            treeView1.SuspendLayout();
            System.GC.Collect();
            OysterClassLibrary.Functions F = new OysterClassLibrary.Functions();
            TNCount = 0;
            GetTotalNodes(treeView1.Nodes);
            TempNodes = new String[TNCount];
            TNCount = 0;
            BackupExpandedNodes(treeView1.Nodes);
            ExpandedNodes = new String[TNCount];

            for(int i = 0; i < TNCount;i++)
            {
                ExpandedNodes[i] = TempNodes[i];
            }

            treeView1.Nodes.Clear();

            // TreeNode Root = treeView1.Nodes.Add(cvosUser.Description);
            TreeNode Root = treeView1.Nodes.Add(LoginUser.Description);
            // Root.Tag = cvosUser;
            //Root.Tag = LoginUser;

            Root.Tag = "TopofPack";
            Root.ImageIndex = 0;
            Root.SelectedImageIndex = 0;
            Root.Expand();

            Root.NodeFont = new Font("Arial",10,FontStyle.Regular);
            int MUTCounter = 0;
            // foreach(OysterClassLibrary.Section B in cvosUser.Bodys)

            //            MUTCounter = OSystem.CurrentSectionTypes.Count;
            //            OysterClassLibrary.SectionType nUT = OSystem.SectionTypeSysAdmin;
            //            OysterClassLibrary.SectionType LastType = null;
            MUTCounter = OSystem.CurrentSectionTypes.Count;
            OysterClassLibrary.SectionType nUT = OSystem.SectionTypeSysAdmin;
            OysterClassLibrary.SectionType LastType = null;
            string test = nUT.Description;
            bool listonce = false;
            TreeNode Label = new TreeNode();
            while( MUTCounter > 0)
            {
                listonce = false;
                //foreach(OysterClassLibrary.Section B in cvosUser.Bodys)

                foreach(OysterClassLibrary.Section B in LoginUser.AllOwnedSections)
                {
                    if(B.IsDefault == false)
                    {
                        if(B.CreatedBySectionTypeID == nUT.ID)
                        {
                            if(listonce == false)
                            {
                                if(LastType == null)
                                    LastType = OSystem.SectionTypeSysAdmin;

                                if(LastType.NextSectionTypeID != 99)
                                {
                                    Label = Root.Nodes.Add(nUT.Description);
                                    Label.ImageIndex = 8;
                                    Label.SelectedImageIndex = 8;
                                    Label.Tag = nUT;
                                    //MainSystemSection = B;
                                    test = nUT.Description;
                                }
                                else
                                {
                                    test = B.Description;
                                    test = LastType.Description;
                                    goto Finished_Recursive; // Students don't have bodies so
                                }

                                // Label.Tag = LastType;
                                listonce = true;

                            }
                            test = B.Description;
                            test = LastType.Description;
                            CurrentSectionType = LastType;

                            //if(B.IsDefault == false)
                            //{
                            RecursiveDisplay(B,ref Label,LastType);
                            // }
                        }
                    }
                }
                LastType = nUT;
                if(nUT.NextSectionTypeID != -99)
                    nUT = nUT.NextSectionType;
                    //nUT = F.GetSectionType(nUT.NextSectionTypeID);
                else
                    goto Finished_Recursive;
                test = nUT.Description;
                MUTCounter -= 1;
            }

            Finished_Recursive:{}
            foreach(OysterClassLibrary.Section B in LoginUser.AllOwnedSections)
            {

                OysterClassLibrary.Recordings AR =  F.ALLRecordings(B.ID);

                if((B.IsDefault == true)&&(AR.Count > 0))
                {
                    TreeNode NodeX = new TreeNode();
                    if(OSystem.SectionTypeSysAdmin.ID == LoginUser.HighestAuthorityLevel.ID)
                    {
                        NodeX = Root.Nodes.Add("Recordings");
                        // NodeX.Tag = OSystem.SectionTypeSysAdmin;
                        NodeX.Tag = LoginUser.HighestAuthorityLevel;
                        NodeX.ForeColor = System.Drawing.Color.DarkBlue;
                        NodeX.ImageIndex = 6;
                        NodeX.SelectedImageIndex = 6;
                    }
                    else
                    {
                        NodeX = Root.Nodes.Add("Unassigned Recordings");
                        // NodeX.Tag = HighestSectionType;
                        NodeX.Tag = LoginUser.HighestAuthorityLevel;
                        NodeX.ForeColor = System.Drawing.Color.Brown;
                        NodeX.ImageIndex = 6;
                        NodeX.SelectedImageIndex = 6;
                    }
                    ListView lvSessions = new ListView();
                    //foreach(OysterClassLibrary.Recording R in B.Recordings)
                    foreach(OysterClassLibrary.Recording R in AR)
                    {
                        if(R.SessionID != "")
                        {
                            foreach(ListViewItem LVI in lvSessions.Items)
                            {
                                if(LVI.Text == R.SessionName)
                                    goto SkipItem;
                            }
                            ListViewItem LCI = lvSessions.Items.Add(R.SessionName);
                            LCI.Tag = R.SessionID;
                        }
                    SkipItem:{}
                    }
                    TreeNode[] NodeSessions = new TreeNode[lvSessions.Items.Count];
                    int SessionCount = 0;
                    foreach(ListViewItem LVI in lvSessions.Items)
                    {

                        NodeSessions[SessionCount] = NodeX.Nodes.Add(LVI.Text);

                        NodeSessions[SessionCount].Tag = LVI.Tag;
                        NodeSessions[SessionCount].ImageIndex = 2;
                        NodeSessions[SessionCount].SelectedImageIndex = 2;
                        SessionCount++;
                    }

                    //foreach(OysterClassLibrary.Recording DrawRecording in B.Recordings)
                    foreach(OysterClassLibrary.Recording DrawRecording in AR)
                    {

                        //                        if(DrawRecording.DisplayName == null)
                        //                            DrawRecording.DisplayName = DrawRecording.Created.ToString();
                        TreeNode NodeRecording = new TreeNode();
                        if(DrawRecording.SessionID == "")
                        {
                            NodeRecording = NodeX.Nodes.Add(DrawRecording.DisplayName);
                        }
                        else
                        {
                            for(int a=0; a < SessionCount;a++)
                            {
                                if(DrawRecording.SessionName == NodeSessions[a].Text)
                                    NodeRecording = NodeSessions[a].Nodes.Add(DrawRecording.DisplayName);
                            }
                        }
                        //DrawRecording.Se = B.ID;
                        if(DrawRecording.IsReady)
                        {

                            NodeRecording.Tag = DrawRecording;
                        }
                        else
                        {
                            NodeRecording.ForeColor = System.Drawing.Color.Gray;
                        }

                        NodeRecording.ImageIndex = 3;
                        NodeRecording.SelectedImageIndex = 3;
                        NodeRecording.NodeFont = new Font("Arial",10,FontStyle.Regular);
                        if(g_SelectedAnItem == false)
                        {
                            g_SelectedAnItem = true;
                            treeView1.SelectedNode = NodeRecording;
                            NodeRecording.EnsureVisible();
                            MouseEventArgs A = new MouseEventArgs(MouseButtons.Left,1,1,1,0);
                            treeView1_MouseUp(treeView1,A);
                        }
                        if(OpenToRecording == DrawRecording.ID)
                        {
                            //        NodeRecording.EnsureVisible();
                            treeView1.SelectedNode = NodeRecording;
                            // g_objRecording = DrawRecording;
                            g_objRecording = DrawRecording;
                        }
                    }
                }
            }
            //This Section Displays this LoginUser's Member Sections
            if(LoginUser.HighestAuthorityLevel.ID != OSystem.SectionTypeSysAdmin.ID)
            {
                OysterClassLibrary.Sections MembersOf = LoginUser.AllMemberSections; // F.GetMemberSections(LoginUser.ID,false);
                TreeNode Members = new TreeNode();
                if(MembersOf.Count > 0)
                {
                    Members = Root.Nodes.Add("My Recordings");
                    Members.ForeColor = System.Drawing.Color.Green;
                    //Members.NodeFont = new Font("Arial",10,FontStyle.Bold);
                    Members.ImageIndex = 7;
                    Members.SelectedImageIndex = 7;
                    int Counter2 = OSystem.CurrentSectionTypes.Count;
                    OysterClassLibrary.SectionType nUT2 = OSystem.SectionTypeSysAdmin;
                    test = nUT2.Description;
                    listonce = false;
                    Label = new TreeNode();
                    TreeNode NodeMember = new TreeNode();
                    while( Counter2 > 0)
                    {
                        listonce = false;
                        foreach(OysterClassLibrary.Section M in MembersOf)
                        {
                            test = M.CreatedBySectionType.Description;
                            test = nUT2.Description;

                            if(M.CreatedBySectionType.ID == nUT2.ID)
                            {
                                if(listonce == false)
                                {

                                    OysterClassLibrary.SectionType LabelSectionType = F.GetSectionType(nUT2.NextSectionTypeID);
                                    Label = Members.Nodes.Add(LabelSectionType.Description);
                                    Label.Tag = LabelSectionType;
                                    string whatistheusertype = LabelSectionType.Description;
                                    listonce = true;
                                }
                                NodeMember = new TreeNode();
                                NodeMember = Label.Nodes.Add(M.Description);
                                NodeMember.Tag = M;
                                // NodeMember.NodeFont = new Font("Arial",10,FontStyle.Bold);
                                NodeMember.ForeColor = System.Drawing.Color.DarkSlateBlue;
                                NodeMember.ImageIndex = 1;
                                NodeMember.SelectedImageIndex = 1;
                                bool DrawOnce = false;
                                if(M.CurrentRecordings.Count > 0)
                                {
                                    TreeNode NodeRecs = new TreeNode();
                                    ListView lvSessions = new ListView();
                                    foreach(OysterClassLibrary.Recording R in M.CurrentRecordings)
                                    {
                                        if(R.SessionID != "")
                                        {
                                            foreach(ListViewItem LVI in lvSessions.Items)
                                            {
                                                if(LVI.Text == R.SessionName)
                                                    goto SkipItem;
                                            }

                                            ListViewItem LCI = lvSessions.Items.Add(R.SessionName);
                                            LCI.Tag = R.SessionID;

                                        }
                                    SkipItem:{}
                                    }
                                    TreeNode[] NodeSessions = new TreeNode[lvSessions.Items.Count];
                                    int SessionCount = 0;
                                    foreach(OysterClassLibrary.Recording R in M.CurrentRecordings)
                                    {
                                        if(R.CurrentUserID == LoginUser.ID)
                                            if(DrawOnce == false)
                                            {
                                                NodeRecs = NodeMember.Nodes.Add("Recordings");
                                                NodeRecs.ForeColor = Color.SlateBlue;
                                                NodeRecs.ImageIndex = 6;
                                                NodeRecs.SelectedImageIndex = 6;

                                                foreach(ListViewItem LVI in lvSessions.Items)
                                                {
                                                    NodeSessions[SessionCount] = NodeRecs.Nodes.Add(LVI.Text);
                                                    NodeSessions[SessionCount].Tag = LVI.Tag;
                                                    NodeSessions[SessionCount].ImageIndex = 2;
                                                    NodeSessions[SessionCount].SelectedImageIndex = 2;
                                                    SessionCount++;
                                                }
                                                DrawOnce = true;
                                            }
                                        //                                        if(R.DisplayName == null)
                                        //                                            R.DisplayName = R.Created.ToString();
                                        //R.BodyId = M.BodyId;
                                        TreeNode NRec = new TreeNode();
                                        if(R.SessionID == "")
                                        {
                                            NRec = NodeRecs.Nodes.Add(R.DisplayName);
                                        }
                                        else
                                        {
                                            for(int a=0; a < SessionCount;a++)
                                            {
                                                if(R.SessionName == NodeSessions[a].Text)
                                                    NRec = NodeSessions[a].Nodes.Add(R.DisplayName);
                                            }
                                        }
                                        if(R.IsReady)
                                        {
                                            NRec.Tag = R;
                                        }
                                        else
                                            NRec.ForeColor = Color.Gray;

                                        NRec.NodeFont = new Font("Arial",10,FontStyle.Regular);
                                        NRec.ImageIndex = 3;
                                        NRec.SelectedImageIndex = 3;
                                    }
                                }
                            }
                        }
                        if(nUT2.NextSectionTypeID != -99)
                            nUT2 = F.GetSectionType(nUT2.NextSectionTypeID);
                        test = nUT2.Description;
                        Counter2 -= 1;
                    }
                    if(Members.Nodes.Count > 0) Members.Expand();
                }
            }

            //      Skipped_This: {}
            /// Show Group Recordings
            ///
            if(LoginUser.CurrentGroups.Count > 0)
            {
                OysterClassLibrary.Groups CG = LoginUser.CurrentGroups;

                TreeNode GNode = Root.Nodes.Add("Group Memberships");

                GNode.Tag = CG;
                GNode.ImageIndex = 5;
                GNode.SelectedImageIndex = 5;
                TreeNode NPublic = new TreeNode("Public Groups",1,1);
                NPublic.ForeColor = Color.DarkBlue;
                NPublic.Tag = "Label Group";
                TreeNode NPrivate = new TreeNode("Private Groups",7,7);
                NPrivate.Tag = "Label Group";
                NPrivate.ForeColor = Color.DarkGreen;

                GNode.Nodes.Add(NPublic);
                GNode.Nodes.Add(NPrivate);

                foreach(OysterClassLibrary.Group CurrentGroup in CG)
                {
                    TreeNode GroupNode = new TreeNode(CurrentGroup.Description);

                    GroupNode.Tag = CurrentGroup;

                    GroupNode.ImageIndex = 4;
                    GroupNode.SelectedImageIndex = 4;

                    if(CurrentGroup.IsPublicAccess)
                    {
                        GroupNode.ForeColor = Color.Blue;
                        NPublic.Nodes.Add(GroupNode);
                    }
                    else
                    {
                        GroupNode.ForeColor = Color.Green;
                        NPrivate.Nodes.Add(GroupNode);
                    }
                    OysterClassLibrary.Recordings AR = CurrentGroup.CurrentRecordings;
                    if(AR.Count > 0)
                    {

                        ListView lvSessions = new ListView();
                        //foreach(OysterClassLibrary.Recording R in B.Recordings)
                        foreach(OysterClassLibrary.Recording R in AR)
                        {
                            if(R.SessionID != "")
                            {
                                foreach(ListViewItem LVI in lvSessions.Items)
                                {
                                    if(LVI.Text == R.SessionName)
                                        goto SkipItem;
                                }
                                ListViewItem LCI = lvSessions.Items.Add(R.SessionName);
                                LCI.Tag = R.SessionID;
                            }
                        SkipItem:{}
                        }
                        TreeNode[] NodeSessions = new TreeNode[lvSessions.Items.Count];
                        int SessionCount = 0;
                        foreach(ListViewItem LVI in lvSessions.Items)
                        {
                            NodeSessions[SessionCount] = GroupNode.Nodes.Add(LVI.Text);
                            NodeSessions[SessionCount].Tag = LVI.Tag;
                            NodeSessions[SessionCount].ImageIndex = 2;
                            NodeSessions[SessionCount].SelectedImageIndex = 2;
                            SessionCount++;
                        }

                        //foreach(OysterClassLibrary.Recording DrawRecording in B.Recordings)
                        foreach(OysterClassLibrary.Recording DrawRecording in AR)
                        {

                            //                        if(DrawRecording.DisplayName == null)
                            //                            DrawRecording.DisplayName = DrawRecording.Created.ToString();
                            TreeNode NodeRecording = new TreeNode();
                            if(DrawRecording.SessionID == "")
                            {
                                NodeRecording = GroupNode.Nodes.Add(DrawRecording.DisplayName);
                            }
                            else
                            {
                                for(int a=0; a < SessionCount;a++)
                                {
                                    if(DrawRecording.SessionName == NodeSessions[a].Text)
                                        NodeRecording = NodeSessions[a].Nodes.Add(DrawRecording.DisplayName);
                                }
                            }
                            //DrawRecording.Se = B.ID;
                            if(DrawRecording.IsReady)
                                NodeRecording.Tag = DrawRecording;
                            else
                                NodeRecording.ForeColor = Color.Gray;

                            NodeRecording.NodeFont = new Font("Arial",10,FontStyle.Regular);
                            NodeRecording.ImageIndex = 3;
                            NodeRecording.SelectedImageIndex = 3;

                            //NodeRecording.ForeColor = System.Drawing.Color.DarkSlateBlue;
                        }
                    }
                    else
                        GroupNode.Nodes.Add("No Recordings Available");
                }

                if(NPublic.Nodes.Count == 0)
                {
                    TreeNode NoPublic = NPublic.Nodes.Add("No public groups");
                }

                if(NPrivate.Nodes.Count == 0)
                {
                    TreeNode NoPrivate = NPrivate.Nodes.Add("No private memberships");

                }
            }
            //List Users Unassigned Recordings
            bool RunThisOnce = false;
            TreeNode UNURecs = new TreeNode();
            if(LoginUser.HighestAuthorityLevel.CanViewUnassignedRecordings.Count > 0)
            {
                OysterClassLibrary.Users AU = null;
                if(LoginUser.HighestAuthorityLevel.ID == OSystem.SectionTypeSysAdmin.ID)
                    AU = OSystem.CurrentSystemUsers;
                else
                    AU = LoginUser.AllMembersInHierarchy;

                foreach(OysterClassLibrary.User MyUser in AU)
                {

                    foreach(OysterClassLibrary.Section DrawSection in MyUser.AllOwnedSections)
                    {

                        if((DrawSection.IsDefault)&&(DrawSection.CurrentRecordings.Count > 0))
                        {
                            if(RunThisOnce == false)
                            {
                                UNURecs = Root.Nodes.Add("Current Users Unassigned Recordings");
                                UNURecs.ForeColor = Color.BurlyWood;
                                RunThisOnce = true;
                            }

                            string testme = DrawSection.Description;
                            if(DrawSection.OwnerID != LoginUser.ID)
                            {

                                TreeNode ThisUser = UNURecs.Nodes.Add(MyUser.Description);
                                ThisUser.ForeColor = Color.Blue;
                                ThisUser.ImageIndex = 0;
                                ThisUser.SelectedImageIndex = 0;

                                //THIS LITTLE SECTION IS OAKLAND SPECIFIC.. THAT IS BECAUSE I HAD TOOO
                                //TreeNode NodeURT = new TreeNode();
                                //                        if(DrawBody.CreatedBySectionType.ID == OSystem.SectionTypeSysAdmin.NextSectionTypeID)
                                //                        {
                                //                            NodeURT= NodeX.Nodes.Add("Recordings");
                                //                            NodeURT.ForeColor = Color.DarkBlue;
                                //                        }
                                //                        else
                                //                        {
                                //NodeURT= NodeX.Nodes.Add("Unassigned Recordings");
                                //NodeURT.ForeColor = Color.Brown;
                                //NodeURT.ImageIndex = 6;
                                //NodeURT.SelectedImageIndex = 6;

                                //                        }
                                //IF Recording Sessions go ahead and prepare to draw
                                ListView lvSessions = new ListView();
                                foreach(OysterClassLibrary.Recording R in DrawSection.CurrentRecordings)
                                {
                                    if(R.SessionID != "")
                                    {
                                        foreach(ListViewItem LVI in lvSessions.Items)
                                        {
                                            if(LVI.Text == R.SessionName)
                                                goto SkipItem;
                                        }

                                        ListViewItem LGI = lvSessions.Items.Add(R.SessionName);
                                        LGI.Tag = R.SessionID;

                                    }
                                SkipItem:{}
                                }
                                TreeNode[] NodeSessions = new TreeNode[lvSessions.Items.Count];
                                int SessionCount = 0;

                                foreach(ListViewItem LVI in lvSessions.Items)
                                {
                                    //OysterClassLibrary.StreamingEncoder SE = OSystem.GetStreamingEncoderById(R.StreamingEncoderID);

                                    NodeSessions[SessionCount] = ThisUser.Nodes.Add(LVI.Text);
                                    NodeSessions[SessionCount].ImageIndex = 2;
                                    NodeSessions[SessionCount].SelectedImageIndex = 2;
                                    NodeSessions[SessionCount].Tag =  LVI.Tag;
                                    SessionCount++;
                                }

                                //End Recording Session Preparation

                                foreach(OysterClassLibrary.Recording DrawRecording in DrawSection.CurrentRecordings)
                                {
                                    // bool DoesOwnCopy = F.HasInstanceOfRecording(DrawSection.OwnerID,DrawRecording.ID,DrawSection.ID);
                                    if(true)// if(DoesOwnCopy == true)
                                    {
                                        //DrawRecording.BodyId = DrawBody.ID;
                                        //                                if(DrawRecording.DisplayName == null)
                                        //                                    DrawRecording.DisplayName = DrawRecording.Created.ToString();

                                        TreeNode NodeRecording = new TreeNode();
                                        if(DrawRecording.SessionID == "")
                                        {
                                            NodeRecording = ThisUser.Nodes.Add(DrawRecording.DisplayName);
                                        }
                                        else
                                        {
                                            for(int a=0; a < SessionCount;a++)
                                            {
                                                if(DrawRecording.SessionName == NodeSessions[a].Text)
                                                    NodeRecording = NodeSessions[a].Nodes.Add(DrawRecording.DisplayName);
                                            }
                                        }

                                        if(DrawRecording.IsReady)
                                            NodeRecording.Tag = DrawRecording;
                                        else
                                            NodeRecording.ForeColor = Color.Gray;

                                        NodeRecording.ImageIndex = 3;
                                        NodeRecording.SelectedImageIndex = 3;

                                        //NodeRecording.ForeColor = System.Drawing.Color.Brown;
                                        NodeRecording.NodeFont = new Font("Arial",10,FontStyle.Regular);

                                        if(OpenToRecording == DrawRecording.ID)
                                        {
                                            //     NodeRecording.EnsureVisible();
                                            treeView1.SelectedNode = NodeRecording;
                                            g_objRecording = DrawRecording;
                                        }
                                    }
                                }
                            }
                            // else {TreeNode NodeURT = NodeX.Nodes.Add("No Unassigned Recordings");}
                        }
                    }
                }
            }
            // Begin repainting the TreeView.
            treeView1.Refresh();
            RestoreExpandedNodes(treeView1.Nodes);
            Root.Expand();
            treeView1.EndUpdate();

            F.Dispose();
            treeView1.ResumeLayout();
        }
Example #31
0
        private static void TV_NodeOptions(TreeNode node, string options)
        {
            if (string.IsNullOrEmpty(options))
                return;

            foreach (var opt in ParseOptions(options))
            {
                var on = opt[0] != '-';
                var mode = opt.Substring(!on || opt[0] == '+' ? 1 : 0).ToLowerInvariant();

                switch (mode)
                {
                    // TODO: TV_Modify extended options
                    case Keyword_Bold: node.NodeFont = new Font(node.TreeView.Font, on ? FontStyle.Bold : FontStyle.Regular); break;
                    case Keyword_Check: node.Checked = on; break;
                    case Keyword_Select: node.TreeView.SelectedNode = node; break;
                    case Keyword_Vis: node.EnsureVisible(); break;
                }
            }
        }
Example #32
0
 // if hilight is true, shows the node and paint it with color
 private void ShowAndHilightNode(TreeNode node, bool hilight)
 {
     if (hilight)
     {
         node.EnsureVisible();
         node.BackColor = System.Drawing.Color.LightSkyBlue;
     }
     else
     {
         node.BackColor = SystemColors.Window;
     }
 }
Example #33
0
        private void OnDragDrop(object sender, DragEventArgs e)
        {
            Point pos = treeView1.PointToClient(new Point(e.X, e.Y));
            TreeNode targetNode = treeView1.GetNodeAt(pos);
            TreeNode nodeCopy;

            if (targetNode != null)
            {
                nodeCopy = new TreeNode(sourceNode.Text, sourceNode.ImageIndex, sourceNode.SelectedImageIndex);
                nodeCopy.Tag = sourceNode.Tag;

                bool targetIsSkill = targetNode.Tag != null;
                bool sourceIsSkill = sourceNode.Tag != null;
                if (targetIsSkill && !sourceIsSkill)
                    return;
                if (targetIsSkill && sourceIsSkill)
                {
                    if (sourceNode.Index > targetNode.Index)
                        targetNode.Parent.Nodes.Insert(targetNode.Index, nodeCopy);
                    else
                        targetNode.Parent.Nodes.Insert(targetNode.Index + 1, nodeCopy);
                }
                else if (!targetIsSkill && sourceIsSkill)
                {
                    targetNode.Nodes.Add(nodeCopy);
                }
                else if (!targetIsSkill && !sourceIsSkill)
                {
                    if (String.Equals("Misc", targetNode.Text))
                    {
                        treeView1.Invalidate();
                        return;
                    }
                    if (sourceNode.Index > targetNode.Index)
                        treeView1.Nodes.Insert(targetNode.Index, nodeCopy);
                    else
                        treeView1.Nodes.Insert(targetNode.Index + 1, nodeCopy);

                    while (sourceNode.GetNodeCount(false) > 0)
                    {
                        TreeNode node = sourceNode.FirstNode;
                        node.Remove();
                        nodeCopy.Nodes.Add(node);
                    }
                }
                else
                    return;
                sourceNode.Remove();
                nodeCopy.EnsureVisible();
                treeView1.SelectedNode = nodeCopy;
                treeView1.Invalidate();
                Options.ChangedUltimaClass["SkillGrp"] = true;
            }
        }
Example #34
0
        private void frmStockTree_Load(object sender, EventArgs e)
        {
            string strGroup;

            if (strName == "1")
            {
                frmLabel.Text = "Chart of Inventory";
                System.Windows.Forms.TreeNode oNodex = null;
                tvwGroup.ImageList = imageList1;
                List <StockItem> oogrp = invms.mFillStockTreeGroupLevel(strComID).ToList();
                foreach (StockItem ogrp in oogrp)
                {
                    strGroup = ogrp.strItemGroup.ToString();
                    //oNodex = tvwGroup.Nodes.Find(mcGROUP_PREFIX + ogrp.strItemGroup.ToString(), true)[0].Nodes.Add(mcGROUP_PREFIX + strGroup, strGroup, "closed");
                    oNodex = tvwGroup.Nodes.Add(mcGROUP_PREFIX + strGroup, strGroup, "closed");
                    //oNodex = tvwGroup.Nodes.Find(mcGROUP_PREFIX + ogrp.strItemGroup.ToString(), true)[0].Nodes.Add(mcGROUP_PREFIX + strGroup, strGroup, "closed");
                    oNodex.ImageIndex         = 0;
                    oNodex.SelectedImageIndex = 0;
                    //oNodex.EnsureVisible();
                    mAddItem(strGroup);
                }

                List <StockItem> ooGrplbl1 = invms.mFillStockTreeGroupLevel1(strComID).ToList();
                foreach (StockItem ogrp in ooGrplbl1)
                {
                    strGroup = ogrp.strItemGroup.ToString();
                    oNodex   = tvwGroup.Nodes.Find(mcGROUP_PREFIX + ogrp.strParentGroup.ToString(), true)[0].Nodes.Add(mcGROUP_PREFIX + strGroup, strGroup, "closed");
                    //oNodex = tvwGroup.Nodes.Find(mcGROUP_PREFIX + ogrp.strItemGroup.ToString(), true)[0].Nodes.Add(mcGROUP_PREFIX + strGroup, strGroup, "closed");
                    oNodex.ImageIndex         = 0;
                    oNodex.SelectedImageIndex = 0;
                    oNodex.EnsureVisible();
                    mAddItem(strGroup);
                }
            }
            else if (strName == "2")
            {
                frmLabel.Text = "Commission Group TreeView ";

                System.Windows.Forms.TreeNode oNodex = null;
                tvwGroup.ImageList = imageList1;
                List <StockGroup> oogrp = invms.mFillStockGroupconfigNew(strComID, "").ToList();



                foreach (StockGroup ogrp in oogrp)
                {
                    strGroup = ogrp.GrName.ToString();
                    //oNodex = tvwGroup.Nodes.Find(mcGROUP_PREFIX + ogrp.strItemGroup.ToString(), true)[0].Nodes.Add(mcGROUP_PREFIX + strGroup, strGroup, "closed");
                    oNodex = tvwGroup.Nodes.Add(mcGROUP_PREFIX + strGroup, strGroup, "closed");
                    //oNodex = tvwGroup.Nodes.Find(mcGROUP_PREFIX + ogrp.strItemGroup.ToString(), true)[0].Nodes.Add(mcGROUP_PREFIX + strGroup, strGroup, "closed");
                    oNodex.ImageIndex         = 0;
                    oNodex.SelectedImageIndex = 0;
                    //oNodex.EnsureVisible();
                    mAddItem1(strGroup);
                }
            }

            else if (strName == "3")
            {
                frmLabel.Text = "Pack Size TreeView ";

                System.Windows.Forms.TreeNode oNodex = null;
                tvwGroup.ImageList = imageList1;
                List <StockGroup> oogrp = invms.mFillPackSizeNew(strComID, "").ToList();
                //List<StockItem> oogrp = invms.mFillStockTreeGroupLevel().ToList();
                foreach (StockGroup ogrp in oogrp)
                {
                    strGroup = ogrp.GrName.ToString();
                    //oNodex = tvwGroup.Nodes.Find(mcGROUP_PREFIX + ogrp.strItemGroup.ToString(), true)[0].Nodes.Add(mcGROUP_PREFIX + strGroup, strGroup, "closed");
                    oNodex = tvwGroup.Nodes.Add(mcGROUP_PREFIX + strGroup, strGroup, "closed");
                    //oNodex = tvwGroup.Nodes.Find(mcGROUP_PREFIX + ogrp.strItemGroup.ToString(), true)[0].Nodes.Add(mcGROUP_PREFIX + strGroup, strGroup, "closed");
                    oNodex.ImageIndex         = 0;
                    oNodex.SelectedImageIndex = 0;
                    //oNodex.EnsureVisible();
                    mAddItem3(strGroup);
                }
            }
        }