예제 #1
0
        public void reloadList()
        {
            SaveData.loadData();

            ItemPanel.Controls.Clear();

            foreach (var action in SaveData.data.Descendants("action"))
            {
                ExecutionItem newItem = new ExecutionItem();
                string        title   = "";
                string        path    = "";
                bool          enabled = false;
                string        handler = "";

                string type = (string)action.Attribute("type");
                foreach (var titleProp in action.Descendants("title"))
                {
                    title = titleProp.Value;
                }
                foreach (var pathProp in action.Descendants("path"))
                {
                    path = pathProp.Value;
                }
                foreach (var runProp in action.Descendants("run"))
                {
                    if (runProp.Value == "True")
                    {
                        enabled = true;
                    }
                }
                foreach (var handlerProp in action.Descendants("handler"))
                {
                    handler = handlerProp.Value;
                }

                if (path.Contains("\\"))
                {
                    path = path.Split('\\')[path.Split('\\').Count() - 1];
                }

                if (handler.Contains("\\"))
                {
                    handler = handler.Split('\\')[handler.Split('\\').Count() - 1];
                }

                if (handler != "")
                {
                    if (handler == "(default)")
                    {
                        handler = "default"; //so it looks right
                    }
                    path += " (" + handler + ")";
                }

                newItem.SetProperties(title, path, enabled, type);
                newItem.manager = this;
                newItem.id      = (string)action.Attribute("id");

                ItemPanel.Controls.Add(newItem);
            }
        }