Beispiel #1
0
        private void settingList()
        {
            foreach (Control control in this.item_list.Controls)
            {
                if (control.GetType() == typeof(Component.Function.FunctionCategoryList))
                {
                    Component.Function.FunctionCategoryList categoryList = (Component.Function.FunctionCategoryList)control;
                    Component.Function.FunctionCategoryList copyCL       = categoryList.deepCopy();
                    basic_controls.Add(categoryList);
                    copy_controls.Add(copyCL);
                    foreach (Control item in control.Controls)
                    {
                        if (item.GetType() == typeof(Component.FunctionCategory))
                        {
                            Component.FunctionCategory t             = (Component.FunctionCategory)item;
                            Component.FunctionCategory copy_category = t.deepCopy();
                            copy_category.BackColor = Color.FromArgb(153, 180, 209);
                            copyCL.Controls.Add(copy_category);
                        }
                        if (item.GetType() == typeof(Component.Function.FunctionItemList))
                        {
                            Component.Function.FunctionItemList tmp2    = (Component.Function.FunctionItemList)item;
                            Component.Function.FunctionItemList newList = tmp2.deepCopy();
                            copyCL.Controls.Add(newList);
                            foreach (Control test in tmp2.Controls)
                            {
                                if (test.GetType() == typeof(Component.FunctionItem))
                                {
                                    Component.FunctionItem tmp3    = (Component.FunctionItem)test;
                                    Component.FunctionItem newItem = tmp3.deepCopy();

                                    basicSearchList.Add(tmp3);
                                    copySearchList.Add(newItem);
                                    newList.Controls.Add(newItem);
                                }
                            }
                        }
                    }
                }
            }
        }
Beispiel #2
0
        private void getButtonItems()
        {
            mn = MainForm.getInstance;
            Component.Function.FunctionItemList     ItemList     = new Component.Function.FunctionItemList();
            Component.Function.FunctionCategoryList CategoryList = new Component.Function.FunctionCategoryList();
            string temp = "test";

            string folderName = mn.AppName;
            string path       = mn.DataPath + @"\" + folderName + "/press.xml";

            try
            {
                using (XmlReader reader = XmlReader.Create(path))
                {
                    while (reader.Read())
                    {
                        // Only detect start elements.
                        if (reader.IsStartElement())
                        {
                            // Get element name and switch on it.
                            switch (reader.Name)
                            {
                            case "press":
                                string Name = reader["name"];
                                if (Name != null)
                                {
                                }
                                // Next read will contain text.
                                break;

                            case "category":
                                //  Console.WriteLine("Start <category> element.");
                                string category_name = reader["category_name"];
                                Console.WriteLine(category_name);
                                if (category_name != null)
                                {
                                    CategoryList          = new Component.Function.FunctionCategoryList();
                                    CategoryList.Category = category_name;
                                    Component.FunctionCategory buttonCategory = new Component.FunctionCategory();
                                    buttonCategory.SetForm      = this;
                                    buttonCategory.CategoryName = category_name;
                                    temp = category_name;
                                    CategoryList.Controls.Add(buttonCategory);
                                    ItemList            = new Component.Function.FunctionItemList();
                                    ItemList.AutoScroll = false;
                                    ItemList.Category   = category_name;
                                    ItemList.Visible    = false;

                                    CategoryList.Controls.Add(ItemList);
                                    this.item_list.Controls.Add(CategoryList);
                                }
                                break;

                            case "toolName":
                                //  Console.WriteLine("Start <press> element.");

                                string pressExcuteType  = reader["excuteType"];
                                string pressMessageType = reader["messageType"]; //command
                                string pressActionType  = reader["actionType"];  //settool
                                string pressTypeKey     = reader["typeKey"];     //paintbrushtool
                                string pressFormName    = reader["formName"];    //브러쉬
                                string pressKeycode     = reader["keyCode"];
                                string pressisMulti     = reader["multi"];
                                if (pressMessageType != null && pressTypeKey != null && pressFormName != null)
                                {
                                    Component.FunctionItem buttonItem = new Component.FunctionItem();

                                    buttonItem.SetForm     = this;
                                    buttonItem.deviceCheck = false;
                                    buttonItem.ExcuteType  = pressExcuteType;
                                    buttonItem.MsgType     = pressMessageType;
                                    buttonItem.ActionType  = pressActionType;
                                    buttonItem.FormName    = pressFormName;
                                    buttonItem.TypeKey     = pressTypeKey;
                                    if (!pressKeycode.Equals("") && !pressisMulti.Equals(""))
                                    {
                                        buttonItem.Keycode1 = Int32.Parse(pressKeycode);
                                        buttonItem.Multi1   = Int32.Parse(pressisMulti);
                                    }
                                    buttonItem.CategoryName = temp;
                                    ItemList.Controls.Add(buttonItem);
                                }
                                break;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
Beispiel #3
0
        public void getEncoderItems()
        {
            mn = MainForm.getInstance;
            Component.Function.FunctionItemList     ItemList     = new Component.Function.FunctionItemList();
            Component.Function.FunctionCategoryList categoryList = new Component.Function.FunctionCategoryList();
            try
            {
                string folderName          = mn.AppName;
                string path                = mn.DataPath + @"\" + folderName;
                System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(path);
                if (!di.Exists)
                {
                    di.Create();
                }
                path = mn.DataPath + @"\" + folderName + "/rotate.xml";

                using (XmlReader reader = XmlReader.Create(path))
                {
                    while (reader.Read())
                    {
                        // Only detect start elements.
                        if (reader.IsStartElement())
                        {
                            // Get element name and switch on it.
                            switch (reader.Name)
                            {
                            case "rotate":

                                string Name = reader["name"];
                                if (Name != null)
                                {
                                    // Console.WriteLine("  Has attribute name: " + Name);
                                }
                                // Next read will contain text.
                                break;

                            case "category":
                                // Console.WriteLine("Start <category> element.");
                                string category_name = reader["category_name"];
                                if (category_name != null)
                                {
                                    categoryList          = new Component.Function.FunctionCategoryList();
                                    categoryList.Category = category_name;

                                    Component.FunctionCategory encoderCategory = new Component.FunctionCategory();
                                    encoderCategory.CategoryName = category_name;
                                    encoderCategory.SetForm      = this;
                                    categoryList.Controls.Add(encoderCategory);
                                    ItemList            = new Component.Function.FunctionItemList();
                                    ItemList.Category   = category_name;
                                    ItemList.AutoScroll = false;
                                    ItemList.Visible    = false;
                                    categoryList.Controls.Add(ItemList);
                                    this.item_list.Controls.Add(categoryList);
                                }
                                break;

                            case "rotateName":
                                // Console.WriteLine("Start <press> element.");
                                string excuteType         = reader["excuteType"];
                                string rotateMsgType      = reader["messageType"];
                                string rotateActionType   = reader["actionType"];
                                string rotateTypeKey      = reader["typeKey"];
                                string rotateFormName     = reader["formName"];
                                string rotateLeftKeycode  = reader["keycode1"];
                                string rotateRightKeycode = reader["keycode2"];
                                string rotateLeftMulti    = reader["multi1"];
                                string rotateRightMulti   = reader["multi2"];

                                if (rotateMsgType != null && rotateFormName != null)
                                {
                                    Component.FunctionItem encoderItem = new Component.FunctionItem();
                                    encoderItem.deviceCheck = true;
                                    encoderItem.SetForm     = this;
                                    encoderItem.ExcuteType  = excuteType;
                                    encoderItem.FormName    = rotateFormName;
                                    encoderItem.MsgType     = rotateMsgType;
                                    encoderItem.ActionType  = rotateActionType;
                                    encoderItem.TypeKey     = rotateTypeKey;
                                    encoderItem.Keycode1    = Int32.Parse(rotateLeftKeycode);
                                    encoderItem.Keycode2    = Int32.Parse(rotateRightKeycode);
                                    encoderItem.Multi1      = Int32.Parse(rotateLeftMulti);
                                    encoderItem.Multi2      = Int32.Parse(rotateRightMulti);
                                    ItemList.Controls.Add(encoderItem);
                                }
                                break;
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                /**
                 *@Exception -> rotate , press 정보가 없을시.
                 */

                // MessageBox.Show(e.Message);
            }
        }