예제 #1
0
 private Task SetTabItemText()
 {
     TabItemElement.SetText(DateTime.Now.ToString());
     return(Task.CompletedTask);
 }
예제 #2
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);
        }