Esempio n. 1
0
        public void Init()
        {
            //TODO:配置文件会被覆盖问题
            QuickConfig.ThisConfig.Reload();
            QuickConfig.ThisConfig.CurrentVersion = Application.ProductVersion;
            QuickConfig.ThisConfig.TrySave();

            m_quickModels = new Dictionary<string, QuickModel>();

            var globalModel = QuickModel.GetModel(QuickModel.GlobalModelName + ".xml");
            m_quickModels.Add(QuickModel.GlobalModelName, globalModel);    //添加全局Model

            foreach (var item in QuickConfig.ThisConfig.ModelName)
            {
                if (!m_quickModels.ContainsKey(item))
                {
                    m_quickModels.Add(item, QuickModel.GetModel(item + ".xml"));
                }
            }

            //装载插件
            QuickPluginLoader.AddAdditionQuickMethodTo(m_quickModels);

            m_quickContextWindowHandler = new QuickContextWindowHandler();
            m_quickContextWindow = new QuickContextWindow(m_quickContextWindowHandler);
            ElementHost.EnableModelessKeyboardInterop(m_quickContextWindow);
        }
Esempio n. 2
0
        private static void Save(QuickModel instance, String filename)
        {
            XmlSerializer xmlsSave = new XmlSerializer(typeof(QuickModel));

            using (FileStream fs = new FileStream(Path.Combine(QuickUtilities.DirectoryFromDomain(@"config\"), filename), FileMode.Create, FileAccess.Write))
            {
                xmlsSave.Serialize(fs, instance);
            }
        }
Esempio n. 3
0
 public QuickModel(QuickModel cloneProperty)
 {
     MethodList        = new List <QuickMethod>();
     this.BorderColorB = cloneProperty.BorderColorB;
     this.BorderColorG = cloneProperty.BorderColorG;
     this.BorderColorR = cloneProperty.BorderColorR;
     this.Left         = cloneProperty.Left;
     this.Search       = cloneProperty.Search;
     this.Top          = cloneProperty.Top;
     this.Width        = cloneProperty.Width;
 }
Esempio n. 4
0
        public static QuickModel GetModel(String filename)
        {
            XmlSerializer ser = new XmlSerializer(typeof(QuickModel));
            QuickModel    ret = null;

            using (FileStream fs = new FileStream(Path.Combine(QuickUtilities.DirectoryFromDomain(@"config\"), filename), FileMode.Open, FileAccess.Read))
            {
                ret = (QuickModel)ser.Deserialize(fs);
                return(ret);
            }
        }
Esempio n. 5
0
        public QuickModel GetFilteredModel(Func <QuickMethod, bool> condition)
        {
            //condition为筛选条件,达到条件者被保留
            QuickModel           model      = new QuickModel();
            Action <QuickMethod> copyAction = (method) => {
                if (condition(method))
                {
                    model.MethodList.Add(method);
                }
            };

            MethodList.ForEach(copyAction);
            return(model);
        }
Esempio n. 6
0
        public static void CreateTemplate()
        {
            var template = new QuickModel();

            template.ProgramName = "kwps.application";
            template.MethodList.Add(new QuickMethod());

            template.BorderColorR = 77;
            template.BorderColorG = 130;
            template.BorderColorB = 228;
            using (var fs = File.Create(QuickUtilities.DirectoryFromDomain(@"config\template.xml")))
            {
                new XmlSerializer(template.GetType()).Serialize(fs, template);
            }
        }
Esempio n. 7
0
 public void ReplaceSubModel(QuickModel m)
 {
     m_subModel = m;
 }