Added popup menu to Shortcut Library

Added a right-click popup menu to the
Shortcut Library just in case people find that
easier to use.
This commit is contained in:
Terry MacDonald 2020-12-11 11:34:19 +13:00
parent 161a39aa21
commit 41c48f6ef2
3 changed files with 94 additions and 6 deletions

View File

@ -41,6 +41,12 @@
this.label1 = new System.Windows.Forms.Label();
this.tt_selected = new System.Windows.Forms.ToolTip(this.components);
this.lbl_create_shortcut = new System.Windows.Forms.Label();
this.cms_shortcuts = new System.Windows.Forms.ContextMenuStrip(this.components);
this.tsmi_edit = new System.Windows.Forms.ToolStripMenuItem();
this.tsmi_run = new System.Windows.Forms.ToolStripMenuItem();
this.tsmi_save_to_desktop = new System.Windows.Forms.ToolStripMenuItem();
this.tsmi_delete = new System.Windows.Forms.ToolStripMenuItem();
this.cms_shortcuts.SuspendLayout();
this.SuspendLayout();
//
// ilv_saved_shortcuts
@ -200,6 +206,46 @@
this.lbl_create_shortcut.TabIndex = 32;
this.lbl_create_shortcut.Text = "Click the \'New\' button to create a shortcut";
//
// cms_shortcuts
//
this.cms_shortcuts.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tsmi_edit,
this.tsmi_run,
this.tsmi_save_to_desktop,
this.tsmi_delete});
this.cms_shortcuts.Name = "cms_shortcuts";
this.cms_shortcuts.Size = new System.Drawing.Size(216, 114);
//
// tsmi_edit
//
this.tsmi_edit.Font = new System.Drawing.Font("Segoe UI", 9F);
this.tsmi_edit.Name = "tsmi_edit";
this.tsmi_edit.Size = new System.Drawing.Size(215, 22);
this.tsmi_edit.Text = "Edit Shortcut...";
this.tsmi_edit.Click += new System.EventHandler(this.tsmi_edit_Click);
//
// tsmi_run
//
this.tsmi_run.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold);
this.tsmi_run.Name = "tsmi_run";
this.tsmi_run.Size = new System.Drawing.Size(215, 22);
this.tsmi_run.Text = "Run Shortcut...";
this.tsmi_run.Click += new System.EventHandler(this.tsmi_run_Click);
//
// tsmi_save_to_desktop
//
this.tsmi_save_to_desktop.Name = "tsmi_save_to_desktop";
this.tsmi_save_to_desktop.Size = new System.Drawing.Size(215, 22);
this.tsmi_save_to_desktop.Text = "Save Shortcut to Desktop...";
this.tsmi_save_to_desktop.Click += new System.EventHandler(this.tsmi_save_to_desktop_Click);
//
// tsmi_delete
//
this.tsmi_delete.Name = "tsmi_delete";
this.tsmi_delete.Size = new System.Drawing.Size(215, 22);
this.tsmi_delete.Text = "Delete Shortcut...";
this.tsmi_delete.Click += new System.EventHandler(this.tsmi_delete_Click);
//
// ShortcutLibraryForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -226,6 +272,7 @@
this.Text = "DisplayMagician - Setup Game Shortcuts";
this.Activated += new System.EventHandler(this.ShortcutLibraryForm_Activated);
this.Load += new System.EventHandler(this.ShortcutLibraryForm_Load);
this.cms_shortcuts.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
@ -244,5 +291,10 @@
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ToolTip tt_selected;
private System.Windows.Forms.Label lbl_create_shortcut;
private System.Windows.Forms.ContextMenuStrip cms_shortcuts;
private System.Windows.Forms.ToolStripMenuItem tsmi_edit;
private System.Windows.Forms.ToolStripMenuItem tsmi_run;
private System.Windows.Forms.ToolStripMenuItem tsmi_delete;
private System.Windows.Forms.ToolStripMenuItem tsmi_save_to_desktop;
}
}

View File

@ -57,9 +57,6 @@ namespace DisplayMagician.UIForms
foreach (ShortcutItem loadedShortcut in ShortcutRepository.AllShortcuts.OrderBy(s => s.Name))
{
//loadedProfile.SaveProfileImageToCache();
//newItem = new ImageListViewItem(loadedProfile.SavedProfileCacheFilename, loadedProfile.Name);
//newItem = new ImageListViewItem(loadedProfile, loadedProfile.Name);
newItem = new ImageListViewItem(loadedShortcut, loadedShortcut.Name);
// Select it if its the selectedProfile
@ -153,6 +150,17 @@ namespace DisplayMagician.UIForms
private void ilv_saved_shortcuts_ItemClick(object sender, ItemClickEventArgs e)
{
_selectedShortcut = GetShortcutFromName(e.Item.Text);
if (e.Buttons == MouseButtons.Right)
{
/* MessageBox.Show(
"Right button was clicked!",
"Mouse Button detected",
MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);*/
cms_shortcuts.Show(ilv_saved_shortcuts,e.Location);
}
}
private void ilv_saved_shortcuts_ItemDoubleClick(object sender, ItemClickEventArgs e)
@ -162,7 +170,8 @@ namespace DisplayMagician.UIForms
if (_selectedShortcut == null)
return;
var shortcutForm = new ShortcutForm(_selectedShortcut);
// Edit the Shortcut (now changed to RunShortcut)
/*var shortcutForm = new ShortcutForm(_selectedShortcut);
shortcutForm.ShowDialog(this);
if (shortcutForm.DialogResult == DialogResult.OK)
{
@ -170,6 +179,10 @@ namespace DisplayMagician.UIForms
// As this is an edit, we need to manually force saving the shortcut library
ShortcutRepository.SaveShortcuts();
}
*/
// Run the shortcut when doubleclicked
btn_run.PerformClick();
}
@ -234,9 +247,9 @@ namespace DisplayMagician.UIForms
// Figure out the string we're going to use as the MaskedForm message
string message = "";
if (_selectedShortcut.Category.Equals(ShortcutCategory.Application))
message = $"Starting the {_selectedShortcut.ExecutableNameAndPath} application and waiting until you close it.";
message = $"Running the {_selectedShortcut.ExecutableNameAndPath} application and waiting until you close it.";
else if (_selectedShortcut.Category.Equals(ShortcutCategory.Game))
message = $"Starting the {_selectedShortcut.GameName} game and waiting until you close it.";
message = $"Running the {_selectedShortcut.GameName} game and waiting until you close it.";
// Create a MaskForm that will cover the ShortcutLibrary Window to lock
// the controls and inform the user that the game is running....
@ -268,5 +281,25 @@ namespace DisplayMagician.UIForms
{
RemoveWarningIfShortcuts();
}
private void tsmi_save_to_desktop_Click(object sender, EventArgs e)
{
btn_save.PerformClick();
}
private void tsmi_run_Click(object sender, EventArgs e)
{
btn_run.PerformClick();
}
private void tsmi_edit_Click(object sender, EventArgs e)
{
btn_edit.PerformClick();
}
private void tsmi_delete_Click(object sender, EventArgs e)
{
btn_delete.PerformClick();
}
}
}

View File

@ -126,6 +126,9 @@
<metadata name="tt_selected.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>132, 17</value>
</metadata>
<metadata name="cms_shortcuts.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>242, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>