/// <summary>
        /// 初始化添加tvi事件
        /// </summary>
        private void CollapsedDGR()
        {
            //节点收缩
            //datagrid.UpdateLayout();
            //for(int i = 0;i < datagrid.ItemContainerGenerator.Items.Count;i++)
            //{
            //	DataGridRow dgv = (DataGridRow)datagrid.ItemContainerGenerator.ContainerFromIndex(i);
            //	if(dgv == null)
            //	{
            //		datagrid.UpdateLayout();
            //		datagrid.ScrollIntoView(datagrid.Items[i]);
            //		dgv = (DataGridRow)datagrid.ItemContainerGenerator.ContainerFromIndex(i);
            //	}
            //	DataRow dr = (dgv.Item as DataRowView).Row;
            //	if(Convert.ToInt32(dr["FatherID"]) != 0)
            //	{
            //		dgv.Visibility = Visibility.Collapsed;
            //	}
            //}

            //节点展开
            treeview.UpdateLayout();
            foreach (var item in treeview.Items)
            {
                TreeViewItem tvi = treeview.ItemContainerGenerator.ContainerFromItem(item) as TreeViewItem;
                tvi.ExpandSubtree();
            }
            SetNodeDPVisible(treeview);
        }
Exemplo n.º 2
0
        void InitTreeCode()
        {
            treeCode.Items.Clear();
            TreeViewItem item = new TreeViewItem();

            item.Header = "Execute Order:" + debugtool.fullLog.state.ToString();
            treeCode.Items.Add(item);
            if (string.IsNullOrEmpty(debugtool.fullLog.error) == false)
            {
                TreeViewItem erritem = new TreeViewItem();
                erritem.Header = "error:" + debugtool.fullLog.error;
                treeCode.Items.Add(erritem);
            }
            {
                TreeViewItem resultitem = new TreeViewItem();
                resultitem.Header = "result:" + debugtool.fullLog.state.ToString();
                treeCode.Items.Add(resultitem);
            }
            TreeViewItem itemScript = new TreeViewItem();

            item.Items.Add(itemScript);
            FillTreeScript(itemScript, debugtool.fullLog.script);
            item.ExpandSubtree();
            item.IsSelected = true;
            item.BringIntoView();
        }
Exemplo n.º 3
0
        public MainWindow(ICatalogManager catMgr, IFinancialManager finMgr)
        {
            InitializeComponent();

            _catMgr = catMgr;
            _finMgr = finMgr;

            var root = new TreeViewItem();

            root.Header = "Tree";

            var child = new TreeViewItem();

            child.Header = "Initial Data Typing";
            root.Items.Add(child);

            child        = new TreeViewItem();
            child.Header = "Descriptions";
            root.Items.Add(child);

            MainTreeView.Items.Add(root);

            root.ExpandSubtree();

            AreaComboBox.AddHandler(TextBoxBase.TextChangedEvent,
                                    new TextChangedEventHandler(ComboBox_TextChanged));
        }
        public ExplanationView(IEnumerable <AutoCompletionResult.CommandResult> commandResults)
        {
            InitializeComponent();

            foreach (var commandResult in commandResults)
            {
                var commandTreeItem = new TreeViewItem {
                    Header = commandResult.Item.Text + commandResult.CompletionId
                };
                Action <TreeViewItem, Explanation> renderExplanation = null;
                renderExplanation = (t, exp) =>
                {
                    var header    = exp.Value + " " + exp.Description + " ";
                    var childItem = new TreeViewItem {
                        Header = header
                    };
                    t.Items.Add(childItem);
                    foreach (var explanation in exp.GetDetails() ?? new Explanation[] {})
                    {
                        renderExplanation(childItem, explanation);
                    }
                };
                renderExplanation(commandTreeItem, commandResult.Explanation);
                commandTreeItem.ExpandSubtree();
                ExplanationTree.Items.Add(commandTreeItem);
            }
        }
Exemplo n.º 5
0
        public MainWindow(ICatalogManager catMgr)
        {
            InitializeComponent();

            _catMgr = catMgr;

            var root = new TreeViewItem();

            root.Header = "Tree";

            var child = CreateTreeViewItem("Initial Data Typing");

            child.Tag = typeof(InitialDataTypingForm);
            root.Items.Add(child);

            child     = CreateTreeViewItem("Descriptions");
            child.Tag = typeof(DescriptionsForm);
            root.Items.Add(child);

            MainTreeView.Items.Add(root);

            root.ExpandSubtree();

            AreaComboBox.AddHandler(TextBoxBase.TextChangedEvent,
                                    new TextChangedEventHandler(ComboBox_TextChanged));
        }
        private void ApplyItemColor(TreeViewItem item)
        {
            if (item == null)
            {
                return;
            }
            MenuDataSource dataSource = (MenuDataSource)item.DataContext;

            item.Background           = new SolidColorBrush(dataSource.BackgroundColor);
            item.Padding              = new Thickness(dataSource.PaddingLeft, 0, 0, 0);
            item.Foreground           = new SolidColorBrush(dataSource.ForegroundColor);
            item.Expanded            += new RoutedEventHandler(TreeViewItem_Expanded);
            item.MouseLeftButtonDown += new MouseButtonEventHandler(TreeViewItem_MouseLeftButtonDown);
            if (!item.HasItems)
            {
                item.BorderThickness = new Thickness(0, 0, 0, 1);
                item.BorderBrush     = new SolidColorBrush(Color.FromArgb(255, 226, 226, 226));
            }
            else
            {
                item.ExpandSubtree();
                for (int i = 0; i < item.Items.Count; i++)
                {
                    TreeViewItem child = (TreeViewItem)(item
                                                        .ItemContainerGenerator
                                                        .ContainerFromIndex(i));
                    ApplyItemColor(child);
                }
                item.IsExpanded = false;
            }
        }
Exemplo n.º 7
0
        private void SetNavigartionTree()
        {
            TreeViewItem node     = AddTreeItem(treeNavigation.Items, "فرمهای امنیتی", "../Images/folder.png");
            var          userNode = AddTreeItem(node.Items, "کاربران", "../Images/user.png");

            userNode.MouseLeftButtonUp += UserNode_MouseLeftButtonUp;
            var roleTypesNode = AddTreeItem(node.Items, "انواع نقش", "../Images/role.png");

            roleTypesNode.MouseLeftButtonUp += RoleTypesNode_MouseLeftButtonUp;
            var organizationtypeNode = AddTreeItem(node.Items, "انواع سازمان", "../Images/organizationtype.png");

            organizationtypeNode.MouseLeftButtonUp += OrganizationtypeNode_MouseLeftButtonUp;
            var organizationNode = AddTreeItem(node.Items, "سازمانها", "../Images/organization.png");

            organizationNode.MouseLeftButtonUp += OrganizationNode_MouseLeftButtonUp;
            var permissionNode = AddTreeItem(node.Items, "دسترسی ها", "../Images/permission.png");

            permissionNode.MouseLeftButtonUp += PermissionNode_MouseLeftButtonUp;
            var datasecurityNode = AddTreeItem(node.Items, "دسترسی موجودیت/داده مستقیم", "../Images/datasecurity.png");

            datasecurityNode.MouseLeftButtonUp += DatasecurityNode_MouseLeftButtonUp;
            var datasecurityindeirectNode = AddTreeItem(node.Items, "دسترسی موجودیت/داده غیر مستقیم", "../Images/datasecurityindeirect.png");

            datasecurityindeirectNode.MouseLeftButtonUp += DatasecurityindeirectNode_MouseLeftButtonUp;
            var conditionalsecurityNode = AddTreeItem(node.Items, "دسترسی های شرطی", "../Images/conditionalsecurity.png");

            conditionalsecurityNode.MouseLeftButtonUp += ConditionalsecurityNode_MouseLeftButtonUp;
            node.ExpandSubtree();
        }
Exemplo n.º 8
0
        private void UpdateTypeValueSetupGrid(ClrtDisplayableType dispType, TreeViewItem root)
        {
            bool realRoot = false;

            if (root == null)
            {
                realRoot = true;
                root     = GuiUtils.GetTypeValueSetupTreeViewItem(dispType);
            }
            else
            {
                root.Tag = dispType;
            }

            if (dispType.HasFields)
            {
                DisplayNodes(root, dispType.Fields);
            }
            else if (dispType.HasAlternatives)
            {
                DisplayNodes(root, dispType.Alternatives);
            }

            if (realRoot)
            {
                TypeValueReportTreeView.Items.Clear();
                TypeValueReportTreeView.Items.Add(root);
            }
            root.ExpandSubtree();
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            ExclusionDetailsViewModel model = DataContext as ExclusionDetailsViewModel;

            if (model == null)
            {
                return;
            }
            bool jsonLoaded = model.IsJson;

            if (jsonLoaded)
            {
                TreeViewJson.Items.Clear();
                JsonViewerHelper helper = new JsonViewerHelper();
                jsonLoaded = helper.LoadJsonToTreeView(TreeViewJson, model.Parameters);
                if (jsonLoaded)
                {
                    TreeViewItem item = (TreeViewItem)TreeViewJson.Items.GetItemAt(0);
                    item.ExpandSubtree();
                    TextblockParameters.Visibility = Visibility.Collapsed;
                    TreeViewJson.Visibility        = Visibility.Visible;
                }
            }
            if (jsonLoaded)
            {
                return;
            }
            TreeViewJson.Visibility        = Visibility.Hidden;
            TextblockParameters.Text       = model.Parameters;
            TextblockParameters.Visibility = Visibility.Visible;
        }
Exemplo n.º 10
0
        private TreeViewItem PopulateTreeView(ExpressionNode expNode)
        {
            TreeViewItem tvItem = new TreeViewItem();

            Button button = new Button()
            {
                Content = expNode
            };

            button.Click += (object sender, RoutedEventArgs e) =>
            {
                ExpressionNode clickedNode = (ExpressionNode)(((Button)sender).Content);
                PerformTransformation(clickedNode);

                UpdateTreeView();
            };
            tvItem.Header = button;

            for (int i = 0; i < expNode.ChildrenCount(); i++)
            {
                tvItem.Items.Add(PopulateTreeView((ExpressionNode)(expNode.GetChild(i))));
            }

            tvItem.ExpandSubtree();
            return(tvItem);
        }
Exemplo n.º 11
0
        private void menuitem_Click(object sender, RoutedEventArgs e)
        {
            MenuItem menuitem = sender as MenuItem;
            bool     click    = Convert.ToBoolean(menuitem.Tag);

            if (click)
            {
                foreach (var item in tvProperties.Items)
                {
                    TreeViewItem tvi = tvProperties.ItemContainerGenerator.ContainerFromItem(item) as TreeViewItem;
                    tvi.ExpandSubtree();
                    PropertyNodeItem pni = tvi.DataContext as PropertyNodeItem;
                    TVIChoiced(pni, click);
                }
            }
            else
            {
                //foreach(var item in tvProperties.Items)
                //{
                //	TreeViewItem tvi = tvProperties.ItemContainerGenerator.ContainerFromItem(item) as TreeViewItem;
                //	tvi.IsExpanded = false;
                //	PropertyNodeItem pni = tvi.DataContext as PropertyNodeItem;
                //	TVIChoiced(pni,click);
                //}
                SetNodeExpandedState(tvProperties, click);
            }
        }
Exemplo n.º 12
0
        private void PopulatePlaylists()
        {
            TreeViewItem rootItem, childItem;
            int          index = 1;

            rootItem = new TreeViewItem()
            {
                Tag    = "Playlists",
                Header = "Playlists"
            };
            TvPlaylists.Items.Add(rootItem);
            rootItem.Expanded += new RoutedEventHandler(PlaylistsExpanded);

            foreach (var n in db.GetPlaylistName())
            {
                childItem = new TreeViewItem()
                {
                    Tag = "Playlist" + index
                };
                index++;
                childItem.Header = n;
                rootItem.Items.Add(childItem);
            }
            rootItem.ExpandSubtree();
            rootItem.IsSelected = true;
        }
Exemplo n.º 13
0
        private void openPlant()
        {
            Microsoft.Win32.OpenFileDialog dlgOpenDiagram = new Microsoft.Win32.OpenFileDialog();
            dlgOpenDiagram.Filter = "Relief(*.ref) |*.ref";
            string outFolder = AppDomain.CurrentDomain.BaseDirectory.ToString() + @"temp\";

            if (dlgOpenDiagram.ShowDialog() == true)
            {
                int length = dlgOpenDiagram.SafeFileName.Length;
                outFolder = outFolder + dlgOpenDiagram.SafeFileName.Substring(0, length - 4);
                string refFile = dlgOpenDiagram.FileName;
                if (Directory.Exists(outFolder))
                {
                    Directory.Delete(outFolder, true);
                }
                CSharpZip.ExtractZipFile(refFile, "1", outFolder);
                TreeViewItem  tvi  = new TreeViewItem();
                TreeViewItem  root = (TreeViewItem)navView.Items[0];
                DirectoryInfo di   = new DirectoryInfo(outFolder);
                getAllfiles(di, ref root);
                root.ExpandSubtree();
                curFolder  = outFolder;
                curRefFile = refFile;
                this.leftdockpanel.Visibility = Visibility.Visible;
            }
        }
Exemplo n.º 14
0
        public MainWindow(ICatalogManager catMgr, IFinancialManager finMgr)
        {
            InitializeComponent();

            _catMgr = catMgr;
            _finMgr = finMgr;

            var root = new TreeViewItem();

            root.Header = "Tree";

            var child = new TreeViewItem();

            child.Header    = "Initial Data Typing";
            child.Selected += TreeViewItemSelected;
            child.Tag       = typeof(InitialDataTypingView);
            root.Items.Add(child);

            child           = new TreeViewItem();
            child.Header    = "Descriptions";
            child.Selected += TreeViewItemSelected;
            child.Tag       = typeof(DescriptionView);
            root.Items.Add(child);

            MainTreeView.Items.Add(root);

            root.ExpandSubtree();
        }
Exemplo n.º 15
0
        public ExceptionDialog(DispatcherUnhandledExceptionEventArgs e)
        {
            Exception exception;

#if DEBUG
            System.Diagnostics.Debugger.Break();
#endif

            InitializeComponent();

            TreeViewItem treeViewItem = new TreeViewItem();
            treeViewItem.Header = "Exception";
            treeViewItem.ExpandSubtree();

            if (e.Exception.InnerException == null)
            {
                exception = e.Exception;
            }
            else
            {
                exception = e.Exception.InnerException;
            }

            buildTreeLayer(exception, treeViewItem);
            treeView1.Items.Add(treeViewItem);

            textBox1.Text = m_exception_string;
        }
        /// <summary>
        /// function: AutomatedTests
        /// Developed by: Vaibhav Kumar. Syracuse University
        /// Date: 5th-Dec-2018
        /// Objective: Performs automated test for the application without user interference
        /// </summary>
        private async void AutomatedTests()
        {
            TimedMsgBox.Show("Initiating Automated Demonstration. It will take about 50 seconds to complete.", "Auto Demo", 4000);
            tbControl.SelectedIndex = 0;
            await Task.Delay(2000);

            btnConnect_Click(btnConnect, null);
            TimedMsgBox.Show("Connection complete\nDemonstrating file selection", "Auto Demo", 4000);
            tbControl.SelectedIndex = 1;
            await Task.Delay(2000);

            if (lstClient.Items.Count > 0)
            {
                TreeViewItem item = (TreeViewItem)lstClient.Items[0];
                item.IsExpanded = true;
                item.ExpandSubtree();
                selectedFiles.Add("File1.cs");
                selectedFiles.Add("File2.cs");
                selectedFiles.Add("File3.cs");
                selectedFiles.Add("File4.cs");
                selectedFiles.Add("File5.cs");
                selectedFiles.Add("File6.cs");
                BindSelectedFiles();
                await Task.Delay(4000);

                btnTypeAnal_Click(btnTypeAnal, null);
                await Task.Delay(4000);

                TimedMsgBox.Show("Type Analysis complete\n Demonstrating Dependency Analysis", "Auto Demo", 4000);
                tbControl.SelectedIndex = 1;
                await Task.Delay(4000);

                btnDepAnal_Click(btnDepAnal, null);
                await Task.Delay(4000);

                TimedMsgBox.Show("Dependency Analysis complete\n Demonstrating Strong Component", "Auto Demo", 4000);
                tbControl.SelectedIndex = 1;
                btnSCC_Click(btnSCC, null);
                await Task.Delay(5000);

                TimedMsgBox.Show("Strong Component complete\n Demonstrating Total Analysis", "Auto Demo", 4000);
                btnAnal_Click(btnAnal, null);
                await Task.Delay(4000);

                tbControl.SelectedIndex = 2;
                await Task.Delay(4000);

                tbControl.SelectedIndex = 3;
                await Task.Delay(4000);

                tbControl.SelectedIndex = 4;
                TimedMsgBox.Show("Demonstration Complete!", "Auto Demo", 4000);
            }
            else
            {
                MessageBox.Show("No files present in the root folder");
                this.Close();
            }
        }
Exemplo n.º 17
0
        private void MenuItem_Click_1(object sender, RoutedEventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter = "Project file (*.proj)|*.proj";
            if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                projectProperties.projectPath = System.IO.Path.GetDirectoryName(ofd.FileName);
                this.Title = projectProperties.projectPath;
                using (FileStream fs = new FileStream(ofd.FileName, FileMode.Open))
                    using (BinaryReader br = new BinaryReader(fs))
                    {
                        projectProperties.extension = br.ReadString().Trim();
                        if (projectProperties.extension == ".c")
                        {
                            projectProperties.compiler = "gcc.exe";
                        }
                        else
                        {
                            projectProperties.compiler = "g++.exe";
                        }
                        projectProperties.projectName = br.ReadString().Trim();
                    }
                var files = Directory.GetFiles(projectProperties.projectPath, "*").Where(s => s.EndsWith(projectProperties.extension) || s.EndsWith(".h"));
                treeItem.Header = projectProperties.projectName;
                projectProperties.currentFile = null;
                editor.ClearAll();
                treeView1.Items.Clear();
                treeItem.Items.Clear();
                projectFiles.Clear();
                treeView1.Items.Add(treeItem);
                foreach (var file in files)
                {
                    treeItem.Items.Add(new TreeViewItem()
                    {
                        Header = System.IO.Path.GetFileName(file)
                    });
                    projectFiles.Add(file);
                }
                treeItem.ExpandSubtree();
                btnNewFile.IsEnabled = true;
                btnSave.IsEnabled    = true;
                editor.IsEnabled     = false;
            }
        }
        private void ExpandItem_Click(object sender, RoutedEventArgs e)
        {
            TreeViewItem item = (sender as MenuItem)?.Tag as TreeViewItem;

            if (item != null)
            {
                item.ExpandSubtree();
            }
        }
        private void ParserService_ParseInformationUpdated(object sender, ParseInformationEventArgs e)
        {
            if (_textEditor == null || !FileUtility.IsEqualFileName(_textEditor.FileName, e.FileName))
            {
                return;
            }

            trvLayout.Items.Clear();

            IVbModuleWrapper wrapper = (IVbModuleWrapper)e.NewUnresolvedFile;

            TreeViewItem root = new TreeViewItem();

            root.Header = GetNodeHeaderWithIcon(wrapper.Module.Name, CompletionImage.Class);

            TreeViewItem fields = new TreeViewItem();

            root.Items.Add(fields);

            TreeViewItem properties = new TreeViewItem();

            root.Items.Add(properties);

            TreeViewItem methods = new TreeViewItem();

            root.Items.Add(methods);

            foreach (IVbMember member in wrapper.Module.Members)
            {
                TreeViewItem memberNode = new TreeViewItem();
                memberNode.Header    = member.Name;
                memberNode.Tag       = member;
                memberNode.Selected += memberNode_Selected;

                if (member is IVbProperty)
                {
                    properties.Items.Add(memberNode);
                }
                else if (member is IVbMethod)
                {
                    methods.Items.Add(memberNode);
                }
                else if (member is IVbField)
                {
                    fields.Items.Add(memberNode);
                }
            }

            fields.Header     = GetNodeHeaderWithIcon(string.Format("Fields ({0})", fields.Items.Count), CompletionImage.Field);
            properties.Header = GetNodeHeaderWithIcon(string.Format("Properties ({0})", properties.Items.Count), CompletionImage.Property);
            methods.Header    = GetNodeHeaderWithIcon(string.Format("Methods ({0})", methods.Items.Count), CompletionImage.Method);

            root.ExpandSubtree();

            trvLayout.Items.Add(root);
        }
Exemplo n.º 20
0
        public static TreeViewItem ToTreeViewItem(this ProjectModel project)
        {
            var node = new TreeViewItem {
                Header = project.Name
            };

            if (!project.AllChildrenExist)
            {
                node.ExpandSubtree();
            }
            return(node);
        }
 public void ExpandAllNodes()
 {
     foreach (object item in this.TreeViewForXamlInspection.Items)
     {
         TreeViewItem treeViewItem = this.TreeViewForXamlInspection.ItemContainerGenerator.ContainerFromItem(item) as TreeViewItem;
         if (treeViewItem != null)
         {
             treeViewItem.ExpandSubtree();
         }
     }
     _hasBeenFullyExpanded = true;
 }
Exemplo n.º 22
0
 // Open all TreeNodes (Will be an Option later to chose if Open or Not)
 public void TreeViewNodeIsExpanded(bool status)
 {
     if (status)
     {
         TreeViewItem tvi = new TreeViewItem();
         tvi = GetTreeViewItem(_TreeView, _TreeView.SelectedItem);
         if (tvi != null)
         {
             tvi.ExpandSubtree();
         }
     }
 }
Exemplo n.º 23
0
 private Object DialogItemFromFormatTree(Shape shape, FormatTreeNode node)
 {
     if (node.Format != null)
     {
         SyncFormatDialogItem result = new SyncFormatDialogItem(node);
         if (!node.Format.CanCopy(shape))
         {
             return(null);
         }
         result.Text      = node.Name;
         result.IsChecked = node.IsChecked;
         result.Image     = node.Format.DisplayImage(shape);
         return(result);
     }
     else
     {
         SyncFormatDialogItem header = new SyncFormatDialogItem(node);
         header.Text      = node.Name;
         header.IsChecked = node.IsChecked;
         TreeViewItem result = new TreeViewItem();
         result.Header = header;
         List <SyncFormatDialogItem> children = new List <SyncFormatDialogItem>();
         foreach (FormatTreeNode childNode in node.ChildrenNodes)
         {
             Object treeItem = DialogItemFromFormatTree(shape, childNode);
             if (treeItem != null)
             {
                 if (treeItem is SyncFormatDialogItem)
                 {
                     children.Add((SyncFormatDialogItem)treeItem);
                 }
                 else if (treeItem is TreeViewItem)
                 {
                     children.Add((SyncFormatDialogItem)((TreeViewItem)treeItem).Header);
                 }
                 result.Items.Add(treeItem);
             }
         }
         header.ItemChildren = children.ToArray <SyncFormatDialogItem>();
         foreach (SyncFormatDialogItem child in children)
         {
             child.ItemParent = header;
         }
         result.ExpandSubtree();
         if (result.Items.Count == 0)
         {
             return(null);
         }
         return(result);
     }
 }
Exemplo n.º 24
0
        public PatternTabItem(PatternHolder pattern)
        {
            InitializeComponent();
            ViewMap = new Dictionary <TreeViewItem, IHolder>();
            TreeViewItem root = new TreeViewItem();

            root.Header    = "root";
            root.Selected += TabItemSelected;
            ViewMap.Add(root, pattern);
            for (int i = 0; i < pattern.Layers.Length; i++)
            {
                TreeViewItem layerItem = new TreeViewItem();
                layerItem.Header = "layer " + i;
                ViewMap.Add(layerItem, pattern.Layers[i]);
                foreach (LayerContent b in pattern.Layers[i].Content)
                {
                    TreeViewItem contentItem = new TreeViewItem();
                    switch (b.Type)
                    {
                    case LayerContent.ContentType.Batch:
                        contentItem.Header = "batch";
                        break;

                    case LayerContent.ContentType.Laser:
                        contentItem.Header = "laser";
                        break;

                    case LayerContent.ContentType.Cover:
                        contentItem.Header = "cover";
                        break;

                    case LayerContent.ContentType.Rebound:
                        contentItem.Header = "rebound";
                        break;

                    case LayerContent.ContentType.Force:
                        contentItem.Header = "force";
                        break;
                    }
                    ViewMap.Add(contentItem, b);
                    contentItem.Selected += TabItemSelected;
                    layerItem.Items.Add(contentItem);
                }
                layerItem.Selected += TabItemSelected;
                root.Items.Add(layerItem);
            }
            root.ExpandSubtree();
            TreeView.Items.Add(root);
            Pattern = pattern;
        }
        public ExceptionMessageBox(Exception e, string userExceptionMessage)
        {
            InitializeComponent();

            this.userExceptionMessage = userExceptionMessage;
            textBox1.Text             = userExceptionMessage;

            TreeViewItem treeViewItem = new TreeViewItem();

            treeViewItem.Header = "Exception";
            treeViewItem.ExpandSubtree();
            buildTreeLayer(e, treeViewItem);
            treeView1.Items.Add(treeViewItem);
        }
Exemplo n.º 26
0
        public void UpdateInstanceValue(InstanceValue instVal, string descr)
        {
            if (instVal.Parent == null)
            {
                Title = TypeExtractor.GetDisplayableTypeName(instVal.TypeName);
            }
            ClassStructInfo.Text = descr;
            var stackPanel = new StackPanel()
            {
                Orientation = Orientation.Horizontal
            };
            var textBlk = new TextBlock();

            textBlk.Inlines.Add(instVal.ToString());
            stackPanel.Children.Add(textBlk);
            var tvRoot = new TreeViewItem
            {
                Header = GuiUtils.GetInstanceValueStackPanel(instVal),
                Tag    = instVal
            };

            var que = new Queue <KeyValuePair <InstanceValue, TreeViewItem> >();

            que.Enqueue(new KeyValuePair <InstanceValue, TreeViewItem>(instVal, tvRoot));
            while (que.Count > 0)
            {
                var             info         = que.Dequeue();
                InstanceValue   parentNode   = info.Key;
                TreeViewItem    tvParentNode = info.Value;
                InstanceValue[] descendants  = parentNode.Fields;
                for (int i = 0, icount = descendants.Length; i < icount; ++i)
                {
                    var descNode = descendants[i];
                    var tvNode   = new TreeViewItem
                    {
                        Header = GuiUtils.GetInstanceValueStackPanel(descNode),
                        Tag    = descNode
                    };
                    tvParentNode.Items.Add(tvNode);
                    que.Enqueue(new KeyValuePair <InstanceValue, TreeViewItem>(descNode, tvNode));
                }
            }

            var treeView = InstanceValueTreeview;

            treeView.Items.Clear();
            treeView.Items.Add(tvRoot);
            tvRoot.IsSelected = true;
            tvRoot.ExpandSubtree();
        }
Exemplo n.º 27
0
        //<Snippet2>
        private void expandSelected_Click(object sender, RoutedEventArgs e)
        {
            if (treeView1.SelectedItem == null)
            {
                return;
            }

            TreeViewItem tvi = GetTreeViewItem(treeView1, treeView1.SelectedItem);

            if (tvi != null)
            {
                tvi.ExpandSubtree();
            }
        }
Exemplo n.º 28
0
        private void bluetoothDeviceList_Selected(object sender, RoutedEventArgs e)
        {
            TreeViewItem selectedItem = e.OriginalSource as TreeViewItem;

            if (selectedItem == null)
            {
                return;
            }
            if (selectedItem.Items.Count != 0)
            {
                selectedItem.ExpandSubtree();
                selectedItem.IsSelected = false;
            }
        }
Exemplo n.º 29
0
        private void MenuItem_Click(object sender, RoutedEventArgs e)
        {
            var text = new TreeViewItem();

            text.Header = "Test";
            if (selected_item is not null)
            {
                selected_item.Items.Add(text);
                selected_item.ExpandSubtree();
            }
            else
            {
                scene_tree.Items.Add(text);
            }
        }
Exemplo n.º 30
0
        public void Refresh(object sender, RoutedEventArgs e)
        {
            if (MainWindow.Instance == null)
            {
                return;
            }

            Tree.Items.Clear();

            var          home     = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
            var          repoPath = MainWindow.Instance.RepoDir;
            const string repoDir  = "Roguelike/Assets/Prefabs";
            var          libdir   = Path.Combine(home, repoPath, repoDir);

            if (!Directory.Exists(libdir))
            {
                return;
            }

            foreach (var dir in new DirectoryInfo(libdir).GetDirectories())
            {
                var node = new TreeViewItem {
                    Header = dir.Name
                };
                foreach (var fileInfo in dir.GetFiles())
                {
                    var file = fileInfo;

                    var item = new TreeViewItem
                    {
                        Header      = file.Name,
                        DataContext = file
                    };
                    item.Selected += delegate
                    {
                        var room = this.GetParent <PrefabRoom>();
                        room.SetFile(file.FullName);
                        using (var stream = room.OpenFileRead(file.FullName))
                        {
                            room.Load(stream);
                        }
                    };
                    node.Items.Add(item);
                    node.ExpandSubtree();
                }
                Tree.Items.Add(node);
            }
        }