using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using Novell.SecretStore.NSSCSWrapper;
namespace SecretStoreService
{
///
/// Summary description for Form3.
///
public class NewEntry : System.Windows.Forms.Form
{
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox Key;
private System.Windows.Forms.TextBox value;
private System.Windows.Forms.Button cancel;
private System.Windows.Forms.Button Ok;
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
private AddSecretForm m_asf = null;
private Secret m_secret = null;
public NewEntry(AddSecretForm asf, Secret secret)
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
m_asf = asf;
m_secret = secret;
}
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(NewEntry));
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.Key = new System.Windows.Forms.TextBox();
this.value = new System.Windows.Forms.TextBox();
this.cancel = new System.Windows.Forms.Button();
this.Ok = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// label1
//
this.label1.AccessibleDescription = resources.GetString("label1.AccessibleDescription");
this.label1.AccessibleName = resources.GetString("label1.AccessibleName");
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("label1.Anchor")));
this.label1.AutoSize = ((bool)(resources.GetObject("label1.AutoSize")));
this.label1.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("label1.Dock")));
this.label1.Enabled = ((bool)(resources.GetObject("label1.Enabled")));
this.label1.Font = ((System.Drawing.Font)(resources.GetObject("label1.Font")));
this.label1.Image = ((System.Drawing.Image)(resources.GetObject("label1.Image")));
this.label1.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("label1.ImageAlign")));
this.label1.ImageIndex = ((int)(resources.GetObject("label1.ImageIndex")));
this.label1.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("label1.ImeMode")));
this.label1.Location = ((System.Drawing.Point)(resources.GetObject("label1.Location")));
this.label1.Name = "label1";
this.label1.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("label1.RightToLeft")));
this.label1.Size = ((System.Drawing.Size)(resources.GetObject("label1.Size")));
this.label1.TabIndex = ((int)(resources.GetObject("label1.TabIndex")));
this.label1.Text = resources.GetString("label1.Text");
this.label1.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("label1.TextAlign")));
this.label1.Visible = ((bool)(resources.GetObject("label1.Visible")));
//
// label2
//
this.label2.AccessibleDescription = resources.GetString("label2.AccessibleDescription");
this.label2.AccessibleName = resources.GetString("label2.AccessibleName");
this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("label2.Anchor")));
this.label2.AutoSize = ((bool)(resources.GetObject("label2.AutoSize")));
this.label2.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("label2.Dock")));
this.label2.Enabled = ((bool)(resources.GetObject("label2.Enabled")));
this.label2.Font = ((System.Drawing.Font)(resources.GetObject("label2.Font")));
this.label2.Image = ((System.Drawing.Image)(resources.GetObject("label2.Image")));
this.label2.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("label2.ImageAlign")));
this.label2.ImageIndex = ((int)(resources.GetObject("label2.ImageIndex")));
this.label2.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("label2.ImeMode")));
this.label2.Location = ((System.Drawing.Point)(resources.GetObject("label2.Location")));
this.label2.Name = "label2";
this.label2.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("label2.RightToLeft")));
this.label2.Size = ((System.Drawing.Size)(resources.GetObject("label2.Size")));
this.label2.TabIndex = ((int)(resources.GetObject("label2.TabIndex")));
this.label2.Text = resources.GetString("label2.Text");
this.label2.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("label2.TextAlign")));
this.label2.Visible = ((bool)(resources.GetObject("label2.Visible")));
//
// Key
//
this.Key.AccessibleDescription = resources.GetString("Key.AccessibleDescription");
this.Key.AccessibleName = resources.GetString("Key.AccessibleName");
this.Key.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("Key.Anchor")));
this.Key.AutoSize = ((bool)(resources.GetObject("Key.AutoSize")));
this.Key.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("Key.BackgroundImage")));
this.Key.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("Key.Dock")));
this.Key.Enabled = ((bool)(resources.GetObject("Key.Enabled")));
this.Key.Font = ((System.Drawing.Font)(resources.GetObject("Key.Font")));
this.Key.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("Key.ImeMode")));
this.Key.Location = ((System.Drawing.Point)(resources.GetObject("Key.Location")));
this.Key.MaxLength = ((int)(resources.GetObject("Key.MaxLength")));
this.Key.Multiline = ((bool)(resources.GetObject("Key.Multiline")));
this.Key.Name = "Key";
this.Key.PasswordChar = ((char)(resources.GetObject("Key.PasswordChar")));
this.Key.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("Key.RightToLeft")));
this.Key.ScrollBars = ((System.Windows.Forms.ScrollBars)(resources.GetObject("Key.ScrollBars")));
this.Key.Size = ((System.Drawing.Size)(resources.GetObject("Key.Size")));
this.Key.TabIndex = ((int)(resources.GetObject("Key.TabIndex")));
this.Key.Text = resources.GetString("Key.Text");
this.Key.TextAlign = ((System.Windows.Forms.HorizontalAlignment)(resources.GetObject("Key.TextAlign")));
this.Key.Visible = ((bool)(resources.GetObject("Key.Visible")));
this.Key.WordWrap = ((bool)(resources.GetObject("Key.WordWrap")));
//
// value
//
this.value.AccessibleDescription = resources.GetString("value.AccessibleDescription");
this.value.AccessibleName = resources.GetString("value.AccessibleName");
this.value.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("value.Anchor")));
this.value.AutoSize = ((bool)(resources.GetObject("value.AutoSize")));
this.value.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("value.BackgroundImage")));
this.value.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("value.Dock")));
this.value.Enabled = ((bool)(resources.GetObject("value.Enabled")));
this.value.Font = ((System.Drawing.Font)(resources.GetObject("value.Font")));
this.value.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("value.ImeMode")));
this.value.Location = ((System.Drawing.Point)(resources.GetObject("value.Location")));
this.value.MaxLength = ((int)(resources.GetObject("value.MaxLength")));
this.value.Multiline = ((bool)(resources.GetObject("value.Multiline")));
this.value.Name = "value";
this.value.PasswordChar = ((char)(resources.GetObject("value.PasswordChar")));
this.value.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("value.RightToLeft")));
this.value.ScrollBars = ((System.Windows.Forms.ScrollBars)(resources.GetObject("value.ScrollBars")));
this.value.Size = ((System.Drawing.Size)(resources.GetObject("value.Size")));
this.value.TabIndex = ((int)(resources.GetObject("value.TabIndex")));
this.value.Text = resources.GetString("value.Text");
this.value.TextAlign = ((System.Windows.Forms.HorizontalAlignment)(resources.GetObject("value.TextAlign")));
this.value.Visible = ((bool)(resources.GetObject("value.Visible")));
this.value.WordWrap = ((bool)(resources.GetObject("value.WordWrap")));
//
// cancel
//
this.cancel.AccessibleDescription = resources.GetString("cancel.AccessibleDescription");
this.cancel.AccessibleName = resources.GetString("cancel.AccessibleName");
this.cancel.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("cancel.Anchor")));
this.cancel.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("cancel.BackgroundImage")));
this.cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancel.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("cancel.Dock")));
this.cancel.Enabled = ((bool)(resources.GetObject("cancel.Enabled")));
this.cancel.FlatStyle = ((System.Windows.Forms.FlatStyle)(resources.GetObject("cancel.FlatStyle")));
this.cancel.Font = ((System.Drawing.Font)(resources.GetObject("cancel.Font")));
this.cancel.Image = ((System.Drawing.Image)(resources.GetObject("cancel.Image")));
this.cancel.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("cancel.ImageAlign")));
this.cancel.ImageIndex = ((int)(resources.GetObject("cancel.ImageIndex")));
this.cancel.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("cancel.ImeMode")));
this.cancel.Location = ((System.Drawing.Point)(resources.GetObject("cancel.Location")));
this.cancel.Name = "cancel";
this.cancel.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("cancel.RightToLeft")));
this.cancel.Size = ((System.Drawing.Size)(resources.GetObject("cancel.Size")));
this.cancel.TabIndex = ((int)(resources.GetObject("cancel.TabIndex")));
this.cancel.Text = resources.GetString("cancel.Text");
this.cancel.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("cancel.TextAlign")));
this.cancel.Visible = ((bool)(resources.GetObject("cancel.Visible")));
this.cancel.Click += new System.EventHandler(this.cancel_Click);
//
// Ok
//
this.Ok.AccessibleDescription = resources.GetString("Ok.AccessibleDescription");
this.Ok.AccessibleName = resources.GetString("Ok.AccessibleName");
this.Ok.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("Ok.Anchor")));
this.Ok.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("Ok.BackgroundImage")));
this.Ok.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.Ok.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("Ok.Dock")));
this.Ok.Enabled = ((bool)(resources.GetObject("Ok.Enabled")));
this.Ok.FlatStyle = ((System.Windows.Forms.FlatStyle)(resources.GetObject("Ok.FlatStyle")));
this.Ok.Font = ((System.Drawing.Font)(resources.GetObject("Ok.Font")));
this.Ok.Image = ((System.Drawing.Image)(resources.GetObject("Ok.Image")));
this.Ok.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("Ok.ImageAlign")));
this.Ok.ImageIndex = ((int)(resources.GetObject("Ok.ImageIndex")));
this.Ok.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("Ok.ImeMode")));
this.Ok.Location = ((System.Drawing.Point)(resources.GetObject("Ok.Location")));
this.Ok.Name = "Ok";
this.Ok.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("Ok.RightToLeft")));
this.Ok.Size = ((System.Drawing.Size)(resources.GetObject("Ok.Size")));
this.Ok.TabIndex = ((int)(resources.GetObject("Ok.TabIndex")));
this.Ok.Text = resources.GetString("Ok.Text");
this.Ok.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("Ok.TextAlign")));
this.Ok.Visible = ((bool)(resources.GetObject("Ok.Visible")));
this.Ok.Click += new System.EventHandler(this.Ok_Click);
//
// NewEntry
//
this.AcceptButton = this.Ok;
this.AccessibleDescription = resources.GetString("$this.AccessibleDescription");
this.AccessibleName = resources.GetString("$this.AccessibleName");
this.AutoScaleBaseSize = ((System.Drawing.Size)(resources.GetObject("$this.AutoScaleBaseSize")));
this.AutoScroll = ((bool)(resources.GetObject("$this.AutoScroll")));
this.AutoScrollMargin = ((System.Drawing.Size)(resources.GetObject("$this.AutoScrollMargin")));
this.AutoScrollMinSize = ((System.Drawing.Size)(resources.GetObject("$this.AutoScrollMinSize")));
this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
this.CancelButton = this.cancel;
this.ClientSize = ((System.Drawing.Size)(resources.GetObject("$this.ClientSize")));
this.Controls.Add(this.cancel);
this.Controls.Add(this.Ok);
this.Controls.Add(this.value);
this.Controls.Add(this.Key);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Enabled = ((bool)(resources.GetObject("$this.Enabled")));
this.Font = ((System.Drawing.Font)(resources.GetObject("$this.Font")));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("$this.ImeMode")));
this.Location = ((System.Drawing.Point)(resources.GetObject("$this.Location")));
this.MaximizeBox = false;
this.MaximumSize = ((System.Drawing.Size)(resources.GetObject("$this.MaximumSize")));
this.MinimizeBox = false;
this.MinimumSize = ((System.Drawing.Size)(resources.GetObject("$this.MinimumSize")));
this.Name = "NewEntry";
this.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("$this.RightToLeft")));
this.ShowInTaskbar = false;
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.StartPosition = ((System.Windows.Forms.FormStartPosition)(resources.GetObject("$this.StartPosition")));
this.Text = resources.GetString("$this.Text");
this.ResumeLayout(false);
}
#endregion
private void Ok_Click(object sender, System.EventArgs e)
{
if (this.Key.Text != null && this.value.Text != null)
{
//m_asf.keyValueBox.Items.Add(Key.Text + "=" + value.Text);
m_secret.setKeyValuePair(Key.Text.ToString(), value.Text.ToString());
m_asf.refreshKeyValueBox();
}
this.Close();
}
private void cancel_Click(object sender, System.EventArgs e)
{
this.Close();
}
public void setKeyValue(string sKey, string sValue)
{
this.Key.Text = sKey;
this.value.Text = sValue;
}
}
}