diff --git a/DeprecationTool/CustomControls/CheckBoxListView.cs b/DeprecationTool/CustomControls/CheckBoxListView.cs index 48ad186..370d13e 100644 --- a/DeprecationTool/CustomControls/CheckBoxListView.cs +++ b/DeprecationTool/CustomControls/CheckBoxListView.cs @@ -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;*/ } } diff --git a/DeprecationTool/DeprecateControl.cs b/DeprecationTool/DeprecateControl.cs index 87a01a4..d30b77e 100644 --- a/DeprecationTool/DeprecateControl.cs +++ b/DeprecationTool/DeprecateControl.cs @@ -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; } } @@ -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 diff --git a/DeprecationTool/DeprecateControl.designer.cs b/DeprecationTool/DeprecateControl.designer.cs index 5dec123..3811667 100644 --- a/DeprecationTool/DeprecateControl.designer.cs +++ b/DeprecationTool/DeprecateControl.designer.cs @@ -32,6 +32,7 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DeprecateControl)); this.toolStripMenu = new System.Windows.Forms.ToolStrip(); this.solutionComboBox = new System.Windows.Forms.ToolStripComboBox(); @@ -42,15 +43,17 @@ private void InitializeComponent() this.tsClose = new System.Windows.Forms.ToolStripButton(); this.entityList = new System.Windows.Forms.ListView(); this.EntityHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.entityFieldList = new CustomControls.CheckBoxListView(); + this.entityFieldList = new DeprecationTool.CustomControls.CheckBoxListView(); this.EntityFieldLogicalName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.EntityFieldDisplayName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.fieldListContextMenu = new ContextMenuStrip(); + this.fieldListContextMenu = new System.Windows.Forms.ContextMenuStrip(this.components); + this.showDependencyMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.resetButton = new System.Windows.Forms.Button(); this.applyButton = new System.Windows.Forms.Button(); this.fixPartialButton = new System.Windows.Forms.Button(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.toolStripMenu.SuspendLayout(); + this.fieldListContextMenu.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); @@ -135,17 +138,18 @@ private void InitializeComponent() this.entityList.View = System.Windows.Forms.View.Details; this.entityList.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.entityListView_SelectedIndexChanged); // - // EntityHeaderName + // EntityHeader // this.EntityHeader.Text = "Name"; this.EntityHeader.Width = 150; // // entityFieldList // - //this.entityFieldList.CheckBoxes = true; this.entityFieldList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.EntityFieldLogicalName, this.EntityFieldDisplayName}); + this.EntityFieldLogicalName, + this.EntityFieldDisplayName}); this.entityFieldList.Dock = System.Windows.Forms.DockStyle.Fill; + this.entityFieldList.FullRowSelect = true; this.entityFieldList.HideSelection = false; this.entityFieldList.Location = new System.Drawing.Point(0, 0); this.entityFieldList.Name = "entityFieldList"; @@ -157,16 +161,32 @@ private void InitializeComponent() this.entityFieldList.KeyDown += fieldListOnkeyboardPress; this.entityFieldList.MouseClick += fieldListMouseClick; this.entityFieldList.View = View.Details; - this.entityFieldList.FullRowSelect = true; + + // - // Columns + // EntityFieldLogicalName // this.EntityFieldLogicalName.Text = "Logical name"; this.EntityFieldLogicalName.Width = 80; + // + // EntityFieldDisplayName + // this.EntityFieldDisplayName.Text = "Display name"; this.EntityFieldDisplayName.Width = 80; - // Menutoolstirp - fieldListContextMenu.Name = ""; + // + // fieldListContextMenu + // + this.fieldListContextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.showDependencyMenuItem}); + this.fieldListContextMenu.Name = "fieldListContextMenu"; + this.fieldListContextMenu.Size = new System.Drawing.Size(195, 48); + // + // showDependencyMenuItem + // + this.showDependencyMenuItem.Name = "showDependencyMenuItem"; + this.showDependencyMenuItem.Size = new System.Drawing.Size(194, 22); + this.showDependencyMenuItem.Text = "Get dependency count"; + this.showDependencyMenuItem.Click += new System.EventHandler(this.showDependencyMenuItem_Click); // // resetButton // @@ -175,7 +195,7 @@ private void InitializeComponent() this.resetButton.Enabled = false; this.resetButton.Location = new System.Drawing.Point(6, 7); this.resetButton.Name = "resetButton"; - this.resetButton.Size = new System.Drawing.Size(48, 46); + this.resetButton.Size = new System.Drawing.Size(48, 47); this.resetButton.TabIndex = 7; this.resetButton.Text = "Reset"; this.resetButton.UseVisualStyleBackColor = true; @@ -188,7 +208,7 @@ private void InitializeComponent() this.applyButton.Enabled = false; this.applyButton.Location = new System.Drawing.Point(206, 7); this.applyButton.Name = "applyButton"; - this.applyButton.Size = new System.Drawing.Size(58, 46); + this.applyButton.Size = new System.Drawing.Size(58, 47); this.applyButton.TabIndex = 8; this.applyButton.Text = "Apply"; this.applyButton.UseVisualStyleBackColor = true; @@ -200,7 +220,7 @@ private void InitializeComponent() this.fixPartialButton.Enabled = false; this.fixPartialButton.Location = new System.Drawing.Point(102, 7); this.fixPartialButton.Name = "fixPartialButton"; - this.fixPartialButton.Size = new System.Drawing.Size(60, 46); + this.fixPartialButton.Size = new System.Drawing.Size(60, 47); this.fixPartialButton.TabIndex = 9; this.fixPartialButton.Text = "Fix Partial"; this.fixPartialButton.UseVisualStyleBackColor = true; @@ -235,10 +255,12 @@ private void InitializeComponent() this.Controls.Add(this.splitContainer1); this.Controls.Add(this.entityList); this.Controls.Add(this.toolStripMenu); + this.Name = "DeprecateControl"; this.Size = new System.Drawing.Size(559, 300); this.Load += new System.EventHandler(this.DeprecateControl_Load); this.toolStripMenu.ResumeLayout(false); this.toolStripMenu.PerformLayout(); + this.fieldListContextMenu.ResumeLayout(false); this.splitContainer1.Panel1.ResumeLayout(false); this.splitContainer1.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); @@ -266,5 +288,6 @@ private void InitializeComponent() private Button fixPartialButton; private SplitContainer splitContainer1; private ToolStripButton tsInfo; + private ToolStripMenuItem showDependencyMenuItem; } } diff --git a/DeprecationTool/DeprecateControl.resx b/DeprecationTool/DeprecateControl.resx index fdefbc8..af7a988 100644 --- a/DeprecationTool/DeprecateControl.resx +++ b/DeprecationTool/DeprecateControl.resx @@ -118,7 +118,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - 17, 17 + 184, 17 @@ -144,7 +144,7 @@ ByCQFSIiapkQAAAAAElFTkSuQmCC - - 147, 17 + + 17, 17 \ No newline at end of file diff --git a/Lib/Deprecate.fs b/Lib/Deprecate.fs index f812537..767424e 100644 --- a/Lib/Deprecate.fs +++ b/Lib/Deprecate.fs @@ -326,7 +326,6 @@ module Deprecate = request.ObjectId <- attr.attribute.MetadataId.Value let response = getResponse proxy request - response.EntityCollection.Entities.Count let pendingChanges (attrs: MetaDataWithCheck[]) = diff --git a/Lib/deprecate.fs b/Lib/deprecate.fs index f812537..767424e 100644 --- a/Lib/deprecate.fs +++ b/Lib/deprecate.fs @@ -326,7 +326,6 @@ module Deprecate = request.ObjectId <- attr.attribute.MetadataId.Value let response = getResponse proxy request - response.EntityCollection.Entities.Count let pendingChanges (attrs: MetaDataWithCheck[]) =