Skip to content

Commit

Permalink
Move listview click handler to main control and add dependency count …
Browse files Browse the repository at this point in the history
…right click context option
  • Loading branch information
Ahmad Sattar Atta committed Jan 19, 2020
1 parent a1866d5 commit ba6995e
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 20 deletions.
7 changes: 4 additions & 3 deletions DeprecationTool/CustomControls/CheckBoxListView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@ protected override void OnDoubleClick(EventArgs e)
protected override void OnClick(EventArgs e)
{
base.OnClick(e);
SelectedItems[0].ImageKey = SelectedItems[0].ImageKey == Deprecate.CHECKED
? Deprecate.UNCHECKED
: Deprecate.CHECKED;
//if (e.Button == MouseButtons.Left)
/* SelectedItems[0].ImageKey = SelectedItems[0].ImageKey == Deprecate.CHECKED
? Deprecate.UNCHECKED
: Deprecate.CHECKED;*/
}
}

Expand Down
20 changes: 20 additions & 0 deletions DeprecationTool/DeprecateControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,12 @@ private void fieldListMouseClick(object sender, MouseEventArgs e)
{
fieldListContextMenu.Show(Cursor.Position);
}
}else if (e.Button == MouseButtons.Left)
{
var element = theListView.FocusedItem;
element.ImageKey = element.ImageKey == Deprecate.CHECKED
? Deprecate.UNCHECKED
: Deprecate.CHECKED;
}
}

Expand All @@ -408,6 +414,20 @@ private void fieldListOnkeyboardPress(object sender, KeyEventArgs e)
}
}

private void showDependencyMenuItem_Click(object sender, EventArgs e)
{
var item = entityFieldList.FocusedItem;
if (item != null)
{
var meta = (Deprecate.MetaData)item.Tag;
var res = Deprecate.getDependencyCountForEntity(Service, meta);
string message = $"Entity {meta.entityLName} has {res} {(res == 1 ? "dependency." : "dependencies." )}";
string caption = $"Dependency for {meta.entityLName}";
var result = MessageBox.Show(message, caption,
MessageBoxButtons.OK);

}
}
}

class ListViewItemComparer : IComparer
Expand Down
47 changes: 35 additions & 12 deletions DeprecationTool/DeprecateControl.designer.cs

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

6 changes: 3 additions & 3 deletions DeprecationTool/DeprecateControl.resx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="toolStripMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
<value>184, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="tsInfo.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
Expand All @@ -144,7 +144,7 @@
ByCQFSIiapkQAAAAAElFTkSuQmCC
</value>
</data>
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>147, 17</value>
<metadata name="fieldListContextMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>
1 change: 0 additions & 1 deletion Lib/Deprecate.fs
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,6 @@ module Deprecate =
request.ObjectId <- attr.attribute.MetadataId.Value

let response = getResponse<RetrieveDependenciesForDeleteResponse> proxy request

response.EntityCollection.Entities.Count

let pendingChanges (attrs: MetaDataWithCheck[]) =
Expand Down
1 change: 0 additions & 1 deletion Lib/deprecate.fs
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,6 @@ module Deprecate =
request.ObjectId <- attr.attribute.MetadataId.Value

let response = getResponse<RetrieveDependenciesForDeleteResponse> proxy request

response.EntityCollection.Entities.Count

let pendingChanges (attrs: MetaDataWithCheck[]) =
Expand Down

0 comments on commit ba6995e

Please sign in to comment.