private void AddAppToList(ExeApp app) { var item = new ListViewItem(app.Name); var appPath = app.ExecutablePath; item.Tag = app; //get icon using (var thumb = IconHelper.ExtractIconForPath(appPath, new Size((int)(32 * _dpiF), (int)(32 * _dpiF)), app.IsGesturingEnabled)) { var imgIndex = imglistAppIcons.Images.IndexOfKey(appPath); if (imgIndex < 0) { imglistAppIcons.Images.Add(appPath, thumb); } else { imglistAppIcons.Images[imgIndex] = IconHelper.ExtractIconForPath(appPath, new Size((int)(32 * _dpiF), (int)(32 * _dpiF)), app.IsGesturingEnabled); } } item.ImageKey = appPath; if (!app.IsGesturingEnabled) { item.ForeColor = Color.Firebrick; } if (!File.Exists(appPath)) { item.Text += "(不存在)"; item.ForeColor = Color.Gray; } listApps.Items.Add(item); }
/// <summary> /// 判断是否在当前的应用程序上禁用的鼠标手势 /// 如果应用程序没有添加到记录中,则检查全局手是否可用 /// </summary> /// <param name="context"></param> /// <returns></returns> public bool IsGesturingEnabledForContext(GestureContext context, out ExeApp foundApp) { foundApp = GetExeAppByContext(context); return foundApp != null ? foundApp.IsGesturingEnabled : IntentStore.GlobalApp.IsGesturingEnabled; }
public EditAppForm(ExeApp editingApp, IGestureIntentStore intentStore) : this(intentStore) { _isEditingMode = true; _editingApp = editingApp; Text = "修改 \"" + editingApp.Name + "\""; AppName = txtSelectedAppNae.Text = editingApp.Name; AppPath = lnkSelectedAppPath.Text = editingApp.ExecutablePath; groupSelectedApp.Visible = true; btnOk.Enabled = true; toolTip1.SetToolTip(lnkSelectedAppPath, editingApp.ExecutablePath); LoadIcon(editingApp.ExecutablePath); if (!editingApp.AppExists()) { ShowErrorMsg("该应用程序不存在,请确定它的位置"); } }
//private Dictionary<uint, string> _procFileNameDict = new Dictionary<uint, string>(64); /// <summary> /// Native下以进程文件名为key查找。 /// </summary> /// <param name="context"></param> /// <returns></returns> public override ExeApp GetExeAppByContext(GestureContext context) { //全屏模式下禁用 string str; ExeApp found = null; var procId = context.ProcId;//Native.GetActiveProcessId(); Debug.WriteLine("procId=" + procId); //if (!_procFileNameDict.TryGetValue(procId, out str)) //{ str = Native.GetProcessFile(procId); //_procFileNameDict[procId] = str; // } Debug.WriteLine("Image=" + str); if (str == null) { return(null); } IntentStore.TryGetExeApp(str, out found); return(found); }
/// <summary> /// 判断是否在当前的应用程序上禁用的鼠标手势 /// 如果应用程序没有添加到记录中,则检查全局手是否可用 /// </summary> /// <param name="context"></param> /// <returns></returns> public bool IsGesturingEnabledForContext(GestureContext context, out ExeApp foundApp) { foundApp = GetExeAppByContext(context); return(foundApp != null ? foundApp.IsGesturingEnabled : IntentStore.GlobalApp.IsGesturingEnabled); }
public OrderableExeApp(ExeApp from) { var t = from.GetType(); foreach (var fieldInf in t.GetFields()) { fieldInf.SetValue(this, fieldInf.GetValue(from)); } foreach (var propInf in t.GetProperties()) { propInf.SetValue(this, propInf.GetValue(from, null), null); } }
public GestureIntent Find(Gesture gesture, ExeApp inApp) { GestureIntent found; if (inApp != null) { found = inApp.Find(gesture); if (found == null && inApp.InheritGlobalGestures) //是否继承了全局手势 { found = IntentStore.GlobalApp.Find(gesture); } } else { found = IntentStore.GlobalApp.Find(gesture); } return found; }
public GestureIntent Find(Gesture gesture, ExeApp inApp) { GestureIntent found; if (inApp != null) { found = inApp.Find(gesture); if (found == null && inApp.InheritGlobalGestures) //是否继承了全局手势 { found = IntentStore.GlobalApp.Find(gesture); } } else { found = IntentStore.GlobalApp.Find(gesture); } return(found); }
/// <summary> /// Native下以进程文件名为key查找。 /// </summary> /// <param name="context"></param> /// <returns></returns> public override ExeApp GetExeAppByContext(GestureContext context) { //全屏模式下禁用 string str; ExeApp found = null; var procId = Native.GetActiveProcessId(); if (!_procFileNameDict.TryGetValue(procId, out str)) { str = Native.GetProcessFile(procId); _procFileNameDict[procId] = str; } IntentStore.TryGetExeApp(str, out found); return(found); }
private void HighlightAppInList(ExeApp app) { ListViewItem ensureVisiblItem = null; foreach (ListViewItem item in listApps.Items) { if (item.Index != 0 && app.ExecutablePath.Equals((item.Tag as ExeApp).ExecutablePath)) { item.Selected = true; ensureVisiblItem = item; break; } } listApps.Focus(); if (ensureVisiblItem != null) { listApps.EnsureVisible(ensureVisiblItem.Index); } }
private void AddAppToList(ExeApp app) { var item = new ListViewItem(app.Name); var appPath = app.ExecutablePath; item.Tag = app; //get icon using (var thumb = IconHelper.ExtractIconForPath(appPath, new Size((int) (32*_dpiF), (int) (32*_dpiF)), app.IsGesturingEnabled)) { var imgIndex = imglistAppIcons.Images.IndexOfKey(appPath); if (imgIndex < 0) { imglistAppIcons.Images.Add(appPath, thumb); } else { imglistAppIcons.Images[imgIndex] = IconHelper.ExtractIconForPath(appPath, new Size((int)(32 * _dpiF), (int)(32 * _dpiF)), app.IsGesturingEnabled); } } item.ImageKey = appPath; if (!app.IsGesturingEnabled) item.ForeColor = Color.Firebrick; if (!File.Exists(appPath)) { item.Text += "(不存在)"; item.ForeColor = Color.Gray; } listApps.Items.Add(item); }
public void Add(ExeApp app) { app.ExecutablePath = app.ExecutablePath.ToLower(); Apps.Add(app.ExecutablePath, app); }
public bool TryGetExeApp(string key, out ExeApp found) { return Apps.TryGetValue(key.ToLower(), out found); }
public void Remove(ExeApp app) { Remove(app.ExecutablePath.ToLower()); }
public void Add(ExeApp app) { ExeAppsRegistry.Add(app.ExecutablePath, app); }
public void Remove(ExeApp app) { Remove(app.ExecutablePath); }
public bool TryGetExeApp(string key, out ExeApp found) { return(ExeAppsRegistry.TryGetValue(key, out found)); }
private void HighlightAppInList(ExeApp app) { ListViewItem ensureVisiblItem = null; foreach (ListViewItem item in listApps.Items) { if (item.Index != 0 && app.ExecutablePath.Equals((item.Tag as ExeApp).ExecutablePath)) { item.Selected = true; ensureVisiblItem = item; break; } } listApps.Focus(); if (ensureVisiblItem != null) listApps.EnsureVisible(ensureVisiblItem.Index); }
public bool TryGetExeApp(string key, out ExeApp found) { return(Apps.TryGetValue(key.ToLower(), out found)); }
public static bool AppExists(this ExeApp app) { return(File.Exists(app.ExecutablePath)); }