public IgnoredApplication(string Name, MatchUsing MatchUsing, string MatchString, bool IsRegEx) { this.Name = Name; this.MatchUsing = MatchUsing; this.MatchString = MatchString; this.IsRegEx = IsRegEx; }
public IApplication ToUserApplication(MatchUsing MatchUsing) { var userApplication = new UserApp(); userApplication.Name = ApplicationName; userApplication.MatchUsing = MatchUsing; switch (MatchUsing) { case MatchUsing.WindowClass: userApplication.MatchString = WindowClass; break; case MatchUsing.WindowTitle: userApplication.MatchString = WindowTitle; break; case MatchUsing.ExecutableFilename: userApplication.MatchString = WindowFilename; break; } userApplication.IsRegEx = false; return(userApplication); }
public IgnoredApplication(string Name, MatchUsing MatchUsing, string MatchString, bool IsRegEx) { this.Name = Name; this.MatchUsing = MatchUsing; this.MatchString = MatchString; this.IsRegEx = IsRegEx; }
public IApplication[] FindMatchApplications <TApplication>(MatchUsing matchUsing, string matchString, string excludedApplication = null) where TApplication : IApplication { return(_Applications.FindAll( a => a is TApplication && matchString.Equals(a.MatchString, StringComparison.CurrentCultureIgnoreCase) && matchUsing == a.MatchUsing && excludedApplication != a.Name).ToArray()); }
public IgnoredApplication(string Name, MatchUsing MatchUsing, string MatchString, bool IsRegEx, bool isEnabled) { this.Name = Name; this.MatchUsing = MatchUsing; this.MatchString = MatchString; this.IsRegEx = IsRegEx; this.IsEnabled = isEnabled; }
private void AddIgnoredApplication(String Name, String MatchString, MatchUsing MatchUsing, bool IsRegEx) { if (ApplicationManager.Instance.ApplicationExists(Name)) return; ApplicationManager.Instance.AddApplication(new IgnoredApplication(Name, MatchUsing, MatchString, IsRegEx)); ApplicationManager.Instance.SaveApplications(); BindIgnoredApplications(); }
protected void chCrosshair_CrosshairDragging(object sender, EventArgs e) { Point cursorPosition = Cursor.Position; SystemWindow window = SystemWindow.FromPointEx(cursorPosition.X, cursorPosition.Y, true, true); // Set MatchUsings MatchUsing muRunning = ((MatchUsingComboBoxItem)cmbMatchUsingRunning.SelectedItem).MatchUsing; MatchUsing muCustom = ((MatchUsingComboBoxItem)cmbMatchUsingCustom.SelectedItem).MatchUsing; alvRunningApplications.MatchUsing = muRunning; // Which screen are we changing if (SelectedTab == TabType.Running) // Running applications { switch (muRunning) { case MatchUsing.WindowClass: alvRunningApplications.SelectSimilar(window.ClassName); break; case MatchUsing.WindowTitle: alvRunningApplications.SelectSimilar(window.Title); break; case MatchUsing.ExecutableFilename: alvRunningApplications.SelectSimilar(Path.GetFileName(window.Process.MainModule.FileName)); break; } } else // Custom Application { switch (muCustom) { case MatchUsing.WindowClass: txtMatchString.Text = window.ClassName; break; case MatchUsing.WindowTitle: txtMatchString.Text = window.Title; break; case MatchUsing.ExecutableFilename: txtMatchString.Text = window.Process.MainModule.FileName; txtMatchString.SelectionStart = txtMatchString.Text.Length; break; } // Set application name from filename txtApplicationName.Text = window.Process.MainModule.FileVersionInfo.FileDescription; } }
private void AddIgnoredApplication(String Name, String MatchString, MatchUsing MatchUsing, bool IsRegEx) { if (ApplicationManager.Instance.ApplicationExists(Name)) { return; } ApplicationManager.Instance.AddApplication(new IgnoredApplication(Name, MatchUsing, MatchString, IsRegEx)); ApplicationManager.Instance.SaveApplications(); BindIgnoredApplications(); }
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { ApplicationListViewItem applicationListViewItem = values[0] as ApplicationListViewItem; MatchUsing matchUsing = (MatchUsing)values[1]; if (applicationListViewItem == null) { return(null); } return(matchUsing == MatchUsing.ExecutableFilename ? applicationListViewItem.WindowFilename : matchUsing == MatchUsing.WindowTitle ? applicationListViewItem.WindowTitle : applicationListViewItem.WindowClass); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { MatchUsing mu = (MatchUsing)value; switch (mu) { case MatchUsing.All: return(LocalizationProvider.Instance.GetTextValue("Common.GlobalActions")); case MatchUsing.ExecutableFilename: return(LocalizationProvider.Instance.GetTextValue("Common.FileName")); case MatchUsing.WindowClass: return(LocalizationProvider.Instance.GetTextValue("Common.WindowClass")); case MatchUsing.WindowTitle: return(LocalizationProvider.Instance.GetTextValue("Common.WindowTitle")); default: return(DependencyProperty.UnsetValue); } }
private void ChCrosshair_OnCrosshairDragging(object sender, MouseEventArgs e) { Point cursorPosition; //(e.OriginalSource as Image).PointToScreen(e.GetPosition(null)); GetCursorPos(out cursorPosition); SystemWindow window = SystemWindow.FromPointEx(cursorPosition.X, cursorPosition.Y, true, true); // Set MatchUsings MatchUsing muCustom = matchUsingRadio.MatchUsing; // Which screen are we changing try { switch (muCustom) { case MatchUsing.WindowClass: MatchStringTextBox.Text = window.ClassName; break; case MatchUsing.WindowTitle: MatchStringTextBox.Text = window.Title; break; case MatchUsing.ExecutableFilename: MatchStringTextBox.Text = window.Process.MainModule.ModuleName;//.FileName; MatchStringTextBox.SelectionStart = MatchStringTextBox.Text.Length; break; } // Set application name from filename ApplicationNameTextBox.Text = window.Process.MainModule.FileVersionInfo.FileDescription; } catch (Exception ex) { MatchStringTextBox.Text = LocalizationProvider.Instance.GetTextValue("Messages.Error") + ":" + ex.Message; } }
public IApplication ToUserApplication(MatchUsing MatchUsing) { UserApplication userApplication = new UserApplication(); userApplication.Name = ApplicationName; userApplication.MatchUsing = MatchUsing; switch (MatchUsing) { case MatchUsing.WindowClass: userApplication.MatchString = WindowClass; break; case MatchUsing.WindowTitle: userApplication.MatchString = WindowTitle; break; case MatchUsing.ExecutableFilename: userApplication.MatchString = WindowFilename; break; } userApplication.IsRegEx = false; return userApplication; }
private void SelectMatchUsing(ComboBox MatchUsingList, MatchUsing Value) { MatchUsingList.SelectedItem = MatchUsingList.Items.Cast<MatchUsingComboBoxItem>().FirstOrDefault(ci => ci.MatchUsing == Value); }
private bool SaveApplication() { // Did user select all applications if (cmbExistingApplication.SelectedIndex == (int)SpecialItem.AllApplications) { Applications.ApplicationManager.Instance.CurrentApplication = Applications.ApplicationManager.Instance.GetGlobalApplication(); return(true); } // Did user select an existing application if (cmbExistingApplication.SelectedIndex != (int)SpecialItem.AllApplications && cmbExistingApplication.SelectedIndex != (int)SpecialItem.NewApplication) { Applications.ApplicationManager.Instance.CurrentApplication = Applications.ApplicationManager.Instance.GetExistingUserApplication(cmbExistingApplication.SelectedItem.ToString()); return(true); } // User is creating a new application // Make sure we have a valid name if (String.IsNullOrEmpty(txtFriendlyName.Text.Trim())) { MessageBox.Show("Please provide a name for the applications you selected", "No Application Name Specified", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); } // Make sure the application name doesn't already exist if (Applications.ApplicationManager.Instance.ApplicationExists(txtFriendlyName.Text)) { MessageBox.Show("The name you provided already exists, please provide a different name", "Name Already Exists", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); } // Find out how user wants to match other applications MatchUsing oMatchUsing = (MatchUsing)cmbMatchCriteria.SelectedIndex; // Create new application object UserApplication newApplication = new UserApplication(); newApplication.MatchUsing = oMatchUsing; newApplication.Name = txtFriendlyName.Text.Trim(); // Get the first selected item ApplicationListViewItem alvFirstItem = lstRunningApplications.SelectedApplication; switch (oMatchUsing) { case MatchUsing.WindowClass: newApplication.MatchString = alvFirstItem.WindowClass; break; case MatchUsing.WindowTitle: newApplication.MatchString = alvFirstItem.WindowTitle; break; case MatchUsing.ExecutableFilename: newApplication.MatchString = alvFirstItem.WindowFilename; break; } // Save new application to application list and set newly created application as selected application Applications.ApplicationManager.Instance.AddApplication(newApplication); Applications.ApplicationManager.Instance.CurrentApplication = newApplication; // Save entire list of applications Applications.ApplicationManager.Instance.SaveApplications(); // Notify success return(true); }
private void SelectMatchUsing(ComboBox MatchUsingList, MatchUsing Value) { MatchUsingList.SelectedItem = MatchUsingList.Items.Cast <MatchUsingComboBoxItem>().FirstOrDefault(ci => ci.MatchUsing == Value); }