diff --git a/Analogy.CommonControls/Tools/JsonTreeUC.Designer.cs b/Analogy.CommonControls/Tools/JsonTreeUC.Designer.cs index f7a6d8c4..483fd785 100644 --- a/Analogy.CommonControls/Tools/JsonTreeUC.Designer.cs +++ b/Analogy.CommonControls/Tools/JsonTreeUC.Designer.cs @@ -28,14 +28,24 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); this.splitContainerControl2 = new DevExpress.XtraEditors.SplitContainerControl(); this.meSelected = new DevExpress.XtraEditors.MemoEdit(); + this.barManager1 = new DevExpress.XtraBars.BarManager(this.components); + this.barDockControlTop = new DevExpress.XtraBars.BarDockControl(); + this.barDockControlBottom = new DevExpress.XtraBars.BarDockControl(); + this.barDockControlLeft = new DevExpress.XtraBars.BarDockControl(); + this.barDockControlRight = new DevExpress.XtraBars.BarDockControl(); + this.barTop = new DevExpress.XtraBars.Bar(); + this.bar3 = new DevExpress.XtraBars.Bar(); + this.bbiCopyMessage = new DevExpress.XtraBars.BarButtonItem(); ((System.ComponentModel.ISupportInitialize)(this.splitContainerControl2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainerControl2.Panel1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainerControl2.Panel2)).BeginInit(); this.splitContainerControl2.Panel2.SuspendLayout(); this.splitContainerControl2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.meSelected.Properties)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.barManager1)).BeginInit(); this.SuspendLayout(); // // splitContainerControl2 @@ -43,7 +53,7 @@ private void InitializeComponent() this.splitContainerControl2.Dock = System.Windows.Forms.DockStyle.Fill; this.splitContainerControl2.FixedPanel = DevExpress.XtraEditors.SplitFixedPanel.Panel2; this.splitContainerControl2.Horizontal = false; - this.splitContainerControl2.Location = new System.Drawing.Point(0, 0); + this.splitContainerControl2.Location = new System.Drawing.Point(0, 30); this.splitContainerControl2.Name = "splitContainerControl2"; // // splitContainerControl2.Panel1 @@ -54,7 +64,7 @@ private void InitializeComponent() // this.splitContainerControl2.Panel2.Controls.Add(this.meSelected); this.splitContainerControl2.Panel2.Text = "Panel2"; - this.splitContainerControl2.Size = new System.Drawing.Size(896, 653); + this.splitContainerControl2.Size = new System.Drawing.Size(896, 603); this.splitContainerControl2.TabIndex = 1; // // meSelected @@ -66,11 +76,96 @@ private void InitializeComponent() this.meSelected.Size = new System.Drawing.Size(896, 100); this.meSelected.TabIndex = 1; // + // barManager1 + // + this.barManager1.Bars.AddRange(new DevExpress.XtraBars.Bar[] { + this.barTop, + this.bar3}); + this.barManager1.DockControls.Add(this.barDockControlTop); + this.barManager1.DockControls.Add(this.barDockControlBottom); + this.barManager1.DockControls.Add(this.barDockControlLeft); + this.barManager1.DockControls.Add(this.barDockControlRight); + this.barManager1.Form = this; + this.barManager1.Items.AddRange(new DevExpress.XtraBars.BarItem[] { + this.bbiCopyMessage}); + this.barManager1.MainMenu = this.barTop; + this.barManager1.MaxItemId = 2; + this.barManager1.StatusBar = this.bar3; + // + // barDockControlTop + // + this.barDockControlTop.CausesValidation = false; + this.barDockControlTop.Dock = System.Windows.Forms.DockStyle.Top; + this.barDockControlTop.Location = new System.Drawing.Point(0, 0); + this.barDockControlTop.Manager = this.barManager1; + this.barDockControlTop.Size = new System.Drawing.Size(896, 30); + // + // barDockControlBottom + // + this.barDockControlBottom.CausesValidation = false; + this.barDockControlBottom.Dock = System.Windows.Forms.DockStyle.Bottom; + this.barDockControlBottom.Location = new System.Drawing.Point(0, 633); + this.barDockControlBottom.Manager = this.barManager1; + this.barDockControlBottom.Size = new System.Drawing.Size(896, 20); + // + // barDockControlLeft + // + this.barDockControlLeft.CausesValidation = false; + this.barDockControlLeft.Dock = System.Windows.Forms.DockStyle.Left; + this.barDockControlLeft.Location = new System.Drawing.Point(0, 30); + this.barDockControlLeft.Manager = this.barManager1; + this.barDockControlLeft.Size = new System.Drawing.Size(0, 603); + // + // barDockControlRight + // + this.barDockControlRight.CausesValidation = false; + this.barDockControlRight.Dock = System.Windows.Forms.DockStyle.Right; + this.barDockControlRight.Location = new System.Drawing.Point(896, 30); + this.barDockControlRight.Manager = this.barManager1; + this.barDockControlRight.Size = new System.Drawing.Size(0, 603); + // + // barTop + // + this.barTop.BarName = "Main menu"; + this.barTop.DockCol = 0; + this.barTop.DockStyle = DevExpress.XtraBars.BarDockStyle.Top; + this.barTop.LinksPersistInfo.AddRange(new DevExpress.XtraBars.LinkPersistInfo[] { + new DevExpress.XtraBars.LinkPersistInfo(this.bbiCopyMessage)}); + this.barTop.OptionsBar.AllowQuickCustomization = false; + this.barTop.OptionsBar.AutoPopupMode = DevExpress.XtraBars.BarAutoPopupMode.None; + this.barTop.OptionsBar.MultiLine = true; + this.barTop.OptionsBar.UseWholeRow = true; + this.barTop.Text = "Main menu"; + // + // bar3 + // + this.bar3.BarName = "Status bar"; + this.bar3.CanDockStyle = DevExpress.XtraBars.BarCanDockStyle.Bottom; + this.bar3.DockCol = 0; + this.bar3.DockStyle = DevExpress.XtraBars.BarDockStyle.Bottom; + this.bar3.OptionsBar.AllowQuickCustomization = false; + this.bar3.OptionsBar.DrawDragBorder = false; + this.bar3.OptionsBar.UseWholeRow = true; + this.bar3.Text = "Status bar"; + this.bar3.Visible = false; + // + // bbiCopyMessage + // + this.bbiCopyMessage.Caption = "Copy Message"; + this.bbiCopyMessage.Id = 0; + this.bbiCopyMessage.ImageOptions.Image = global::Analogy.CommonControls.Properties.Resources.Copy_16x16; + this.bbiCopyMessage.Name = "bbiCopyMessage"; + this.bbiCopyMessage.PaintStyle = DevExpress.XtraBars.BarItemPaintStyle.CaptionGlyph; + // // JsonTreeUC // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.splitContainerControl2); + this.Controls.Add(this.barDockControlLeft); + this.Controls.Add(this.barDockControlRight); + this.Controls.Add(this.barDockControlBottom); + this.Controls.Add(this.barDockControlTop); this.Name = "JsonTreeUC"; this.Size = new System.Drawing.Size(896, 653); this.Load += new System.EventHandler(this.JsonTreeUC_Load); @@ -80,7 +175,9 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.splitContainerControl2)).EndInit(); this.splitContainerControl2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.meSelected.Properties)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.barManager1)).EndInit(); this.ResumeLayout(false); + this.PerformLayout(); } @@ -88,5 +185,13 @@ private void InitializeComponent() private DevExpress.XtraEditors.SplitContainerControl splitContainerControl2; private DevExpress.XtraEditors.MemoEdit meSelected; + private DevExpress.XtraBars.BarManager barManager1; + private DevExpress.XtraBars.Bar barTop; + private DevExpress.XtraBars.Bar bar3; + private DevExpress.XtraBars.BarDockControl barDockControlTop; + private DevExpress.XtraBars.BarDockControl barDockControlBottom; + private DevExpress.XtraBars.BarDockControl barDockControlLeft; + private DevExpress.XtraBars.BarDockControl barDockControlRight; + private DevExpress.XtraBars.BarButtonItem bbiCopyMessage; } } diff --git a/Analogy.CommonControls/Tools/JsonTreeUC.cs b/Analogy.CommonControls/Tools/JsonTreeUC.cs index 3c4e209f..9d3ae789 100644 --- a/Analogy.CommonControls/Tools/JsonTreeUC.cs +++ b/Analogy.CommonControls/Tools/JsonTreeUC.cs @@ -60,7 +60,10 @@ private void JsonTreeUC_Load(object sender, EventArgs e) _jsonTreeView.ShowJson(JsonData); } - + bbiCopyMessage.ItemClick += (_, _) => + { + Clipboard.SetText(_jsonTreeView.Message); + }; } public void ShowJson(string json) diff --git a/Analogy.CommonControls/Tools/JsonTreeUC.resx b/Analogy.CommonControls/Tools/JsonTreeUC.resx index 1af7de15..52e53df5 100644 --- a/Analogy.CommonControls/Tools/JsonTreeUC.resx +++ b/Analogy.CommonControls/Tools/JsonTreeUC.resx @@ -117,4 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + \ No newline at end of file diff --git a/Analogy.CommonControls/Tools/JsonTreeView.cs b/Analogy.CommonControls/Tools/JsonTreeView.cs index 985b4052..38e036e1 100644 --- a/Analogy.CommonControls/Tools/JsonTreeView.cs +++ b/Analogy.CommonControls/Tools/JsonTreeView.cs @@ -22,6 +22,7 @@ public class JsonTreeView : TreeView private StatusStrip statusStrip1; private string previouslySelectedNodeText; public event EventHandler OnNodeChanged; + public string Message { get; set; } public JsonTreeView() { InitializeComponent(); @@ -111,23 +112,6 @@ private void LoadImageList() ImageList = treeImages; } - public void ClearList() - { - Nodes.Clear(); - } - public void ShowJson(string jsonString) - { - try - { - object json = JsonConvert.DeserializeObject(jsonString); - LoadTree(json); - } - catch (Exception e) - { - } - - } - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] private void LoadTree(object jsonData) { @@ -296,9 +280,7 @@ private void InitializeComponent() get => base.SelectedNode as JsonTreeNode; set => base.SelectedNode = value; } - - #region UI events - + private void this_AfterSelect(object sender, TreeViewEventArgs e) { // restore previous seelcted node text and store the next @@ -344,6 +326,22 @@ private void expandAllMenuItem_Click(object sender, EventArgs e) } } - #endregion + public void ClearList() + { + Nodes.Clear(); + } + public void ShowJson(string jsonString) + { + Message = jsonString; + try + { + object json = JsonConvert.DeserializeObject(jsonString); + LoadTree(json); + } + catch (Exception e) + { + } + + } } } diff --git a/Analogy/CommonChangeLog.cs b/Analogy/CommonChangeLog.cs index ea68ae30..5217ae89 100644 --- a/Analogy/CommonChangeLog.cs +++ b/Analogy/CommonChangeLog.cs @@ -11,6 +11,7 @@ public static IEnumerable GetChangeLog() { return new List { + new AnalogyChangeLog("V4.11.0 - Refactor Json Viewer #1614",AnalogChangeLogType.Improvement, "Lior Banai", new DateTime(2023, 02, 04)), new AnalogyChangeLog("V4.11.0 - Add RawText, LineNumber and MethodName columns #1616",AnalogChangeLogType.Improvement, "Lior Banai", new DateTime(2023, 02, 04)), new AnalogyChangeLog("V4.11.0 - Message details window doesn't remember its size #1612",AnalogChangeLogType.Improvement, "Lior Banai", new DateTime(2023, 01, 28)), new AnalogyChangeLog("V4.11.0 - Add a multiline value preview to the JSON inline viewer #1611",AnalogChangeLogType.Improvement, "Lior Banai", new DateTime(2023, 01, 28)),