Skip to content

Commit

Permalink
Add ability to add by regex
Browse files Browse the repository at this point in the history
  • Loading branch information
SecretOnline committed Aug 2, 2015
1 parent 4e498ab commit b55c007
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 5 deletions.
19 changes: 14 additions & 5 deletions Forms/MainWindow.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions Forms/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,37 @@ private void byTheProcessBinaryNameToolStripMenuItem_Click(object sender, EventA
controller.Favorites.Add(fav);
}
}

/// <summary>
/// adds the currently selected process to the favorites (by window title text)
/// </summary>
private void byTheWindowTitleTextregexToolStripMenuItem_Click(object sender, EventArgs e)
{
if (this.lstProcesses.SelectedItem == null) return;

ProcessDetails pd = ((ProcessDetails)this.lstProcesses.SelectedItem);

if (!pd.Manageable)
return;

//TODO move to controller
if (controller.Favorites.CanAdd(pd.WindowTitle))
{
InputText it = new InputText();
it.Text = "Add to favorites by regex string";
it.Input = pd.WindowTitle;
it.Instructions = "Regex string (reference is in the Help menu)";

it.ShowDialog();
if (it.DialogResult != DialogResult.OK)
return;

Favorites.Favorite fav = new Favorites.Favorite();
fav.Kind = Favorites.Favorite.FavoriteKinds.ByTitleText;
fav.SearchText = pd.WindowTitle;
controller.Favorites.Add(fav);
}
}

private void addSelectedItem_Click(object sender, EventArgs e)
{
Expand Down
12 changes: 12 additions & 0 deletions Forms/MainWindow.resx
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,12 @@
<data name="byTheProcessBinaryNameToolStripMenuItem.Text" xml:space="preserve">
<value>... by the process binary name</value>
</data>
<data name="byTheWindowTitleTextregexToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>253, 22</value>
</data>
<data name="byTheWindowTitleTextregexToolStripMenuItem.Text" xml:space="preserve">
<value>... by the window title text (regex)</value>
</data>
<data name="toolStripMenuItem1.Size" type="System.Drawing.Size, System.Drawing">
<value>201, 6</value>
</data>
Expand Down Expand Up @@ -989,6 +995,12 @@
<data name="&gt;&gt;byTheProcessBinaryNameToolStripMenuItem.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;byTheWindowTitleTextregexToolStripMenuItem.Name" xml:space="preserve">
<value>byTheWindowTitleTextregexToolStripMenuItem</value>
</data>
<data name="&gt;&gt;byTheWindowTitleTextregexToolStripMenuItem.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;toolStripMenuItem1.Name" xml:space="preserve">
<value>toolStripMenuItem1</value>
</data>
Expand Down

0 comments on commit b55c007

Please sign in to comment.