Пример #1
0
        public TestTreeView()
        {
            InitializeComponent();

            RunButton = new SplitButtonElement(runButton);
            RunAllCommand = new MenuElement(runAllMenuItem);
            RunSelectedCommand = new MenuElement(runSelectedMenuItem);
            RunFailedCommand = new MenuElement(runFailedMenuItem);
            StopRunCommand = new MenuElement(stopRunMenuItem);

            FormatButton = new ToolStripElement<ToolStripDropDownButton>(formatButton);
            DisplayFormat = new CheckedMenuGroup(
                "displayFormat", 
                nunitTreeMenuItem, fixtureListMenuItem, testListMenuItem);
            GroupBy = new CheckedMenuGroup(
                "testGrouping", 
                byAssemblyMenuItem, byFixtureMenuItem, byCategoryMenuItem, byOutcomeMenuItem, byDurationMenuItem);

            RunContextCommand = new MenuElement(this.runMenuItem);
            ShowCheckBoxesCommand = new MenuElement(showCheckboxesMenuItem);
            ExpandAllCommand = new MenuElement(expandAllMenuItem);
            CollapseAllCommand = new MenuElement(collapseAllMenuItem);
            CollapseToFixturesCommand = new MenuElement(collapseToFixturesMenuItem);

            Tree = new TreeViewElement(treeView);
        }
        public TestTreeView()
        {
            InitializeComponent();

            RunButton          = new SplitButtonElement(runButton);
            RunAllCommand      = new ToolStripMenuElement(runAllMenuItem);
            RunSelectedCommand = new ToolStripMenuElement(runSelectedMenuItem);
            RunFailedCommand   = new ToolStripMenuElement(runFailedMenuItem);
            StopRunCommand     = new ToolStripMenuElement(stopRunMenuItem);

            FormatButton  = new ToolStripElement(formatButton);
            DisplayFormat = new CheckedMenuGroup(
                "displayFormat",
                nunitTreeMenuItem, fixtureListMenuItem, testListMenuItem);
            GroupBy = new CheckedMenuGroup(
                "testGrouping",
                byAssemblyMenuItem, byFixtureMenuItem, byCategoryMenuItem, byOutcomeMenuItem, byDurationMenuItem);

            RunContextCommand         = new ToolStripMenuElement(this.runMenuItem);
            RunCheckedCommand         = new ToolStripMenuElement(this.runCheckedMenuItem);
            ShowCheckBoxes            = new ToolStripMenuElement(showCheckboxesMenuItem);
            ExpandAllCommand          = new ToolStripMenuElement(expandAllMenuItem);
            CollapseAllCommand        = new ToolStripMenuElement(collapseAllMenuItem);
            CollapseToFixturesCommand = new ToolStripMenuElement(collapseToFixturesMenuItem);

            Tree = new TreeViewElement(treeView);
        }
Пример #3
0
        protected virtual void OnFormatting()
        {
            RadTreeViewElement treeViewElement = TreeViewElement;

            if (treeViewElement != null && treeViewElement.AllowAlternatingRowColor)
            {
                bool alternatingAllowed = !treeViewElement.FullRowSelect || (!Data.Current && !Data.Selected && !HotTracking);
                int  index = treeViewElement.FirstVisibleIndex + this.Parent.Children.IndexOf(this);
                if (alternatingAllowed && index % 2 != 0)
                {
                    DrawFill            = true;
                    GradientStyle       = GradientStyles.Solid;
                    BackColor           = treeViewElement.AlternatingRowColor;
                    StretchHorizontally = true;
                    this.states[TreeNodeElement.AlrternatingColorSetState] = true;
                    TreeViewElement.OnNodeFormatting(new TreeNodeFormattingEventArgs(this));
                    return;
                }
            }

            if (this.states[TreeNodeElement.AlrternatingColorSetState])
            {
                ResetValue(DrawFillProperty, ValueResetFlags.Local);
                ResetValue(GradientStyleProperty, ValueResetFlags.Local);
                ResetValue(BackColorProperty, ValueResetFlags.Local);
                ResetValue(StretchHorizontallyProperty, ValueResetFlags.Local);
            }

            TreeViewElement.OnNodeFormatting(new TreeNodeFormattingEventArgs(this));
        }
Пример #4
0
        public TestTreeView()
        {
            InitializeComponent();

            RunContextCommand         = new CommandMenuElement(this.runMenuItem);
            RunCheckedCommand         = new CommandMenuElement(this.runCheckedMenuItem);
            DebugContextCommand       = new CommandMenuElement(this.debugMenuItem);
            DebugCheckedCommand       = new CommandMenuElement(this.debugCheckedMenuItem);
            ActiveConfiguration       = new PopupMenuElement(this.activeConfigMenuItem);
            ShowCheckBoxes            = new CheckedMenuElement(showCheckboxesMenuItem);
            ExpandAllCommand          = new CommandMenuElement(expandAllMenuItem);
            CollapseAllCommand        = new CommandMenuElement(collapseAllMenuItem);
            CollapseToFixturesCommand = new CommandMenuElement(collapseToFixturesMenuItem);
            TestPropertiesCommand     = new CommandMenuElement(testPropertiesMenuItem);
            ViewAsXmlCommand          = new CommandMenuElement(viewAsXmlMenuItem);

            Tree = new TreeViewElement(treeView);
            treeView.MouseDown += (s, e) =>
            {
                if (e.Button == MouseButtons.Right)
                {
                    ContextNode = treeView.GetNodeAt(e.X, e.Y);
                }
            };
        }
Пример #5
0
        public override void OnDragHoverOn(TreeViewElement hoveredPotentialAttachElements, TreeViewElement previousHoveredPotentialAttachElements)
        {
            if (previousHoveredPotentialAttachElements != null)
            {
                previousHoveredPotentialAttachElements.GetAssociatedTreeViewSelectable().Unhighlight();
            }

            if (hoveredPotentialAttachElements != null)
            {
                hoveredPotentialAttachElements.GetAssociatedTreeViewSelectable().Highlight();
            }
        }
Пример #6
0
        private static void SeedChild(EFContext context, string name, string urlSlug, string parentUrlSlug)
        {
            TreeViewElement el = context.categories.FirstOrDefault(x => x.UrlSlug == parentUrlSlug);

            if (el != null)
            {
                context.categories.Add(new TreeViewElement {
                    Name     = name,
                    UrlSlug  = urlSlug,
                    ParentId = el.Id
                });

                context.SaveChanges();
            }
        }
 public Navigator UseWindow(int windowIndex)
 {
     _windowId = windowIndex;
     _container = _runningApp.GetWindows()[windowIndex];
     _button = null;
     _checkBox = null;
     _label = null;
     _radioButton = null;
     _textBox = null;
     _comboBox = null;
     _image = null;
     _tab = null;
     _treeView = null;
     _panel = null;
     return this;
 }
Пример #8
0
        public TestTreeView()
        {
            InitializeComponent();

            RunCommand            = new MenuCommand(runMenuItem);
            ShowCheckBoxes        = new CheckedMenuItem(showCheckBoxesMenuItem);
            ShowFailedAssumptions = new CheckedMenuItem(failedAssumptionsMenuItem);
            ExpandAllCommand      = new MenuCommand(expandAllMenuItem);
            CollapseAllCommand    = new MenuCommand(collapseAllMenuItem);
            HideTestsCommand      = new MenuCommand(hideTestsMenuItem);
            PropertiesCommand     = new MenuCommand(propertiesMenuItem);
            ClearAllCheckBoxes    = new ButtonElement(clearAllButton);
            CheckFailedTests      = new ButtonElement(checkFailedButton);
            Tree = new TreeViewElement(tree);

            WireUpEvents();
        }
Пример #9
0
 public override void OnAttachTo(TreeViewElement newParent)
 {
     if (newParent != null)
     {
         newParent.GetAssociatedTreeViewSelectable().Unhighlight();
         if (!newParent.isRoot)
         {
             GetAssociatedUnit().ChangeParentTo((newParent as UIOrdobTreeViewElement).GetAssociatedUnit());
         }
         else
         {
             GetAssociatedUnit().ChangeParentTo(null);
         }
     }
     else
     {
         GetAssociatedUnit().ChangeParentTo(GetAssociatedUnit().GetParentActorAsUnit());
     }
 }
Пример #10
0
        public TestTreeView()
        {
            InitializeComponent();

            RunButton             = new SplitButtonElement(runButton);
            RunAllCommand         = new ToolStripMenuElement(runAllMenuItem);
            RunSelectedCommand    = new ToolStripMenuElement(runSelectedMenuItem);
            RunFailedCommand      = new ToolStripMenuElement(runFailedMenuItem);
            TestParametersCommand = new ToolStripMenuElement(testParametersMenuItem);
            StopRunCommand        = new ToolStripMenuElement(stopRunMenuItem);

            DebugButton          = new SplitButtonElement(debugButton);
            DebugAllCommand      = new ToolStripMenuElement(debugAllMenuItem);
            DebugSelectedCommand = new ToolStripMenuElement(debugSelectedMenuItem);
            DebugFailedCommand   = new ToolStripMenuElement(debugFailedMenuItem);

            FormatButton  = new ToolStripElement(formatButton);
            DisplayFormat = new CheckedToolStripMenuGroup(
                "displayFormat",
                nunitTreeMenuItem, fixtureListMenuItem, testListMenuItem);
            GroupBy = new CheckedToolStripMenuGroup(
                "testGrouping",
                byAssemblyMenuItem, byFixtureMenuItem, byCategoryMenuItem, byExtendedCategoryMenuItem, byOutcomeMenuItem, byDurationMenuItem);

            RunContextCommand         = new ToolStripMenuElement(this.runMenuItem);
            RunCheckedCommand         = new ToolStripMenuElement(this.runCheckedMenuItem);
            DebugContextCommand       = new ToolStripMenuElement(this.debugMenuItem);
            DebugCheckedCommand       = new ToolStripMenuElement(this.debugCheckedMenuItem);
            ActiveConfiguration       = new ToolStripMenuElement(this.activeConfigMenuItem);
            ShowCheckBoxes            = new ToolStripMenuElement(showCheckboxesMenuItem);
            ExpandAllCommand          = new ToolStripMenuElement(expandAllMenuItem);
            CollapseAllCommand        = new ToolStripMenuElement(collapseAllMenuItem);
            CollapseToFixturesCommand = new ToolStripMenuElement(collapseToFixturesMenuItem);

            Tree = new TreeViewElement(treeView);
            treeView.MouseDown += (s, e) =>
            {
                if (e.Button == MouseButtons.Right)
                {
                    ContextNode = treeView.GetNodeAt(e.X, e.Y);
                }
            };
        }
Пример #11
0
        public TestTreeView()
        {
            InitializeComponent();

            RunCommand            = new CommandMenuElement(runMenuItem);
            ShowFailedAssumptions = new CheckedMenuElement(failedAssumptionsMenuItem);
            ProjectMenu           = new PopupMenuElement(projectMenuItem);
            ActiveConfiguration   = new PopupMenuElement(activeConfigurationMenuItem);
            EditProject           = new CommandMenuElement(editProjectMenuItem);
            PropertiesCommand     = new CommandMenuElement(propertiesMenuItem);
            ShowCheckBoxes        = new CheckedMenuElement(showCheckBoxesMenuItem);
            ExpandAllCommand      = new CommandMenuElement(expandAllMenuItem);
            CollapseAllCommand    = new CommandMenuElement(collapseAllMenuItem);
            HideTestsCommand      = new CommandMenuElement(hideTestsMenuItem);
            ClearAllCheckBoxes    = new ButtonElement(clearAllButton);
            CheckFailedTests      = new ButtonElement(checkFailedButton);
            Tree = new TreeViewElement(tree);

            WireUpEvents();
        }
        public ConfigDesignerElement(View view)
            : base(view)
        {
            var mainPanel = new StackPanelElement(view);

            // TreeView
            var itemsTreeView = new TreeViewElement(view);

            itemsTreeView.SetKeyProperty("Key");
            itemsTreeView.SetParentProperty("Parent");
            itemsTreeView.SetDisplayProperty("Text");
            itemsTreeView.SetImageProperty("Image");
            itemsTreeView.SetShowNodeImages(true);
            itemsTreeView.OnDoubleClick += OnEditItemHandler;
            mainPanel.AddItem(itemsTreeView);

            // ToolBar
            var toolBar = new ToolBarElement(view);

            mainPanel.AddItem(toolBar);

            // ContextMenu
            var contextMenu = new ContextMenuElement(view);

            itemsTreeView.SetContextMenu(contextMenu);

            // Update

            var updateItemsButton = new ToolBarButtonItem(view);

            updateItemsButton.SetText(Resources.DocumentDesignerRefreshButton);
            updateItemsButton.SetImage("Actions/Refresh_16x16");
            updateItemsButton.SetHotkey("F5");
            updateItemsButton.OnClick += OnUpdateItemsHandler;
            toolBar.AddItem(updateItemsButton);

            var updateItemsMenuButton = new ContextMenuItem(view);

            updateItemsMenuButton.SetText(Resources.DocumentDesignerRefreshButton);
            updateItemsMenuButton.SetImage("Actions/Refresh_16x16");
            updateItemsMenuButton.SetHotkey("F5");
            updateItemsMenuButton.OnClick += OnUpdateItemsHandler;
            contextMenu.AddItem(updateItemsMenuButton);

            // Separator

            var separator = new ToolBarSeparatorItem(view);

            toolBar.AddItem(separator);

            var menuSeparator = new ContextMenuItemSeparator(view);

            contextMenu.AddItem(menuSeparator);

            // Add

            var addItemButton = new ToolBarPopupButtonItem(view);

            addItemButton.SetText(Resources.DocumentDesignerAddButton);
            addItemButton.SetImage("Actions/Add_16x16");
            addItemButton.SetHotkey("Ctrl+N");
            toolBar.AddItem(addItemButton);

            var addItemMenuButton = new ContextMenuItem(view);

            addItemMenuButton.SetText(Resources.DocumentDesignerAddButton);
            addItemMenuButton.SetImage("Actions/Add_16x16");
            addItemMenuButton.SetHotkey("Ctrl+N");
            contextMenu.AddItem(addItemMenuButton);

            // Edit

            var editItemButton = new ToolBarButtonItem(view);

            editItemButton.SetText(Resources.DocumentDesignerEditButton);
            editItemButton.SetImage("Actions/Edit_16x16");
            editItemButton.SetHotkey("Ctrl+O");
            editItemButton.OnClick += OnEditItemHandler;
            toolBar.AddItem(editItemButton);

            var editItemMenuButton = new ContextMenuItem(view);

            editItemMenuButton.SetText(Resources.DocumentDesignerEditButton);
            editItemMenuButton.SetImage("Actions/Edit_16x16");
            editItemMenuButton.SetHotkey("Ctrl+O");
            editItemMenuButton.OnClick += OnEditItemHandler;
            contextMenu.AddItem(editItemMenuButton);

            // Delete

            var deleteItemButton = new ToolBarButtonItem(view);

            deleteItemButton.SetText(Resources.DocumentDesignerDeleteButton);
            deleteItemButton.SetImage("Actions/Delete_16x16");
            deleteItemButton.SetHotkey("Ctrl+Delete");
            deleteItemButton.OnClick += OnDeleteItemHandler;
            toolBar.AddItem(deleteItemButton);

            var deleteItemMenuButton = new ContextMenuItem(view);

            deleteItemMenuButton.SetText(Resources.DocumentDesignerDeleteButton);
            deleteItemMenuButton.SetImage("Actions/Delete_16x16");
            deleteItemMenuButton.SetHotkey("Ctrl+Delete");
            deleteItemMenuButton.OnClick += OnDeleteItemHandler;
            contextMenu.AddItem(deleteItemMenuButton);

            _itemsTreeView     = itemsTreeView;
            _addItemButton     = addItemButton;
            _addItemMenuButton = addItemMenuButton;

            Control.Content = mainPanel.GetControl();
        }
        public DocumentSchemaDesignerElement(View view)
            : base(view)
        {
            var mainPanel = new StackPanelElement(view);

            // TreeView
            var treeView = new TreeViewElement(view);

            treeView.SetKeyProperty("Key");
            treeView.SetParentProperty("Parent");
            treeView.SetImageProperty("Image");
            treeView.SetDisplayProperty("Tag.Text");
            treeView.SetShowNodeImages(true);
            treeView.OnDoubleClick += OnEditPropertyHandler;
            mainPanel.AddItem(treeView);

            // ToolBar
            var toolBar = new ToolBarElement(view);

            mainPanel.AddItem(toolBar);

            // ContextMenu
            var contextMenu = new ContextMenuElement(view);

            treeView.SetContextMenu(contextMenu);

            // Add

            var addButton = new ToolBarPopupButtonItem(view);

            addButton.SetText(Resources.DocumentSchemaDesignerAddButton);
            addButton.SetImage("Actions/Add_16x16");
            addButton.SetHotkey("Ctrl+N");
            toolBar.AddItem(addButton);

            var addMenuButton = new ContextMenuItem(view);

            addMenuButton.SetText(Resources.DocumentSchemaDesignerAddButton);
            addMenuButton.SetImage("Actions/Add_16x16");
            addMenuButton.SetHotkey("Ctrl+N");
            contextMenu.AddItem(addMenuButton);

            // Edit

            var editButton = new ToolBarButtonItem(view);

            editButton.SetText(Resources.DocumentSchemaDesignerEditButton);
            editButton.SetImage("Actions/Edit_16x16");
            editButton.SetHotkey("Ctrl+O");
            editButton.OnClick += OnEditPropertyHandler;
            toolBar.AddItem(editButton);

            var editMenuButton = new ContextMenuItem(view);

            editMenuButton.SetText(Resources.DocumentSchemaDesignerEditButton);
            editMenuButton.SetImage("Actions/Edit_16x16");
            editMenuButton.SetHotkey("Ctrl+O");
            editMenuButton.OnClick += OnEditPropertyHandler;
            contextMenu.AddItem(editMenuButton);

            // Delete

            var deleteButton = new ToolBarButtonItem(view);

            deleteButton.SetText(Resources.DocumentSchemaDesignerDeleteButton);
            deleteButton.SetImage("Actions/Delete_16x16");
            deleteButton.SetHotkey("Ctrl+Delete");
            deleteButton.OnClick += OnDeletePropertyHandler;
            toolBar.AddItem(deleteButton);

            var deleteMenuButton = new ContextMenuItem(view);

            deleteMenuButton.SetText(Resources.DocumentSchemaDesignerDeleteButton);
            deleteMenuButton.SetImage("Actions/Delete_16x16");
            deleteMenuButton.SetHotkey("Ctrl+Delete");
            deleteMenuButton.OnClick += OnDeletePropertyHandler;
            contextMenu.AddItem(deleteMenuButton);

            // Separator1

            var separator1 = new ToolBarSeparatorItem(view);

            toolBar.AddItem(separator1);

            var menuSeparator1 = new ContextMenuItemSeparator(view);

            contextMenu.AddItem(menuSeparator1);

            // Cut

            var cutButton = new ToolBarButtonItem(view);

            cutButton.SetToolTip(Resources.DocumentSchemaDesignerCutButtonToolTip);
            cutButton.SetImage("Actions/Cut_16x16");
            cutButton.SetHotkey("Ctrl+X");
            cutButton.OnClick += OnCutPropertyHandler;
            toolBar.AddItem(cutButton);

            var cutMenuButton = new ContextMenuItem(view);

            cutMenuButton.SetText(Resources.DocumentSchemaDesignerCutButton);
            cutMenuButton.SetImage("Actions/Cut_16x16");
            cutMenuButton.SetHotkey("Ctrl+X");
            cutMenuButton.OnClick += OnCutPropertyHandler;
            contextMenu.AddItem(cutMenuButton);

            // Copy

            var copyButton = new ToolBarButtonItem(view);

            copyButton.SetToolTip(Resources.DocumentSchemaDesignerCopyButtonToolTip);
            copyButton.SetImage("Actions/Copy_16x16");
            copyButton.SetHotkey("Ctrl+C");
            copyButton.OnClick += OnCopyPropertyHandler;
            toolBar.AddItem(copyButton);

            var copyMenuButton = new ContextMenuItem(view);

            copyMenuButton.SetText(Resources.DocumentSchemaDesignerCopyButton);
            copyMenuButton.SetImage("Actions/Copy_16x16");
            copyMenuButton.SetHotkey("Ctrl+C");
            copyMenuButton.OnClick += OnCopyPropertyHandler;
            contextMenu.AddItem(copyMenuButton);

            // Paste

            var pasteButton = new ToolBarButtonItem(view);

            pasteButton.SetToolTip(Resources.DocumentSchemaDesignerPasteButtonToolTip);
            pasteButton.SetImage("Actions/Paste_16x16");
            pasteButton.SetHotkey("Ctrl+V");
            pasteButton.OnClick += OnPastePropertyHandler;
            toolBar.AddItem(pasteButton);

            var pasteMenuButton = new ContextMenuItem(view);

            pasteMenuButton.SetText(Resources.DocumentSchemaDesignerPasteButton);
            pasteMenuButton.SetImage("Actions/Paste_16x16");
            pasteMenuButton.SetHotkey("Ctrl+V");
            pasteMenuButton.OnClick += OnPastePropertyHandler;
            contextMenu.AddItem(pasteMenuButton);

            // Separator2

            var separator2 = new ToolBarSeparatorItem(view);

            toolBar.AddItem(separator2);

            var menuSeparator2 = new ContextMenuItemSeparator(view);

            contextMenu.AddItem(menuSeparator2);

            // MoveUp

            var moveUpButton = new ToolBarButtonItem(view);

            moveUpButton.SetToolTip(Resources.DocumentSchemaDesignerMoveUpButtonToolTip);
            moveUpButton.SetImage("Actions/MoveUp_16x16");
            moveUpButton.SetHotkey("Alt+Up");
            moveUpButton.OnClick += OnMoveUpPropertyHandler;
            toolBar.AddItem(moveUpButton);

            var moveUpMenuButton = new ContextMenuItem(view);

            moveUpMenuButton.SetText(Resources.DocumentSchemaDesignerMoveUpButton);
            moveUpMenuButton.SetImage("Actions/MoveUp_16x16");
            moveUpMenuButton.SetHotkey("Alt+Up");
            moveUpMenuButton.OnClick += OnMoveUpPropertyHandler;
            contextMenu.AddItem(moveUpMenuButton);

            // MoveDown

            var moveDownButton = new ToolBarButtonItem(view);

            moveDownButton.SetToolTip(Resources.DocumentSchemaDesignerMoveDownButtonToolTip);
            moveDownButton.SetImage("Actions/MoveDown_16x16");
            moveDownButton.SetHotkey("Alt+Down");
            moveDownButton.OnClick += OnMoveDownPropertyHandler;
            toolBar.AddItem(moveDownButton);

            var moveDownMenuButton = new ContextMenuItem(view);

            moveDownMenuButton.SetText(Resources.DocumentSchemaDesignerMoveDownButton);
            moveDownMenuButton.SetImage("Actions/MoveDown_16x16");
            moveDownMenuButton.SetHotkey("Alt+Down");
            moveDownMenuButton.OnClick += OnMoveDownPropertyHandler;
            contextMenu.AddItem(moveDownMenuButton);

            _treeView      = treeView;
            _addButton     = addButton;
            _addMenuButton = addMenuButton;

            Control.Content = mainPanel.GetControl();

            // Пустое дерево модели данных
            SetValue(null);
        }
Пример #14
0
        public static IElement ParseElement(string localizedType, string designedId, string designedName, IElement parent)
        {
            IElement element = null;

            switch (localizedType.ToLower())
            {
            case ElementBase.WINDOW:
                element = new WindowElement();
                element.Attributes.ElementType = ElementBase.WINDOW_TYPE;
                break;

            case ElementBase.DIALOG:
                element = new WindowElement();
                element.Attributes.ElementType = ElementBase.DIALOG_TYPE;
                break;

            case ElementBase.BUTTON:
                element = new ButtonElement();
                element.Attributes.ElementType = ElementBase.BUTTON_TYPE;
                break;

            case ElementBase.COMBO_BOX:
                element = new ComboBoxElement();
                element.Attributes.ElementType = ElementBase.COMBOBOX_TYPE;
                break;

            case ElementBase.TEXT:
                element = new TextElement();
                element.Attributes.ElementType = ElementBase.TEXT_TYPE;
                break;

            case ElementBase.PANE:
                element = new ContainerElement();
                element.Attributes.ElementType = ElementBase.CONTAINER_TYPE;
                break;

            case ElementBase.TITLE_BAR:
                element = new TitleBarElement();
                element.Attributes.ElementType = ElementBase.TITLEBAR_TYPE;
                break;

            case ElementBase.MENU_BAR:
                element = new MenuBarElement();
                element.Attributes.ElementType = ElementBase.MENUBAR_TYPE;
                break;

            case ElementBase.DOCUMENT:
                element = new EditableTextElement();
                element.Attributes.ElementType = ElementBase.EDITABLETEXT_TYPE;
                break;

            case ElementBase.TAB:
                element = new TabPageElement();
                element.Attributes.ElementType = ElementBase.TABPAGE_TYPE;
                break;

            case ElementBase.TAB_ITEM:
                element = new TabItemElement();
                element.Attributes.ElementType = ElementBase.TABITEM_TYPE;
                break;

            case ElementBase.SCROLL_BAR:
                element = new ScrollBarElement();
                element.Attributes.ElementType = ElementBase.SCROLLBAR_TYPE;
                break;

            //case THUMB:
            case ElementBase.TREE:
                element = new TreeViewElement();
                element.Attributes.ElementType = ElementBase.TREEVIEW_TYPE;
                break;

            case ElementBase.TREE_VIEW:
                element = new TreeViewElement();
                element.Attributes.ElementType = ElementBase.TREEVIEW_TYPE;
                break;

            case ElementBase.TREE_ITEM:
                element = new TreeItemElement();
                element.Attributes.ElementType = ElementBase.TREEITEM_TYPE;
                break;

            case ElementBase.TABLE:
                element = new TableElement();
                element.Attributes.ElementType = ElementBase.TABLE_TYPE;
                break;

            //?
            case ElementBase.HEADER:
                element = new HeaderElement();
                element.Attributes.ElementType = ElementBase.HEADER_TYPE;
                break;

            case ElementBase.ITEM:
                if (parent != null && (parent is TableElement || parent is DatagridElement))
                {
                    element = new RowElement();
                    element.Attributes.ElementType = ElementBase.ROW_TYPE;
                }
                break;

            case ElementBase.LIST:     //(listview or checkedlistbox)
                element = new ListElement();
                element.Attributes.ElementType = ElementBase.LIST_TYPE;
                break;

            case ElementBase.LIST_VIEW:     //(listview or checkedlistbox)
                element = new ListElement();
                element.Attributes.ElementType = ElementBase.LIST_TYPE;
                break;

            case ElementBase.LIST_ITEM:     //(table)
                element = new ListItemElement();
                element.Attributes.ElementType = ElementBase.LISTITEM_TYPE;
                break;

            case ElementBase.EDIT:     //textbox
                element = new EditableTextElement();
                element.Attributes.ElementType = ElementBase.EDITABLETEXT_TYPE;
                break;

            case ElementBase.CHECK_BOX:
                element = new CheckBoxElement();
                element.Attributes.ElementType = ElementBase.CHECKBOX_TYPE;
                break;

            case ElementBase.RADIO_BUTTON:
                element = new RadioButtonElement();
                element.Attributes.ElementType = ElementBase.RADIO_BUTTON_TYPE;
                break;

            case ElementBase.CALENDAR:
                element = new CalendarElement();
                element.Attributes.ElementType = "Calendar";
                break;

            case ElementBase.CUSTOM:
                element = new CustomElement();
                element.Attributes.ElementType = "Custom";
                break;

            case ElementBase.DATAGRID:
                element = new DatagridElement();
                element.Attributes.ElementType = "DataGrid";
                break;

            case ElementBase.DATAGRID2:
                element = new DatagridElement();
                element.Attributes.ElementType = "DataGrid";
                break;

            case ElementBase.DATAITEM:
                element = new DataitemElement();
                element.Attributes.ElementType = "dataitem";
                break;

            case ElementBase.GROUP:
                element = new GroupELement();
                element.Attributes.ElementType = ElementBase.GROUP_TYPE;
                break;

            case ElementBase.HEADER_ITEM:
                element = new HeaderItemElement();
                element.Attributes.ElementType = "HeaderItem";
                break;

            case ElementBase.HYPERLINK:
                element = new LinkElement();
                element.Attributes.ElementType = "Hyperlink";
                break;

            case ElementBase.IMAGE:
                element = new ImageElement();
                element.Attributes.ElementType = "Image";
                break;

            case ElementBase.MENU:
                element = new MenuElement();
                element.Attributes.ElementType = "Menu";
                break;

            case ElementBase.PROGRESS_BAR:
                element = new ProgressBarElement();
                element.Attributes.ElementType = "ProgressBar";
                break;

            case ElementBase.SEPARATOR:
                element = new SeparatorElement();
                element.Attributes.ElementType = "Separator";
                break;

            case ElementBase.SLIDER:
                element = new SliderElement();
                element.Attributes.ElementType = "Slider";
                break;

            case ElementBase.SPINNER:
                element = new SpinnerElement();
                element.Attributes.ElementType = "Spinner";
                break;

            case ElementBase.SPLIT_BUTTON:
                element = new SplitButtonElement();
                element.Attributes.ElementType = "SplitButton";
                break;

            case ElementBase.STATUS_BAR:
                element = new StatusBarElement();
                element.Attributes.ElementType = "StatusBar";
                break;

            case ElementBase.TOOL_BAR:
                element = new ToolBarElement();
                element.Attributes.ElementType = "ToolBar";
                break;

            case ElementBase.TOOL_TIP:
                element = new ToolTipElement();
                element.Attributes.ElementType = "ToolTip";
                break;

            //?
            case ElementBase.MENU_ITEM:
                element = new MenuItemElement();
                element.Attributes.ElementType = "MenuItem";
                break;

            case ElementBase.LINK:
                element = new LinkElement();
                element.Attributes.ElementType = ElementBase.LINK_TYPE;
                break;
            }
            if (element == null)
            {
                if (parent is TableElement || parent is DatagridElement)
                {
                    element = new RowElement();
                    element.Attributes.ElementType = ElementBase.ROW_TYPE;
                }
                else if (parent is RowElement)
                {
                    element = new CellElement();
                    element.Attributes.ElementType = ElementBase.CELL_TYPE;
                }
                else
                {
                    element = new UnknownELement();
                    element.Attributes.ElementType = ElementBase.UNKNOWN_TYPE;
                }
            }
            element.Attributes.DesignedId = designedId;
            return(element);
        }
 public TreeViewElement TreeView()
 {
     return _treeView ?? (_treeView = new TreeViewElement(_container));
 }
        public MenuDesignerElement(View view)
            : base(view)
        {
            var mainPanel = new StackPanelElement(view);

            // TreeView
            var treeView = new TreeViewElement(view);

            treeView.SetKeyProperty("Key");
            treeView.SetParentProperty("Parent");
            treeView.SetDisplayProperty("Tag.Text");
            treeView.SetImageProperty("Tag.Image");
            treeView.SetShowNodeImages(true);
            treeView.OnDoubleClick += OnEditItemHandler;
            mainPanel.AddItem(treeView);

            // Root Node
            var rootNode = CreateRootNode();

            // Main Menu
            var toolBar = new ToolBarElement(view);

            mainPanel.AddItem(toolBar);

            // ContextMenu
            var contextMenu = new ContextMenuElement(view);

            treeView.SetContextMenu(contextMenu);

            // Add

            var addButton = new ToolBarButtonItem(view);

            addButton.SetText(Resources.MenuDesignerAddButton);
            addButton.SetImage("Actions/Add_16x16");
            addButton.SetHotkey("Ctrl+N");
            addButton.OnClick += OnAddItemHandler;
            toolBar.AddItem(addButton);

            var addMenuButton = new ContextMenuItem(view);

            addMenuButton.SetText(Resources.MenuDesignerAddButton);
            addMenuButton.SetImage("Actions/Add_16x16");
            addMenuButton.SetHotkey("Ctrl+N");
            addMenuButton.OnClick += OnAddItemHandler;
            contextMenu.AddItem(addMenuButton);

            // Edit

            var editButton = new ToolBarButtonItem(view);

            editButton.SetText(Resources.MenuDesignerEditButton);
            editButton.SetImage("Actions/Edit_16x16");
            editButton.SetHotkey("Ctrl+O");
            editButton.OnClick += OnEditItemHandler;
            toolBar.AddItem(editButton);

            var editMenuButton = new ContextMenuItem(view);

            editMenuButton.SetText(Resources.MenuDesignerEditButton);
            editMenuButton.SetImage("Actions/Edit_16x16");
            editMenuButton.SetHotkey("Ctrl+O");
            editMenuButton.OnClick += OnEditItemHandler;
            contextMenu.AddItem(editMenuButton);

            // Delete

            var deleteButton = new ToolBarButtonItem(view);

            deleteButton.SetText(Resources.MenuDesignerDeleteButton);
            deleteButton.SetImage("Actions/Delete_16x16");
            deleteButton.SetHotkey("Ctrl+Delete");
            deleteButton.OnClick += OnDeleteItemHandler;
            toolBar.AddItem(deleteButton);

            var deleteMenuButton = new ContextMenuItem(view);

            deleteMenuButton.SetText(Resources.MenuDesignerDeleteButton);
            deleteMenuButton.SetImage("Actions/Delete_16x16");
            deleteMenuButton.SetHotkey("Ctrl+Delete");
            deleteMenuButton.OnClick += OnDeleteItemHandler;
            contextMenu.AddItem(deleteMenuButton);

            // Separator1

            var separator1 = new ToolBarSeparatorItem(view);

            toolBar.AddItem(separator1);

            var menuSeparator1 = new ContextMenuItemSeparator(view);

            contextMenu.AddItem(menuSeparator1);

            // Cut

            var cutButton = new ToolBarButtonItem(view);

            cutButton.SetToolTip(Resources.MenuDesignerCutButtonToolTip);
            cutButton.SetImage("Actions/Cut_16x16");
            cutButton.SetHotkey("Ctrl+X");
            cutButton.OnClick += OnCutItemHandler;
            toolBar.AddItem(cutButton);

            var cutMenuButton = new ContextMenuItem(view);

            cutMenuButton.SetText(Resources.MenuDesignerCutButton);
            cutMenuButton.SetImage("Actions/Cut_16x16");
            cutMenuButton.SetHotkey("Ctrl+X");
            cutMenuButton.OnClick += OnCutItemHandler;
            contextMenu.AddItem(cutMenuButton);

            // Copy

            var copyButton = new ToolBarButtonItem(view);

            copyButton.SetToolTip(Resources.MenuDesignerCopyButtonToolTip);
            copyButton.SetImage("Actions/Copy_16x16");
            copyButton.SetHotkey("Ctrl+C");
            copyButton.OnClick += OnCopyItemHandler;
            toolBar.AddItem(copyButton);

            var copyMenuButton = new ContextMenuItem(view);

            copyMenuButton.SetText(Resources.MenuDesignerCopyButton);
            copyMenuButton.SetImage("Actions/Copy_16x16");
            copyMenuButton.SetHotkey("Ctrl+C");
            copyMenuButton.OnClick += OnCopyItemHandler;
            contextMenu.AddItem(copyMenuButton);

            // Paste

            var pasteButton = new ToolBarButtonItem(view);

            pasteButton.SetToolTip(Resources.MenuDesignerPasteButtonToolTip);
            pasteButton.SetImage("Actions/Paste_16x16");
            pasteButton.SetHotkey("Ctrl+V");
            pasteButton.OnClick += OnPasteItemHandler;
            toolBar.AddItem(pasteButton);

            var pasteMenuButton = new ContextMenuItem(view);

            pasteMenuButton.SetText(Resources.MenuDesignerPasteButton);
            pasteMenuButton.SetImage("Actions/Paste_16x16");
            pasteMenuButton.SetHotkey("Ctrl+V");
            pasteMenuButton.OnClick += OnPasteItemHandler;
            contextMenu.AddItem(pasteMenuButton);

            // Separator2

            var separator2 = new ToolBarSeparatorItem(view);

            toolBar.AddItem(separator2);

            var menuSeparator2 = new ContextMenuItemSeparator(view);

            contextMenu.AddItem(menuSeparator2);

            // MoveUp

            var moveUpButton = new ToolBarButtonItem(view);

            moveUpButton.SetToolTip(Resources.MenuDesignerMoveUpButtonToolTip);
            moveUpButton.SetImage("Actions/MoveUp_16x16");
            moveUpButton.SetHotkey("Alt+Up");
            moveUpButton.OnClick += OnMoveUpItemHandler;
            toolBar.AddItem(moveUpButton);

            var moveUpMenuButton = new ContextMenuItem(view);

            moveUpMenuButton.SetText(Resources.MenuDesignerMoveUpButton);
            moveUpMenuButton.SetImage("Actions/MoveUp_16x16");
            moveUpMenuButton.SetHotkey("Alt+Up");
            moveUpMenuButton.OnClick += OnMoveUpItemHandler;
            contextMenu.AddItem(moveUpMenuButton);

            // MoveDown

            var moveDownButton = new ToolBarButtonItem(view);

            moveDownButton.SetToolTip(Resources.MenuDesignerMoveDownButtonToolTip);
            moveDownButton.SetImage("Actions/MoveDown_16x16");
            moveDownButton.SetHotkey("Alt+Down");
            moveDownButton.OnClick += OnMoveDownItemHandler;
            toolBar.AddItem(moveDownButton);

            var moveDownMenuButton = new ContextMenuItem(view);

            moveDownMenuButton.SetText(Resources.MenuDesignerMoveDownButton);
            moveDownMenuButton.SetImage("Actions/MoveDown_16x16");
            moveDownMenuButton.SetHotkey("Alt+Down");
            moveDownMenuButton.OnClick += OnMoveDownItemHandler;
            contextMenu.AddItem(moveDownMenuButton);

            _rootNode = rootNode;
            _treeView = treeView;

            Control.Content = mainPanel.GetControl();

            SetItems(new List <object>());
        }
Пример #17
0
 public void SetAssociatedTreeViewElement(TreeViewElement tve)
 {
     myAssociatedTreeViewElement = tve;
 }