Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added ability to edit an applications details by double clicking the …

…application item in the list.
  • Loading branch information...
commit 14b46fb8988c5d6d99c09ebc9bb0edcc7b238599 1 parent 7a6f2a1
@wyldphyre wyldphyre authored
Showing with 40 additions and 2 deletions.
  1. +1 −0  Changelog.txt
  2. +9 −1 src/ControlList.cs
  3. +30 −1 src/InstallPad.cs
View
1  Changelog.txt
@@ -1,3 +1,4 @@
+- Added ability to edit an applications details by double clicking on it.
0.5
- refactored unit tests, embedded /data as a resource so the unit test dl can be run from anywhere (Zac Ruiz)
View
10 src/ControlList.cs
@@ -72,6 +72,7 @@ static ControlList()
#endregion
public event MouseEventHandler ListItemClicked;
+ public event MouseEventHandler ListItemDoubleClicked;
public ControlList()
{
InitializeComponent();
@@ -130,6 +131,12 @@ private void OnListItemClicked(object sender, MouseEventArgs e)
ListItemClicked(sender, e);
}
+ void OnlistItemDoubleClicked(object sender, MouseEventArgs e)
+ {
+ if (ListItemDoubleClicked != null)
+ ListItemDoubleClicked(sender, e);
+ }
+
/// <summary>
/// Find a control at the given screen position, in absolute coordinates.
/// </summary>
@@ -313,6 +320,7 @@ private void FormatAndAddControl(Control control, int position)
this.tableLayout.Controls.Add(control, 0, position);
control.MouseClick += new MouseEventHandler(OnListItemClicked);
+ control.MouseDoubleClick += new MouseEventHandler(OnlistItemDoubleClicked);
}
void control_VisibleChanged(object sender, EventArgs e)
@@ -373,4 +381,4 @@ public Control HighlightedEntry
#endregion
}
-}
+}
View
31 src/InstallPad.cs
@@ -121,6 +121,7 @@ private void InstallPad_Load(object sender, EventArgs e)
this.FormClosing += new FormClosingEventHandler(InstallPad_FormClosing);
this.controlList = new ControlList();
this.controlList.ListItemClicked += new MouseEventHandler(controlList_ListItemClicked);
+ this.controlList.ListItemDoubleClicked += new MouseEventHandler(controlList_ListItemDoubleClicked);
controlList.Width = this.controlListPanel.Width;
controlList.Height = this.controlListPanel.Height;
this.controlListPanel.Controls.Add(controlList);
@@ -172,6 +173,34 @@ private void InstallPad_Load(object sender, EventArgs e)
LoadApplicationList(InstallPadApp.AppListFile);
}
+ void controlList_ListItemDoubleClicked(object sender, MouseEventArgs e)
+ {
+ Control doubleClickedControl = controlList.ControlAtAbsolutePosition(Cursor.Position);
+
+ //remove highlight from whatever controler may have been hightlighted.
+ controlList.Unhighlight(controlList.HighlightedEntry);
+ //highlight control that the user double clicked, so it shows behind the editing dialog.
+ controlList.Highlight(doubleClickedControl);
+
+ if (doubleClickedControl != null && doubleClickedControl is ApplicationListItem)
+ {
+ ApplicationListItem item = (ApplicationListItem)controlList.HighlightedEntry;
+ ApplicationDialog dialog = new ApplicationDialog(item.ApplicationItem);
+ dialog.Title = "Edit Application";
+ dialog.ShowDialog(this);
+
+ if (dialog.Saved)
+ {
+ // Update the list item
+ item.ApplicationItem = item.ApplicationItem;
+ SaveApplist();
+ }
+
+ //remove highlight from the control once editing is complete.
+ controlList.Unhighlight(doubleClickedControl);
+ }
+ }
+
#region left clicking
/// <summary>
@@ -564,4 +593,4 @@ private void aboutLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs
}
-}
+}
Please sign in to comment.
Something went wrong with that request. Please try again.