using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Collections.Specialized; using Novell.SecretStore.NSSCSWrapper; namespace SecretStoreService { /// /// Summary description for DisplaySecret. /// public class DisplaySecret : System.Windows.Forms.Form { private System.Windows.Forms.Label Identifier; private System.Windows.Forms.TextBox SecretID; private System.Windows.Forms.Label Value; private System.Windows.Forms.Label dateCreated; private System.Windows.Forms.Label ModifiedLabel; private System.Windows.Forms.Label Modified; private System.Windows.Forms.Label CreatedLabel2; private System.Windows.Forms.Label created; private System.Windows.Forms.Label label1; private System.Windows.Forms.CheckBox cbDisplayValues; private Boolean m_bDisplayValues = false; private Secret m_secret = null; private System.Windows.Forms.ListView listView1; private System.Windows.Forms.Button btnClose; private System.Windows.Forms.Label labAccessed; /// /// Required designer variable. /// private System.ComponentModel.Container components = null; public DisplaySecret() { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // } /// /// 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() { this.Identifier = new System.Windows.Forms.Label(); this.SecretID = new System.Windows.Forms.TextBox(); this.Value = new System.Windows.Forms.Label(); this.btnClose = new System.Windows.Forms.Button(); this.dateCreated = new System.Windows.Forms.Label(); this.ModifiedLabel = new System.Windows.Forms.Label(); this.CreatedLabel2 = new System.Windows.Forms.Label(); this.Modified = new System.Windows.Forms.Label(); this.created = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); this.labAccessed = new System.Windows.Forms.Label(); this.cbDisplayValues = new System.Windows.Forms.CheckBox(); this.listView1 = new System.Windows.Forms.ListView(); this.SuspendLayout(); // // Identifier // this.Identifier.Location = new System.Drawing.Point(16, 24); this.Identifier.Name = "Identifier"; this.Identifier.Size = new System.Drawing.Size(64, 24); this.Identifier.TabIndex = 0; this.Identifier.Text = "Identifier"; // // SecretID // this.SecretID.Location = new System.Drawing.Point(72, 24); this.SecretID.Name = "SecretID"; this.SecretID.ReadOnly = true; this.SecretID.Size = new System.Drawing.Size(304, 20); this.SecretID.TabIndex = 1; this.SecretID.Text = ""; // // Value // this.Value.Location = new System.Drawing.Point(16, 64); this.Value.Name = "Value"; this.Value.Size = new System.Drawing.Size(40, 16); this.Value.TabIndex = 2; this.Value.Text = "Value"; // // btnClose // this.btnClose.Location = new System.Drawing.Point(336, 312); this.btnClose.Name = "btnClose"; this.btnClose.Size = new System.Drawing.Size(64, 24); this.btnClose.TabIndex = 4; this.btnClose.Text = "Close"; this.btnClose.Click += new System.EventHandler(this.button1_Click); // // dateCreated // this.dateCreated.Location = new System.Drawing.Point(16, 232); this.dateCreated.Name = "dateCreated"; this.dateCreated.Size = new System.Drawing.Size(72, 16); this.dateCreated.TabIndex = 5; this.dateCreated.Text = "Created"; // // ModifiedLabel // this.ModifiedLabel.Location = new System.Drawing.Point(16, 256); this.ModifiedLabel.Name = "ModifiedLabel"; this.ModifiedLabel.Size = new System.Drawing.Size(48, 16); this.ModifiedLabel.TabIndex = 6; this.ModifiedLabel.Text = "Modified"; // // CreatedLabel2 // this.CreatedLabel2.Location = new System.Drawing.Point(0, 0); this.CreatedLabel2.Name = "CreatedLabel2"; this.CreatedLabel2.TabIndex = 0; // // Modified // this.Modified.Location = new System.Drawing.Point(96, 256); this.Modified.Name = "Modified"; this.Modified.Size = new System.Drawing.Size(272, 16); this.Modified.TabIndex = 8; // // created // this.created.Location = new System.Drawing.Point(96, 232); this.created.Name = "created"; this.created.Size = new System.Drawing.Size(288, 16); this.created.TabIndex = 9; // // label1 // this.label1.Location = new System.Drawing.Point(16, 280); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(72, 16); this.label1.TabIndex = 10; this.label1.Text = "Last accessed"; // // labAccessed // this.labAccessed.Location = new System.Drawing.Point(96, 280); this.labAccessed.Name = "labAccessed"; this.labAccessed.Size = new System.Drawing.Size(280, 16); this.labAccessed.TabIndex = 11; // // cbDisplayValues // this.cbDisplayValues.Location = new System.Drawing.Point(72, 192); this.cbDisplayValues.Name = "cbDisplayValues"; this.cbDisplayValues.TabIndex = 12; this.cbDisplayValues.Text = "Display values"; this.cbDisplayValues.CheckedChanged += new System.EventHandler(this.cbDisplayValues_CheckedChanged); // // listView1 // this.listView1.FullRowSelect = true; this.listView1.GridLines = true; this.listView1.Location = new System.Drawing.Point(72, 64); this.listView1.Name = "listView1"; this.listView1.Size = new System.Drawing.Size(304, 120); this.listView1.TabIndex = 13; // // DisplaySecret // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(424, 358); this.Controls.Add(this.listView1); this.Controls.Add(this.cbDisplayValues); this.Controls.Add(this.labAccessed); this.Controls.Add(this.label1); this.Controls.Add(this.created); this.Controls.Add(this.Modified); this.Controls.Add(this.ModifiedLabel); this.Controls.Add(this.dateCreated); this.Controls.Add(this.btnClose); this.Controls.Add(this.Value); this.Controls.Add(this.SecretID); this.Controls.Add(this.Identifier); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "DisplaySecret"; this.ShowInTaskbar = false; this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "View Secret"; this.TopMost = true; this.Load += new System.EventHandler(this.DisplaySecret_Load); this.ResumeLayout(false); } #endregion public void setData(string sID, Secret secret, string sCreated, string sModified, string sAccessed) { m_secret = secret; this.SecretID.Text = sID; showNameValues(secret); this.created.Text = sCreated; this.Modified.Text = sModified; this.labAccessed.Text = sAccessed; this.Refresh(); } private void button1_Click(object sender, System.EventArgs e) { Dispose(true); } private void cbDisplayValues_CheckedChanged(object sender, System.EventArgs e) { if (cbDisplayValues.Checked) { DialogResult DR=new DialogResult() ; DR=MessageBox.Show ("Is the area secure?","Display Values",MessageBoxButtons.YesNo,MessageBoxIcon.Warning); string Str=DR.ToString(); switch (Str) { case "No": cbDisplayValues.Checked = false; return; } m_bDisplayValues = true; } else m_bDisplayValues = false; showNameValues(m_secret); } private void showNameValues(Secret secret) { NameValueCollection nvc = secret.getKeyValueCollection(); ListViewItem MyItem; listView1.Items.Clear(); for (int i=0; i