From 07376e9ecd6687b2c4278661d0eaf3795d5124c3 Mon Sep 17 00:00:00 2001 From: lempamo Date: Wed, 5 Apr 2017 21:57:09 -0400 Subject: language selection screen! --- ShiftOS.WinForms/LanguageSelector.Designer.cs | 94 ++++++++++++++++++++ ShiftOS.WinForms/LanguageSelector.cs | 44 ++++++++++ ShiftOS.WinForms/LanguageSelector.resx | 120 ++++++++++++++++++++++++++ ShiftOS.WinForms/Program.cs | 9 +- ShiftOS.WinForms/ShiftOS.WinForms.csproj | 9 ++ ShiftOS.WinForms/WFLanguageProvider.cs | 17 ++++ 6 files changed, 292 insertions(+), 1 deletion(-) create mode 100644 ShiftOS.WinForms/LanguageSelector.Designer.cs create mode 100644 ShiftOS.WinForms/LanguageSelector.cs create mode 100644 ShiftOS.WinForms/LanguageSelector.resx (limited to 'ShiftOS.WinForms') diff --git a/ShiftOS.WinForms/LanguageSelector.Designer.cs b/ShiftOS.WinForms/LanguageSelector.Designer.cs new file mode 100644 index 0000000..508b5df --- /dev/null +++ b/ShiftOS.WinForms/LanguageSelector.Designer.cs @@ -0,0 +1,94 @@ +using ShiftOS.Engine; + +namespace ShiftOS.WinForms +{ + partial class LanguageSelector + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (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.comboBox1 = new System.Windows.Forms.ComboBox(); + this.button1 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // comboBox1 + // + this.comboBox1.Cursor = System.Windows.Forms.Cursors.Default; + this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBox1.FormattingEnabled = true; + this.comboBox1.Items.AddRange(Localization.GetAllLanguages()); + this.comboBox1.Location = new System.Drawing.Point(13, 13); + this.comboBox1.Name = "comboBox1"; + this.comboBox1.Size = new System.Drawing.Size(167, 21); + this.comboBox1.TabIndex = 0; + this.comboBox1.SelectedItem = this.comboBox1.Items[0]; + // + // button1 + // + this.button1.Location = new System.Drawing.Point(12, 40); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(75, 23); + this.button1.TabIndex = 1; + this.button1.Text = "Run"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // button2 + // + this.button2.Location = new System.Drawing.Point(105, 40); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(75, 23); + this.button2.TabIndex = 2; + this.button2.Text = "Quit"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // LanguageSelector + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(192, 74); + this.Controls.Add(this.button2); + this.Controls.Add(this.button1); + this.Controls.Add(this.comboBox1); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "LanguageSelector"; + this.ShowIcon = false; + this.Text = "Choose A Language"; + this.ResumeLayout(false); + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.closing); + + } + + #endregion + + private System.Windows.Forms.ComboBox comboBox1; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Button button2; + } +} \ No newline at end of file diff --git a/ShiftOS.WinForms/LanguageSelector.cs b/ShiftOS.WinForms/LanguageSelector.cs new file mode 100644 index 0000000..c9a5ac1 --- /dev/null +++ b/ShiftOS.WinForms/LanguageSelector.cs @@ -0,0 +1,44 @@ +using ShiftOS.Engine; +using ShiftOS.WinForms.Applications; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace ShiftOS.WinForms +{ + public partial class LanguageSelector : Form + { + public string languageID; + public bool rdy = false; + + public LanguageSelector() + { + InitializeComponent(); + } + + private void button1_Click(object sender, EventArgs e) + { + Localization.SetLanguageID((string)comboBox1.SelectedItem); + + rdy = true; + + this.Close(); + } + + private void button2_Click(object sender, EventArgs e) + { + Environment.Exit(0); + } + + private void closing(object sender, FormClosingEventArgs e) + { + if (!rdy) Environment.Exit(0); + } + } +} diff --git a/ShiftOS.WinForms/LanguageSelector.resx b/ShiftOS.WinForms/LanguageSelector.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ShiftOS.WinForms/LanguageSelector.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ShiftOS.WinForms/Program.cs b/ShiftOS.WinForms/Program.cs index 0578389..b5f371e 100644 --- a/ShiftOS.WinForms/Program.cs +++ b/ShiftOS.WinForms/Program.cs @@ -58,6 +58,14 @@ namespace ShiftOS.WinForms Environment.Exit(0); }; + var langselect = new LanguageSelector(); + langselect.ShowDialog(); + + while (!langselect.rdy) + { + + }; + TutorialManager.RegisterTutorial(new Oobe()); TerminalBackend.TerminalRequested += () => @@ -102,7 +110,6 @@ namespace ShiftOS.WinForms } } - public class WinformsFSFrontend : IFileSkimmer { diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index d865c62..d7b3478 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -258,6 +258,12 @@ + + Form + + + LanguageSelector.cs + Form @@ -383,6 +389,9 @@ FakeSetupScreen.cs + + LanguageSelector.cs + Oobe.cs diff --git a/ShiftOS.WinForms/WFLanguageProvider.cs b/ShiftOS.WinForms/WFLanguageProvider.cs index e762e7e..b6b652b 100644 --- a/ShiftOS.WinForms/WFLanguageProvider.cs +++ b/ShiftOS.WinForms/WFLanguageProvider.cs @@ -52,6 +52,18 @@ namespace ShiftOS.WinForms } } + public string GetLanguagePath() + { + switch (SaveSystem.CurrentSave.Language) + { + case "deutsch - in beta": + return Paths.GetPath("deutsch.local"); + default: + return Paths.GetPath("english.local"); + + } + } + public List GetJSONTranscripts() { var strings = new List(); @@ -65,6 +77,11 @@ namespace ShiftOS.WinForms Utils.WriteAllText(Paths.GetPath("english.local"), getDefault()); } + public void WriteTranscript() + { + Utils.WriteAllText(GetLanguagePath(), GetCurrentTranscript()); + } + private string getDefault() { return Properties.Resources.strings_en; -- cgit v1.2.3