Example #1
0
        /// <summary>
        /// 创建菜单项
        /// </summary>
        /// <param name="node">节点</param>
        /// <param name="menu">菜单</param>
        /// <param name="parentItem">父节点</param>
        protected override void CreateMenuItem(XmlNode node, MenuA menu, MenuItemA parentItem)
        {
            MenuItemA item = new MenuItemA();

            item.Native = Native;
            item.Font   = new FONT("微软雅黑", 12, false, false, false);
            SetAttributesBefore(node, item);
            if (parentItem != null)
            {
                parentItem.AddItem(item);
            }
            else
            {
                menu.AddItem(item);
            }
            if (node.ChildNodes != null && node.ChildNodes.Count > 0)
            {
                foreach (XmlNode subNode in node.ChildNodes)
                {
                    CreateMenuItem(subNode, menu, item);
                }
            }
            SetAttributesAfter(node, item);
            OnAddControl(item, node);
        }
Example #2
0
        /// <summary>
        /// 显示右键菜单
        /// </summary>
        /// <param name="var">变量</param>
        /// <returns>状态</returns>
        private double SHOWRIGHTMENU(CVariable var)
        {
            GaiaScript  gaiaScript = m_xml.Script as GaiaScript;
            INativeBase native     = m_xml.Native;
            ControlA    control    = m_xml.FindControl(gaiaScript.GetSender());
            int         clientX    = native.ClientX(control);
            int         clientY    = native.ClientY(control);
            MenuA       menu       = m_xml.GetMenu(m_indicator.GetText(var.m_parameters[0]));

            menu.Location = new POINT(clientX, clientY + control.Height);
            menu.Visible  = true;
            menu.Focused  = true;
            menu.BringToFront();
            native.Invalidate();
            return(0);
        }
Example #3
0
        /// <summary>
        /// 创建内部控件
        /// </summary>
        /// <param name="parent">父控件</param>
        /// <param name="clsid">控件标识</param>
        /// <returns>内部控件</returns>
        public override ControlA CreateInternalControl(ControlA parent, String clsid)
        {
            //日历控件
            CalendarA calendar = parent as CalendarA;

            if (calendar != null)
            {
                if (clsid == "datetitle")
                {
                    return(new DateTitle(calendar));
                }
                else if (clsid == "headdiv")
                {
                    HeadDiv headDiv = new HeadDiv(calendar);
                    headDiv.Width = parent.Width;
                    headDiv.Dock  = DockStyleA.Top;
                    return(headDiv);
                }
                else if (clsid == "lastbutton")
                {
                    return(new ArrowButton(calendar));
                }
                else if (clsid == "nextbutton")
                {
                    ArrowButton nextBtn = new ArrowButton(calendar);
                    nextBtn.ToLast = false;
                    return(nextBtn);
                }
            }
            //分割层
            SplitLayoutDivA splitLayoutDiv = parent as SplitLayoutDivA;

            if (splitLayoutDiv != null)
            {
                if (clsid == "splitter")
                {
                    ButtonA splitter = new ButtonA();
                    splitter.BackColor = CDraw.PCOLORS_BACKCOLOR;
                    splitter.Size      = new SIZE(5, 5);
                    return(splitter);
                }
            }
            //滚动条
            ScrollBarA scrollBar = parent as ScrollBarA;

            if (scrollBar != null)
            {
                scrollBar.BackColor = COLOR.EMPTY;
                if (clsid == "addbutton")
                {
                    RibbonButton addButton = new RibbonButton();
                    addButton.Size = new SIZE(15, 15);
                    if (scrollBar is HScrollBarA)
                    {
                        addButton.ArrowType = 2;
                    }
                    else if (scrollBar is VScrollBarA)
                    {
                        addButton.ArrowType = 4;
                    }
                    return(addButton);
                }
                else if (clsid == "backbutton")
                {
                    ButtonA backButton = new ButtonA();
                    return(backButton);
                }
                else if (clsid == "scrollbutton")
                {
                    ButtonA scrollButton = new ButtonA();
                    scrollButton.AllowDrag   = true;
                    scrollButton.BackColor   = CDraw.PCOLORS_BACKCOLOR;
                    scrollButton.BorderColor = CDraw.PCOLORS_LINECOLOR3;
                    return(scrollButton);
                }
                else if (clsid == "reducebutton")
                {
                    RibbonButton reduceButton = new RibbonButton();
                    reduceButton.Size = new SIZE(15, 15);
                    if (scrollBar is HScrollBarA)
                    {
                        reduceButton.ArrowType = 1;
                    }
                    else if (scrollBar is VScrollBarA)
                    {
                        reduceButton.ArrowType = 3;
                    }
                    return(reduceButton);
                }
            }
            //页夹
            TabPageA tabPage = parent as TabPageA;

            if (tabPage != null)
            {
                if (clsid == "headerbutton")
                {
                    RibbonButton button = new RibbonButton();
                    button.AllowDrag = true;
                    SIZE size = new SIZE(100, 20);
                    button.Size = size;
                    return(button);
                }
            }
            //下拉列表
            ComboBoxA comboBox = parent as ComboBoxA;

            if (comboBox != null)
            {
                if (clsid == "dropdownbutton")
                {
                    RibbonButton dropDownButton = new RibbonButton();
                    dropDownButton.ArrowType     = 4;
                    dropDownButton.DisplayOffset = false;
                    int   width    = comboBox.Width;
                    int   height   = comboBox.Height;
                    POINT location = new POINT(width - 20, 0);
                    dropDownButton.Location = location;
                    SIZE size = new SIZE(20, height);
                    dropDownButton.Size = size;
                    return(dropDownButton);
                }
                else if (clsid == "dropdownmenu")
                {
                    ComboBoxMenu comboBoxMenu = new ComboBoxMenu();
                    comboBoxMenu.ComboBox = comboBox;
                    comboBoxMenu.Popup    = true;
                    SIZE size = new SIZE(100, 200);
                    comboBoxMenu.Size = size;
                    return(comboBoxMenu);
                }
            }
            //日期选择
            DatePickerA datePicker = parent as DatePickerA;

            if (datePicker != null)
            {
                if (clsid == "dropdownbutton")
                {
                    RibbonButton dropDownButton = new RibbonButton();
                    dropDownButton.ArrowType     = 4;
                    dropDownButton.DisplayOffset = false;
                    int   width    = datePicker.Width;
                    int   height   = datePicker.Height;
                    POINT location = new POINT(width - 16, 0);
                    dropDownButton.Location = location;
                    SIZE size = new SIZE(16, height);
                    dropDownButton.Size = size;
                    return(dropDownButton);
                }
                else if (clsid == "dropdownmenu")
                {
                    MenuA dropDownMenu = new MenuA();
                    dropDownMenu.Padding = new PADDING(1);
                    dropDownMenu.Popup   = true;
                    SIZE size = new SIZE(200, 200);
                    dropDownMenu.Size = size;
                    return(dropDownMenu);
                }
            }
            //数字选择
            SpinA spin = parent as SpinA;

            if (spin != null)
            {
                if (clsid == "downbutton")
                {
                    RibbonButton downButton = new RibbonButton();
                    downButton.ArrowType     = 4;
                    downButton.DisplayOffset = false;
                    SIZE size = new SIZE(16, 16);
                    downButton.Size = size;
                    return(downButton);
                }
                else if (clsid == "upbutton")
                {
                    RibbonButton upButton = new RibbonButton();
                    upButton.ArrowType     = 3;
                    upButton.DisplayOffset = false;
                    SIZE size = new SIZE(16, 16);
                    upButton.Size = size;
                    return(upButton);
                }
            }
            //容器层
            DivA div = parent as DivA;

            if (div != null)
            {
                if (clsid == "hscrollbar")
                {
                    HScrollBarA hScrollBar = new HScrollBarA();
                    hScrollBar.Visible = false;
                    hScrollBar.Size    = new SIZE(15, 15);
                    return(hScrollBar);
                }
                else if (clsid == "vscrollbar")
                {
                    VScrollBarA vScrollBar = new VScrollBarA();
                    vScrollBar.Visible = false;
                    vScrollBar.Size    = new SIZE(15, 15);
                    return(vScrollBar);
                }
            }
            //表格
            GridA grid = parent as GridA;

            if (grid != null)
            {
                if (clsid == "edittextbox")
                {
                    TextBoxA textBox = new TextBoxA();
                    textBox.BackColor = CDraw.PCOLORS_BACKCOLOR;
                    return(textBox);
                }
            }
            return(null);
        }
        static void Main(string[] args)
        {
            CommandA comand = new CommandA();

            // MenuA menu = new MenuA();
            MenuA.Introdusing();
            bool generalOptionCycle = true, cycleOption = true;
            int  choice = 0;

            while (generalOptionCycle)
            {
                MenuA.ShowMenu();
                choice = int.Parse(Console.ReadLine());
                switch (choice)
                {
                case 1:
                {
                    cycleOption = true;
                    do
                    {
                        MenuA.ShowTicketMenu();
                        char operation1;
                        operation1 = Convert.ToChar(Console.ReadLine());
                        if (operation1 == 'A')
                        {
                            comand.Write("Ticket");
                        }
                        else if (operation1 == 'B')
                        {
                            comand.ChangeTicket();
                        }
                        else if (operation1 == 'C')
                        {
                            comand.AddTicket();
                        }
                        else if (operation1 == 'D')
                        {
                            comand.Write("Ticket");
                            comand.RemoveByIndexTicket();
                        }
                        else if (operation1 == 'E')
                        {
                            comand.PopularMovie();
                        }
                        else
                        {
                            cycleOption = false;
                        }
                    }while (cycleOption);
                }
                break;

                case 2:
                {
                    cycleOption = true;
                    do
                    {
                        MenuA.ShowMenuHuman();
                        int  operation2 = Convert.ToInt32(Console.ReadLine());
                        bool adminInput = true, adminInput2 = true;
                        if (operation2 == 1)
                        {
                            while (adminInput)
                            {
                                MenuA.ShowActorMenu();
                                char operation3A = Convert.ToChar(Console.ReadLine());
                                switch (operation3A)
                                {
                                case 'A':
                                    comand.Write("Actor");

                                    break;

                                case 'B':
                                {
                                    comand.PopularActor();
                                }
                                break;

                                case 'C':
                                {
                                    comand.AddActor();
                                }
                                break;

                                case 'D':
                                {
                                    comand.Write("Actor");
                                    comand.RemoveByIndexActor();
                                }
                                break;

                                case 'E':
                                {
                                    adminInput = false;
                                    Console.Clear();
                                }
                                break;
                                }
                            }
                            break;
                        }

                        if (operation2 == 2)
                        {
                            while (adminInput2)
                            {
                                MenuA.ShowClientMenu();
                                char operation3 = Convert.ToChar(Console.ReadLine());
                                switch (operation3)
                                {
                                case 'A':
                                {
                                    comand.Write("Client");
                                }
                                break;

                                case 'B':
                                {
                                    comand.PrintRespones();
                                }
                                break;

                                case 'C':
                                {
                                    comand.Write("Client");
                                    comand.RemoveByIndexClient();
                                }
                                break;

                                case 'E':
                                {
                                    comand.ShowPopcorn();
                                }
                                break;

                                case 'D':
                                {
                                    adminInput2 = false;
                                }
                                break;
                                }
                            }
                        }
                        else
                        {
                            cycleOption = false;
                        }
                    } while (cycleOption);
                }
                break;

                case 3:
                {
                    generalOptionCycle = false;
                    break;
                }

                default:
                {
                    Console.WriteLine("Error! Try again");
                }
                break;
                }
            }
        }