|
/*
* Patrick Bounaix
* www.L0g1c4L.com
*
* See AssemblyInfo.cs
* for License Information
* */
#region using
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
#endregion
namespace L0g1c4L.ResxWriter.UI
{
/// <summary>
/// Summary description for FrmMain.
/// </summary>
public class FrmMain : System.Windows.Forms.Form
{
#region Private...
#region Properties
private System.Windows.Forms.MainMenu mainMenu;
private System.Windows.Forms.MenuItem miFile;
private System.Windows.Forms.MenuItem menuItem1;
private System.Windows.Forms.MenuItem miExit;
private System.Windows.Forms.MenuItem miGenerate;
private System.Windows.Forms.OpenFileDialog openFileDialog;
private System.Windows.Forms.Button btnGenerate;
private System.Windows.Forms.ProgressBar progressBar;
private System.Windows.Forms.MenuItem menuItem5;
private System.Windows.Forms.MenuItem miHelp;
private System.Windows.Forms.MenuItem miAbout;
private System.Windows.Forms.MenuItem miUsage;
private System.Windows.Forms.SaveFileDialog saveFileDialog;
private System.Windows.Forms.ToolTip toolTip1;
private System.Windows.Forms.MenuItem miSetColumns;
private System.Windows.Forms.MenuItem menuItem3;
private System.ComponentModel.IContainer components = null;
#endregion
#region Methods
#region Dispose
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#endregion
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(FrmMain));
this.mainMenu = new System.Windows.Forms.MainMenu();
this.miFile = new System.Windows.Forms.MenuItem();
this.miGenerate = new System.Windows.Forms.MenuItem();
this.menuItem3 = new System.Windows.Forms.MenuItem();
this.miSetColumns = new System.Windows.Forms.MenuItem();
this.menuItem1 = new System.Windows.Forms.MenuItem();
this.miExit = new System.Windows.Forms.MenuItem();
this.miHelp = new System.Windows.Forms.MenuItem();
this.miUsage = new System.Windows.Forms.MenuItem();
this.menuItem5 = new System.Windows.Forms.MenuItem();
this.miAbout = new System.Windows.Forms.MenuItem();
this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
this.btnGenerate = new System.Windows.Forms.Button();
this.progressBar = new System.Windows.Forms.ProgressBar();
this.saveFileDialog = new System.Windows.Forms.SaveFileDialog();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.SuspendLayout();
//
// mainMenu
//
this.mainMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.miFile,
this.miHelp});
this.mainMenu.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("mainMenu.RightToLeft")));
//
// miFile
//
this.miFile.Enabled = ((bool)(resources.GetObject("miFile.Enabled")));
this.miFile.Index = 0;
this.miFile.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.miGenerate,
this.menuItem3,
this.miSetColumns,
this.menuItem1,
this.miExit});
this.miFile.Shortcut = ((System.Windows.Forms.Shortcut)(resources.GetObject("miFile.Shortcut")));
this.miFile.ShowShortcut = ((bool)(resources.GetObject("miFile.ShowShortcut")));
this.miFile.Text = resources.GetString("miFile.Text");
this.miFile.Visible = ((bool)(resources.GetObject("miFile.Visible")));
//
// miGenerate
//
this.miGenerate.Enabled = ((bool)(resources.GetObject("miGenerate.Enabled")));
this.miGenerate.Index = 0;
this.miGenerate.Shortcut = ((System.Windows.Forms.Shortcut)(resources.GetObject("miGenerate.Shortcut")));
this.miGenerate.ShowShortcut = ((bool)(resources.GetObject("miGenerate.ShowShortcut")));
this.miGenerate.Text = resources.GetString("miGenerate.Text");
this.miGenerate.Visible = ((bool)(resources.GetObject("miGenerate.Visible")));
this.miGenerate.Click += new System.EventHandler(this.btnLoad_Click);
//
// menuItem3
//
this.menuItem3.Enabled = ((bool)(resources.GetObject("menuItem3.Enabled")));
this.menuItem3.Index = 1;
this.menuItem3.Shortcut = ((System.Windows.Forms.Shortcut)(resources.GetObject("menuItem3.Shortcut")));
this.menuItem3.ShowShortcut = ((bool)(resources.GetObject("menuItem3.ShowShortcut")));
this.menuItem3.Text = resources.GetString("menuItem3.Text");
this.menuItem3.Visible = ((bool)(resources.GetObject("menuItem3.Visible")));
//
// miSetColumns
//
this.miSetColumns.Enabled = ((bool)(resources.GetObject("miSetColumns.Enabled")));
this.miSetColumns.Index = 2;
this.miSetColumns.Shortcut = ((System.Windows.Forms.Shortcut)(resources.GetObject("miSetColumns.Shortcut")));
this.miSetColumns.ShowShortcut = ((bool)(resources.GetObject("miSetColumns.ShowShortcut")));
this.miSetColumns.Text = resources.GetString("miSetColumns.Text");
this.miSetColumns.Visible = ((bool)(resources.GetObject("miSetColumns.Visible")));
this.miSetColumns.Click += new System.EventHandler(this.miSetColumns_Click);
//
// menuItem1
//
this.menuItem1.Enabled = ((bool)(resources.GetObject("menuItem1.Enabled")));
this.menuItem1.Index = 3;
this.menuItem1.Shortcut = ((System.Windows.Forms.Shortcut)(resources.GetObject("menuItem1.Shortcut")));
this.menuItem1.ShowShortcut = ((bool)(resources.GetObject("menuItem1.ShowShortcut")));
this.menuItem1.Text = resources.GetString("menuItem1.Text");
this.menuItem1.Visible = ((bool)(resources.GetObject("menuItem1.Visible")));
//
// miExit
//
this.miExit.Enabled = ((bool)(resources.GetObject("miExit.Enabled")));
this.miExit.Index = 4;
this.miExit.Shortcut = ((System.Windows.Forms.Shortcut)(resources.GetObject("miExit.Shortcut")));
this.miExit.ShowShortcut = ((bool)(resources.GetObject("miExit.ShowShortcut")));
this.miExit.Text = resources.GetString("miExit.Text");
this.miExit.Visible = ((bool)(resources.GetObject("miExit.Visible")));
this.miExit.Click += new System.EventHandler(this.miExit_Click);
//
// miHelp
//
this.miHelp.Enabled = ((bool)(resources.GetObject("miHelp.Enabled")));
this.miHelp.Index = 1;
this.miHelp.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.miUsage,
this.menuItem5,
this.miAbout});
this.miHelp.Shortcut = ((System.Windows.Forms.Shortcut)(resources.GetObject("miHelp.Shortcut")));
this.miHelp.ShowShortcut = ((bool)(resources.GetObject("miHelp.ShowShortcut")));
this.miHelp.Text = resources.GetString("miHelp.Text");
this.miHelp.Visible = ((bool)(resources.GetObject("miHelp.Visible")));
//
// miUsage
//
this.miUsage.Enabled = ((bool)(resources.GetObject("miUsage.Enabled")));
this.miUsage.Index = 0;
this.miUsage.Shortcut = ((System.Windows.Forms.Shortcut)(resources.GetObject("miUsage.Shortcut")));
this.miUsage.ShowShortcut = ((bool)(resources.GetObject("miUsage.ShowShortcut")));
this.miUsage.Text = resources.GetString("miUsage.Text");
this.miUsage.Visible = ((bool)(resources.GetObject("miUsage.Visible")));
this.miUsage.Click += new System.EventHandler(this.miUsage_Click);
//
// menuItem5
//
this.menuItem5.Enabled = ((bool)(resources.GetObject("menuItem5.Enabled")));
this.menuItem5.Index = 1;
this.menuItem5.Shortcut = ((System.Windows.Forms.Shortcut)(resources.GetObject("menuItem5.Shortcut")));
this.menuItem5.ShowShortcut = ((bool)(resources.GetObject("menuItem5.ShowShortcut")));
this.menuItem5.Text = resources.GetString("menuItem5.Text");
this.menuItem5.Visible = ((bool)(resources.GetObject("menuItem5.Visible")));
//
// miAbout
//
this.miAbout.Enabled = ((bool)(resources.GetObject("miAbout.Enabled")));
this.miAbout.Index = 2;
this.miAbout.Shortcut = ((System.Windows.Forms.Shortcut)(resources.GetObject("miAbout.Shortcut")));
this.miAbout.ShowShortcut = ((bool)(resources.GetObject("miAbout.ShowShortcut")));
this.miAbout.Text = resources.GetString("miAbout.Text");
this.miAbout.Visible = ((bool)(resources.GetObject("miAbout.Visible")));
this.miAbout.Click += new System.EventHandler(this.miAbout_Click);
//
// openFileDialog
//
this.openFileDialog.Filter = resources.GetString("openFileDialog.Filter");
this.openFileDialog.Title = resources.GetString("openFileDialog.Title");
//
// btnGenerate
//
this.btnGenerate.AccessibleDescription = resources.GetString("btnGenerate.AccessibleDescription");
this.btnGenerate.AccessibleName = resources.GetString("btnGenerate.AccessibleName");
this.btnGenerate.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("btnGenerate.Anchor")));
this.btnGenerate.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnGenerate.BackgroundImage")));
this.btnGenerate.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("btnGenerate.Dock")));
this.btnGenerate.Enabled = ((bool)(resources.GetObject("btnGenerate.Enabled")));
this.btnGenerate.FlatStyle = ((System.Windows.Forms.FlatStyle)(resources.GetObject("btnGenerate.FlatStyle")));
this.btnGenerate.Font = ((System.Drawing.Font)(resources.GetObject("btnGenerate.Font")));
this.btnGenerate.Image = ((System.Drawing.Image)(resources.GetObject("btnGenerate.Image")));
this.btnGenerate.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnGenerate.ImageAlign")));
this.btnGenerate.ImageIndex = ((int)(resources.GetObject("btnGenerate.ImageIndex")));
this.btnGenerate.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("btnGenerate.ImeMode")));
this.btnGenerate.Location = ((System.Drawing.Point)(resources.GetObject("btnGenerate.Location")));
this.btnGenerate.Name = "btnGenerate";
this.btnGenerate.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("btnGenerate.RightToLeft")));
this.btnGenerate.Size = ((System.Drawing.Size)(resources.GetObject("btnGenerate.Size")));
this.btnGenerate.TabIndex = ((int)(resources.GetObject("btnGenerate.TabIndex")));
this.btnGenerate.Text = resources.GetString("btnGenerate.Text");
this.btnGenerate.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnGenerate.TextAlign")));
this.toolTip1.SetToolTip(this.btnGenerate, resources.GetString("btnGenerate.ToolTip"));
this.btnGenerate.Visible = ((bool)(resources.GetObject("btnGenerate.Visible")));
this.btnGenerate.Click += new System.EventHandler(this.btnLoad_Click);
//
// progressBar
//
this.progressBar.AccessibleDescription = resources.GetString("progressBar.AccessibleDescription");
this.progressBar.AccessibleName = resources.GetString("progressBar.AccessibleName");
this.progressBar.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("progressBar.Anchor")));
this.progressBar.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("progressBar.BackgroundImage")));
this.progressBar.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("progressBar.Dock")));
this.progressBar.Enabled = ((bool)(resources.GetObject("progressBar.Enabled")));
this.progressBar.Font = ((System.Drawing.Font)(resources.GetObject("progressBar.Font")));
this.progressBar.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("progressBar.ImeMode")));
this.progressBar.Location = ((System.Drawing.Point)(resources.GetObject("progressBar.Location")));
this.progressBar.Name = "progressBar";
this.progressBar.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("progressBar.RightToLeft")));
this.progressBar.Size = ((System.Drawing.Size)(resources.GetObject("progressBar.Size")));
this.progressBar.Step = 1;
this.progressBar.TabIndex = ((int)(resources.GetObject("progressBar.TabIndex")));
this.progressBar.Text = resources.GetString("progressBar.Text");
this.toolTip1.SetToolTip(this.progressBar, resources.GetString("progressBar.ToolTip"));
this.progressBar.Visible = ((bool)(resources.GetObject("progressBar.Visible")));
//
// saveFileDialog
//
this.saveFileDialog.Filter = resources.GetString("saveFileDialog.Filter");
this.saveFileDialog.Title = resources.GetString("saveFileDialog.Title");
//
// FrmMain
//
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.ClientSize = ((System.Drawing.Size)(resources.GetObject("$this.ClientSize")));
this.Controls.Add(this.progressBar);
this.Controls.Add(this.btnGenerate);
this.Enabled = ((bool)(resources.GetObject("$this.Enabled")));
this.Font = ((System.Drawing.Font)(resources.GetObject("$this.Font")));
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.MaximumSize = ((System.Drawing.Size)(resources.GetObject("$this.MaximumSize")));
this.Menu = this.mainMenu;
this.MinimumSize = ((System.Drawing.Size)(resources.GetObject("$this.MinimumSize")));
this.Name = "FrmMain";
this.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("$this.RightToLeft")));
this.StartPosition = ((System.Windows.Forms.FormStartPosition)(resources.GetObject("$this.StartPosition")));
this.Text = resources.GetString("$this.Text");
this.toolTip1.SetToolTip(this, resources.GetString("$this.ToolTip"));
this.Closing += new System.ComponentModel.CancelEventHandler(this.FrmMain_Closing);
this.Load += new System.EventHandler(this.FrmMain_Load);
this.ResumeLayout(false);
}
#endregion
#region FrmMain_Load
private void FrmMain_Load(object sender, System.EventArgs e)
{
ClsMain.manager.LoadApplicationSettings();
}
#endregion
#region Load
/// <summary>
/// Calls ClsManager.GetDataFromExcelFile and
/// ClsManager.WriteResources
/// </summary>
/// <param name="sender">object</param>
/// <param name="e">System.EventArgs</param>
private void btnLoad_Click(object sender, System.EventArgs e)
{
if (this.openFileDialog.ShowDialog() == DialogResult.OK)
{
if (ClsMain.manager.GetDataFromExcelFile(this.openFileDialog.FileName))
{
if (this.saveFileDialog.ShowDialog() == DialogResult.OK)
{
ClsMain.manager.WriteResources(this.saveFileDialog.FileName);
}
}
}
}
#endregion
#region Menu Item Events
private void miExit_Click(object sender, System.EventArgs e)
{
if (MessageBox.Show("Exit ResxWriter?", "ResxWriter",
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
ClsMain.manager.SaveApplicationSettings();
Application.Exit();
}
}
private void miUsage_Click(object sender, System.EventArgs e)
{
FrmMessage m = new FrmMessage();
m.SetMessageText("ResxWriter Usage", "Click 'Generate .resx Files' to select the desired Excel Spreadsheet "
+ "and begin generation of .resx files."
+ "\n\nSpreadsheet by default contains the following:"
+ "\n\n3 Columns named 'ControlName', 'English', 'French', with "
+ "'Sheet1' containing the relevant data."
+ "\n\nOnce the file has been opened, specify a location and name for the files, in conjunction "
+ "with the naming convention of the target application."
+ "\n\nNOTE: Columns can be changed via the menu option.");
m.ShowDialog();
}
private void miAbout_Click(object sender, System.EventArgs e)
{
FrmMessage m = new FrmMessage();
m.SetMessageText("ResxWriter About", "ResxWriter is a utility designed to "
+ "allow translation for .NET applications to be done via an Excel Spreadsheet."
+ "\n\nSee 'Usage' for more detailed instructions, or visit:"
+ "\n\n\t\t\thttp://resxwriter.l0g1c4l.com");
m.ShowDialog();
}
private void miSetColumns_Click(object sender, System.EventArgs e)
{
FrmManageColumns setColumns = new FrmManageColumns();
setColumns.ShowDialog();
}
#endregion
#region Closing
private void FrmMain_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
if (MessageBox.Show("Exit ResxWriter?", "ResxWriter",
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
{
e.Cancel = true;
}
else
{
ClsMain.manager.SaveApplicationSettings();
}
}
#endregion
#endregion
#endregion
#region Public...
#region Constructor
/// <summary>
///
/// </summary>
public FrmMain()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
this.openFileDialog.InitialDirectory = Application.StartupPath + "\\SampleData";
}
#endregion
#region Properties
/// <summary>
/// ProgressBar displayed during Write operation.
/// </summary>
public System.Windows.Forms.ProgressBar WriteProgressBar
{
get {return this.progressBar;}
set {this.progressBar = value;}
}
/// <summary>
/// Size of Main Form.
/// </summary>
public Size FrmMainSize
{
get {return this.Size;}
set {this.Size = value;}
}
/// <summary>
/// Location of Main Form.
/// </summary>
public Point FrmMainLocation
{
get {return this.Location;}
set {this.Location = value;}
}
#endregion
#endregion
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.