예제 #1
0
        public void Import(JsonGestureIntentStore from, bool replace = false)
        {
            if (from == null)
            {
                return;
            }

            if (replace)
            {
                GlobalApp.GestureIntents.Clear();
                GlobalApp.IsGesturingEnabled = from.GlobalApp.IsGesturingEnabled;
                ExeAppsRegistry.Clear();
            }

            GlobalApp.ImportGestures(from.GlobalApp);

            foreach (var kv in from.ExeAppsRegistry)
            {
                ExeApp appInSelf;
                //如果应用程序已经在列表中,则合并手势
                if (TryGetExeApp(kv.Key, out appInSelf))
                {
                    appInSelf.ImportGestures(kv.Value);
                    appInSelf.IsGesturingEnabled = appInSelf.IsGesturingEnabled && kv.Value.IsGesturingEnabled;
                }
                else//否则将app添加到列表中
                {
                    Add(kv.Value);
                }
            }
        }
예제 #2
0
 public void Remove(string key)
 {
     ExeAppsRegistry.Remove(key);
 }
예제 #3
0
 public void Add(ExeApp app)
 {
     ExeAppsRegistry.Add(app.ExecutablePath, app);
 }
예제 #4
0
 public bool TryGetExeApp(string key, out ExeApp found)
 {
     return(ExeAppsRegistry.TryGetValue(key, out found));
 }