Example #1
0
        private void serch(string str)
        {
            this.item_list.Controls.Clear();
            //검색시 스크롤바 넘치면 생성
            showScrollbar();

            if (str.Equals(""))
            {
                //기본 셋팅 리스트를 탐색합니다.
                for (int i = 0; i < basic_controls.Count; i++)
                {
                    if (basic_controls[i].GetType() == typeof(Component.Function.FunctionCategoryList))
                    {
                        Component.Function.FunctionCategoryList category_list = (Component.Function.FunctionCategoryList)basic_controls[i];
                        this.item_list.Controls.Add(basic_controls[i]);
                        foreach (Control c in basic_controls[i].Controls)
                        {
                            if (c is Component.Function.FunctionItemList)
                            {
                                foreach (Control t in c.Controls)
                                {
                                    if (t is Component.FunctionItem)
                                    {
                                        Component.FunctionItem tmp = (Component.FunctionItem)t;
                                        tmp.init();
                                        if (tmp.FormName.Equals(this.selectedFormName))
                                        {
                                            tmp.clickUI();
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                for (int i = 0; i < copySearchList.Count; i++)
                {
                    copySearchList[i].init();
                }
            }
            else
            {
                // 리스트의 모든 데이터를 검색한다.
                for (int i = 0; i < copySearchList.Count; i++)
                {
                    // arraylist의 모든 데이터에 입력받은 단어(charText)가 포함되어 있으면 true를 반환한다.
                    if (copySearchList[i].FormName.ToLower().Contains(serchText.Text.ToLower()))
                    {
                        this.item_list.Controls.Add(copySearchList[i]);
                        if (copySearchList[i].FormName.Equals(this.selectedFormName))
                        {
                            copySearchList[i].clickUI();
                        }
                    }
                }
            }
        }
Example #2
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);
                                }
                            }
                        }
                    }
                }
            }
        }
Example #3
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)
            {
            }
        }
Example #4
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);
            }
        }