reading , selecting and retrieving resources

This commit is contained in:
2015-09-05 18:16:45 +02:00
parent e225090ca8
commit 3df03c3352
4 changed files with 108 additions and 2 deletions

View File

@ -75,5 +75,14 @@ namespace CobProgAid.Properties {
return ResourceManager.GetString("CobMallLasFil", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to hejhopp.
/// </summary>
internal static string hejhopptest {
get {
return ResourceManager.GetString("hejhopptest", resourceCulture);
}
}
}
}

View File

@ -371,4 +371,7 @@
X-SKRIV-11900-SLUT.
EXIT.</value>
</data>
<data name="hejhopptest" xml:space="preserve">
<value>hejhopp</value>
</data>
</root>

View File

@ -29,6 +29,10 @@
private void InitializeComponent()
{
this.btnClose = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.clbProgType = new System.Windows.Forms.CheckedListBox();
this.label2 = new System.Windows.Forms.Label();
this.txtShow = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// btnClose
@ -42,21 +46,70 @@
this.btnClose.UseVisualStyleBackColor = true;
this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
//
// Form1
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(13, 13);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(210, 13);
this.label1.TabIndex = 1;
this.label1.Text = "Generera ett COBOL-program att börja med";
//
// clbProgType
//
this.clbProgType.FormattingEnabled = true;
this.clbProgType.Location = new System.Drawing.Point(16, 70);
this.clbProgType.MultiColumn = true;
this.clbProgType.Name = "clbProgType";
this.clbProgType.Size = new System.Drawing.Size(382, 94);
this.clbProgType.TabIndex = 2;
this.clbProgType.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.clbProgType_ItemCheck);
this.clbProgType.SelectedIndexChanged += new System.EventHandler(this.clbProgType_SelectedIndexChanged);
//
// label2
//
this.label2.AutoSize = true;
this.label2.CausesValidation = false;
this.label2.Location = new System.Drawing.Point(16, 51);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(97, 13);
this.label2.TabIndex = 3;
this.label2.Text = "Välj en program typ";
//
// txtShow
//
this.txtShow.Location = new System.Drawing.Point(16, 247);
this.txtShow.Multiline = true;
this.txtShow.Name = "txtShow";
this.txtShow.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.txtShow.Size = new System.Drawing.Size(474, 400);
this.txtShow.TabIndex = 4;
//
// frmProgAidHome
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(766, 659);
this.Controls.Add(this.txtShow);
this.Controls.Add(this.label2);
this.Controls.Add(this.clbProgType);
this.Controls.Add(this.label1);
this.Controls.Add(this.btnClose);
this.Name = "Form1";
this.Name = "frmProgAidHome";
this.Text = "Cobol Program Aid";
this.Load += new System.EventHandler(this.frmProgAidHome_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button btnClose;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.CheckedListBox clbProgType;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox txtShow;
}
}

View File

@ -1,9 +1,13 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
@ -12,6 +16,9 @@ namespace CobProgAid
{
public partial class frmProgAidHome : Form
{
ResourceSet resourceSet;
string workItem;
public frmProgAidHome()
{
InitializeComponent();
@ -21,5 +28,39 @@ namespace CobProgAid
{
this.Close();
}
private void frmProgAidHome_Load(object sender, EventArgs e)
{
//foreach (string name in Properties.Resources.)
//{
// clbProgType.Items.Add(name);
//}
resourceSet = Properties.Resources.ResourceManager.GetResourceSet(CultureInfo.CurrentUICulture, true, true);
foreach (DictionaryEntry entry in resourceSet)
{
string resourceKey = (string)entry.Key;
//object resource = entry.Value;
clbProgType.Items.Add(resourceKey);
}
}
private void clbProgType_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void clbProgType_ItemCheck(object sender, ItemCheckEventArgs e)
{
workItem = resourceSet.GetString( clbProgType.SelectedItem.ToString());
txtShow.Text = workItem;
}
}
}