first add key test

alphons <alphons@heijden.com> 19 Jan 2025, 11:26
2d3b6213cf72d3feb70ffdfd23e2bbbe003b40df
3 files changed
  • RedisGui/FormMain.Designer.cs
  • RedisGui/FormMain.cs
  • RedisGui/FormMain.resx
diff --git a/RedisGui/FormMain.Designer.cs b/RedisGui/FormMain.Designer.cs
index dc0fbdb..0b556ce 100644
--- a/RedisGui/FormMain.Designer.cs
+++ b/RedisGui/FormMain.Designer.cs
@@ -63,6 +63,8 @@
timer1 = new System.Windows.Forms.Timer(components);
contextMenuStrip3 = new ContextMenuStrip(components);
deleteKeyToolStripMenuItem = new ToolStripMenuItem();
+ toolStripSeparator3 = new ToolStripSeparator();
+ toolStripMenuItem2 = new ToolStripMenuItem();
menuStrip1.SuspendLayout();
statusStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)splitContainer1).BeginInit();
@@ -273,7 +275,7 @@
listView1.GridLines = true;
listView1.Location = new Point(12, 49);
listView1.Name = "listView1";
- listView1.Size = new Size(649, 248);
+ listView1.Size = new Size(679, 248);
listView1.TabIndex = 0;
listView1.UseCompatibleStateImageBehavior = false;
listView1.View = View.Details;
@@ -300,7 +302,7 @@
txtData.Name = "txtData";
txtData.ReadOnly = true;
txtData.ScrollBars = ScrollBars.Both;
- txtData.Size = new Size(1059, 104);
+ txtData.Size = new Size(1059, 92);
txtData.TabIndex = 5;
//
// contextMenuStrip1
@@ -318,9 +320,9 @@
//
// contextMenuStrip2
//
- contextMenuStrip2.Items.AddRange(new ToolStripItem[] { showInformationToolStripMenuItem, showConfigurationToolStripMenuItem, toolStripSeparator1, closeConnectionToolStripMenuItem });
+ contextMenuStrip2.Items.AddRange(new ToolStripItem[] { showInformationToolStripMenuItem, showConfigurationToolStripMenuItem, toolStripSeparator1, toolStripMenuItem2, toolStripSeparator3, closeConnectionToolStripMenuItem });
contextMenuStrip2.Name = "contextMenuStrip2";
- contextMenuStrip2.Size = new Size(181, 76);
+ contextMenuStrip2.Size = new Size(181, 126);
//
// showInformationToolStripMenuItem
//
@@ -366,6 +368,18 @@
deleteKeyToolStripMenuItem.Text = "Delete Key";
deleteKeyToolStripMenuItem.Click += DeleteKeyToolStripMenuItem_Click;
//
+ // toolStripSeparator3
+ //
+ toolStripSeparator3.Name = "toolStripSeparator3";
+ toolStripSeparator3.Size = new Size(177, 6);
+ //
+ // toolStripMenuItem2
+ //
+ toolStripMenuItem2.Name = "toolStripMenuItem2";
+ toolStripMenuItem2.Size = new Size(180, 22);
+ toolStripMenuItem2.Text = "Add Key...";
+ toolStripMenuItem2.Click += AddKeytoolStripMenuItem_Click;
+ //
// FormMain
//
AutoScaleDimensions = new SizeF(7F, 15F);
@@ -436,5 +450,7 @@
private Button button1;
private ToolStripSeparator toolStripSeparator2;
private ToolStripMenuItem toolStripMenuItem1;
+ private ToolStripMenuItem toolStripMenuItem2;
+ private ToolStripSeparator toolStripSeparator3;
}
}
diff --git a/RedisGui/FormMain.cs b/RedisGui/FormMain.cs
index 34b6d7a..d9dc619 100644
--- a/RedisGui/FormMain.cs
+++ b/RedisGui/FormMain.cs
@@ -5,6 +5,7 @@ using StackExchange.Redis;
using System.Configuration;
using System.Diagnostics;
using System.Net;
+using System.Windows.Forms;
namespace RedisGui;
@@ -24,9 +25,9 @@ public partial class FormMain : Form
var connectionStrings = configuration.GetSection("AppSettings:ConnectionStrings").Get<string[]>();
- if(connectionStrings != null)
- connections = connectionStrings.Select(x => new ConnectionPoint { ConnectionString = x }).ToList();
-
+ if (connectionStrings != null)
+ connections = connectionStrings.Select(x => new ConnectionPoint { ConnectionString = x }).ToList();
+
this.imageList1.Images.Add(SystemIcons.GetStockIcon(StockIconId.World, 24));
this.imageList1.Images.Add(SystemIcons.GetStockIcon(StockIconId.NetworkConnect, 24));
this.imageList1.Images.Add(SystemIcons.GetStockIcon(StockIconId.Key, 24));
@@ -59,7 +60,7 @@ public partial class FormMain : Form
{
connectionPoint.Connection = await ConnectionMultiplexer.ConnectAsync(ConnectionString, x => x.AllowAdmin = true);
}
- catch(RedisConnectionException)
+ catch (RedisConnectionException)
{
return;
}
@@ -386,7 +387,7 @@ public partial class FormMain : Form
return;
- if (this.treeView1.SelectedNode.Tag is not ConnectionPoint connectionPoint || connectionPoint.Db == null)
+ if (this.treeView1.SelectedNode.Parent.Tag is not ConnectionPoint connectionPoint || connectionPoint.Db == null)
return;
var key = this.treeView1.SelectedNode.Text;
@@ -403,6 +404,22 @@ public partial class FormMain : Form
}
}
+ private async void AddKeytoolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ if (this.treeView1.SelectedNode == null)
+ return;
+
+
+ if (this.treeView1.SelectedNode.Tag is not ConnectionPoint connectionPoint || connectionPoint.Db == null)
+ return;
+
+ var text = "test123";
+
+ await connectionPoint.Db.SetAddAsync("alphons" , text);
+
+ this.treeView1.SelectedNode.Nodes.Add(text);
+ }
+
private void FileToolStripMenuItem_DropDownOpening(object sender, EventArgs e)
{
this.toolStripMenuItem1.DropDownItems.Clear();
@@ -420,4 +437,6 @@ public partial class FormMain : Form
return;
await MakeConnectionAsync(connectionString);
}
+
+
}
diff --git a/RedisGui/FormMain.resx b/RedisGui/FormMain.resx
index 1615a76..4ad314b 100644
--- a/RedisGui/FormMain.resx
+++ b/RedisGui/FormMain.resx
@@ -139,7 +139,7 @@
<value>861, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
- <value>99</value>
+ <value>103</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">