Пример #1
0
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            BTButtons btbuttons = UIHelper.FindChild <BTButtons>(App._wnd, "MyBTButtons");

            if (!btbuttons.Confirmation("Do You Want To Close Editor?"))
            {
                e.Cancel = true;
            }
        }
        // update BTTree based on _tree list
        private void UpdateBTTree()
        {
            BTTree.Items.Clear();

            // debug tree info
            //Console.WriteLine("=================================================================");
            //foreach (BTNode item in _tree)
            //{
            //	for (int i = 0; i < item._depth; ++i)
            //	{
            //		Console.Write('\t');
            //	}
            //	Console.WriteLine("Name: " + item._name + ", depth: " + item._depth);

            //}

            Stack <TreeItem> treestack = new Stack <TreeItem>();
            TreeItem         treeitem  = new TreeItem();

            foreach (BTNode node in _tree)
            {
                TreeItem tmp_treeitem = new TreeItem(node);

                if (treestack.Count == 0)
                {
                    treeitem = tmp_treeitem;
                    treestack.Push(treeitem);
                    BTTree.Items.Add(treeitem);
                }
                else
                {
                    while (treestack.Peek()._node._depth >= node._depth)
                    {
                        treestack.Pop();
                    }

                    if (treestack.Peek()._node._depth < node._depth)
                    {
                        treeitem = tmp_treeitem;
                        treestack.Peek().Items.Add(treeitem);
                        treestack.Push(treeitem);
                    }
                }
            }

            BTButtons btbuttons = UIHelper.FindChild <BTButtons>(App._wnd, "MyBTButtons");

            btbuttons.CheckButtonEnabled();
        }
Пример #3
0
        private void MenuRename_Click(object sender, RoutedEventArgs e)
        {
            BTButtons btbuttons = UIHelper.FindChild <BTButtons>(App._wnd, "MyBTButtons");

            btbuttons.RenameButton_Click(sender, e);
        }