diff --git a/src/App/Alert.Designer.cs b/src/App/Alert.Designer.cs new file mode 100644 index 00000000..d7a4276e --- /dev/null +++ b/src/App/Alert.Designer.cs @@ -0,0 +1,72 @@ +namespace App +{ + partial class Alert + { + /// + /// 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.label1 = new System.Windows.Forms.Label(); + this.button1 = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // label1 + // + this.label1.Location = new System.Drawing.Point(12, 20); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(279, 77); + this.label1.TabIndex = 0; + this.label1.Text = "label1"; + this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // button1 + // + this.button1.Location = new System.Drawing.Point(15, 116); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(276, 23); + this.button1.TabIndex = 1; + this.button1.Text = "button1"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // Alert + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(303, 162); + this.Controls.Add(this.button1); + this.Controls.Add(this.label1); + this.Name = "Alert"; + this.Text = "Alert"; + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Button button1; + } +} \ No newline at end of file diff --git a/src/App/Alert.cs b/src/App/Alert.cs new file mode 100644 index 00000000..1afe6c12 --- /dev/null +++ b/src/App/Alert.cs @@ -0,0 +1,33 @@ +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 App +{ + public partial class Alert : Form + { + public bool ButtonClicked { get; set; } + + public Alert(string title, string label, string buttonText = "Ok") + { + InitializeComponent(); + + Text = title; + label1.Text = label; + button1.Text = buttonText; + } + + private void button1_Click(object sender, EventArgs e) + { + ButtonClicked = true; + DialogResult = DialogResult.OK; + Close(); + } + } +} diff --git a/src/App/Alert.resx b/src/App/Alert.resx new file mode 100644 index 00000000..1af7de15 --- /dev/null +++ b/src/App/Alert.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/src/App/App.csproj b/src/App/App.csproj index 04f24522..a1cf17d9 100644 --- a/src/App/App.csproj +++ b/src/App/App.csproj @@ -45,6 +45,12 @@ + + Form + + + Alert.cs + Form @@ -52,7 +58,22 @@ Main.cs + + Form + + + Prompt.cs + + + Alert.cs + + + Main.cs + + + Prompt.cs + ResXFileCodeGenerator Resources.Designer.cs diff --git a/src/App/Main.Designer.cs b/src/App/Main.Designer.cs index bba47f55..628d8151 100644 --- a/src/App/Main.Designer.cs +++ b/src/App/Main.Designer.cs @@ -28,11 +28,395 @@ /// private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); + this.tabControl1 = new System.Windows.Forms.TabControl(); + this.tabPage1 = new System.Windows.Forms.TabPage(); + this.tabPage2 = new System.Windows.Forms.TabPage(); + this.tabPage3 = new System.Windows.Forms.TabPage(); + this.tabPage4 = new System.Windows.Forms.TabPage(); + this.tabPage5 = new System.Windows.Forms.TabPage(); + this.tabPage6 = new System.Windows.Forms.TabPage(); + this.label1 = new System.Windows.Forms.Label(); + this.pictureBox1 = new System.Windows.Forms.PictureBox(); + this.label2 = new System.Windows.Forms.Label(); + this.linkLabel1 = new System.Windows.Forms.LinkLabel(); + this.panel1 = new System.Windows.Forms.Panel(); + this.button2 = new System.Windows.Forms.Button(); + this.button3 = new System.Windows.Forms.Button(); + this.label3 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.label6 = new System.Windows.Forms.Label(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.button4 = new System.Windows.Forms.Button(); + this.radioButton1 = new System.Windows.Forms.RadioButton(); + this.radioButton2 = new System.Windows.Forms.RadioButton(); + this.radioButton3 = new System.Windows.Forms.RadioButton(); + this.loginButton = new System.Windows.Forms.Button(); + this.label7 = new System.Windows.Forms.Label(); + this.usernameTextBox = new System.Windows.Forms.TextBox(); + this.label8 = new System.Windows.Forms.Label(); + this.passwordTextBox = new System.Windows.Forms.MaskedTextBox(); + this.tabControl1.SuspendLayout(); + this.tabPage1.SuspendLayout(); + this.tabPage2.SuspendLayout(); + this.tabPage4.SuspendLayout(); + this.tabPage5.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); + this.panel1.SuspendLayout(); + this.SuspendLayout(); + // + // tabControl1 + // + this.tabControl1.Controls.Add(this.tabPage1); + this.tabControl1.Controls.Add(this.tabPage2); + this.tabControl1.Controls.Add(this.tabPage3); + this.tabControl1.Controls.Add(this.tabPage4); + this.tabControl1.Controls.Add(this.tabPage5); + this.tabControl1.Controls.Add(this.tabPage6); + this.tabControl1.Location = new System.Drawing.Point(12, 132); + this.tabControl1.Multiline = true; + this.tabControl1.Name = "tabControl1"; + this.tabControl1.Padding = new System.Drawing.Point(10, 10); + this.tabControl1.SelectedIndex = 0; + this.tabControl1.Size = new System.Drawing.Size(579, 368); + this.tabControl1.TabIndex = 0; + // + // tabPage1 + // + this.tabPage1.Controls.Add(this.panel1); + this.tabPage1.Location = new System.Drawing.Point(4, 36); + this.tabPage1.Name = "tabPage1"; + this.tabPage1.Padding = new System.Windows.Forms.Padding(3); + this.tabPage1.Size = new System.Drawing.Size(571, 328); + this.tabPage1.TabIndex = 0; + this.tabPage1.Text = "Log In"; + this.tabPage1.UseVisualStyleBackColor = true; + // + // tabPage2 + // + this.tabPage2.Controls.Add(this.radioButton3); + this.tabPage2.Controls.Add(this.radioButton2); + this.tabPage2.Controls.Add(this.radioButton1); + this.tabPage2.Location = new System.Drawing.Point(4, 36); + this.tabPage2.Name = "tabPage2"; + this.tabPage2.Padding = new System.Windows.Forms.Padding(3); + this.tabPage2.Size = new System.Drawing.Size(571, 328); + this.tabPage2.TabIndex = 1; + this.tabPage2.Text = "Directory Settings"; + this.tabPage2.UseVisualStyleBackColor = true; + // + // tabPage3 + // + this.tabPage3.Location = new System.Drawing.Point(4, 36); + this.tabPage3.Name = "tabPage3"; + this.tabPage3.Padding = new System.Windows.Forms.Padding(3); + this.tabPage3.Size = new System.Drawing.Size(571, 328); + this.tabPage3.TabIndex = 2; + this.tabPage3.Text = "Sync Settings"; + this.tabPage3.UseVisualStyleBackColor = true; + // + // tabPage4 + // + this.tabPage4.Controls.Add(this.button4); + this.tabPage4.Controls.Add(this.textBox2); + this.tabPage4.Controls.Add(this.label6); + this.tabPage4.Controls.Add(this.textBox1); + this.tabPage4.Controls.Add(this.label5); + this.tabPage4.Location = new System.Drawing.Point(4, 36); + this.tabPage4.Name = "tabPage4"; + this.tabPage4.Padding = new System.Windows.Forms.Padding(3); + this.tabPage4.Size = new System.Drawing.Size(571, 328); + this.tabPage4.TabIndex = 3; + this.tabPage4.Text = "Environment"; + this.tabPage4.UseVisualStyleBackColor = true; + // + // tabPage5 + // + this.tabPage5.Controls.Add(this.label4); + this.tabPage5.Controls.Add(this.label3); + this.tabPage5.Controls.Add(this.button3); + this.tabPage5.Controls.Add(this.button2); + this.tabPage5.Location = new System.Drawing.Point(4, 36); + this.tabPage5.Name = "tabPage5"; + this.tabPage5.Padding = new System.Windows.Forms.Padding(3); + this.tabPage5.Size = new System.Drawing.Size(571, 328); + this.tabPage5.TabIndex = 4; + this.tabPage5.Text = "Service Worker"; + this.tabPage5.UseVisualStyleBackColor = true; + // + // tabPage6 + // + this.tabPage6.Location = new System.Drawing.Point(4, 36); + this.tabPage6.Name = "tabPage6"; + this.tabPage6.Padding = new System.Windows.Forms.Padding(3); + this.tabPage6.Size = new System.Drawing.Size(571, 328); + this.tabPage6.TabIndex = 5; + this.tabPage6.Text = "Sync"; + this.tabPage6.UseVisualStyleBackColor = true; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label1.Location = new System.Drawing.Point(85, 12); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(274, 25); + this.label1.TabIndex = 1; + this.label1.Text = "bitwarden Directory Connector"; + // + // pictureBox1 + // + this.pictureBox1.Location = new System.Drawing.Point(12, 12); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.Size = new System.Drawing.Size(64, 62); + this.pictureBox1.TabIndex = 2; + this.pictureBox1.TabStop = false; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(87, 41); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(69, 13); + this.label2.TabIndex = 3; + this.label2.Text = "Version 1.0.0"; + // + // linkLabel1 + // + this.linkLabel1.AutoSize = true; + this.linkLabel1.Location = new System.Drawing.Point(87, 59); + this.linkLabel1.Name = "linkLabel1"; + this.linkLabel1.Size = new System.Drawing.Size(112, 13); + this.linkLabel1.TabIndex = 4; + this.linkLabel1.TabStop = true; + this.linkLabel1.Text = "https://bitwarden.com"; + this.linkLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // panel1 + // + this.panel1.Controls.Add(this.passwordTextBox); + this.panel1.Controls.Add(this.loginButton); + this.panel1.Controls.Add(this.label7); + this.panel1.Controls.Add(this.usernameTextBox); + this.panel1.Controls.Add(this.label8); + this.panel1.Location = new System.Drawing.Point(6, 6); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(559, 151); + this.panel1.TabIndex = 0; + // + // button2 + // + this.button2.Location = new System.Drawing.Point(141, 96); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(271, 23); + this.button2.TabIndex = 0; + this.button2.Text = "Start Service"; + this.button2.UseVisualStyleBackColor = true; + // + // button3 + // + this.button3.Location = new System.Drawing.Point(141, 125); + this.button3.Name = "button3"; + this.button3.Size = new System.Drawing.Size(271, 23); + this.button3.TabIndex = 1; + this.button3.Text = "Stop Service"; + this.button3.UseVisualStyleBackColor = true; + // + // label3 + // + this.label3.Location = new System.Drawing.Point(141, 20); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(271, 18); + this.label3.TabIndex = 2; + this.label3.Text = "Current Status"; + this.label3.TextAlign = System.Drawing.ContentAlignment.TopCenter; + // + // label4 + // + this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label4.Location = new System.Drawing.Point(141, 50); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(271, 23); + this.label4.TabIndex = 3; + this.label4.Text = "Running"; + this.label4.TextAlign = System.Drawing.ContentAlignment.TopCenter; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(3, 20); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(94, 13); + this.label5.TabIndex = 0; + this.label5.Text = "API Endpoint URL"; + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(6, 36); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(294, 20); + this.textBox1.TabIndex = 1; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(3, 70); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(111, 13); + this.label6.TabIndex = 2; + this.label6.Text = "Identity Endpoint URL"; + // + // textBox2 + // + this.textBox2.Location = new System.Drawing.Point(6, 86); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(294, 20); + this.textBox2.TabIndex = 3; + // + // button4 + // + this.button4.Location = new System.Drawing.Point(6, 126); + this.button4.Name = "button4"; + this.button4.Size = new System.Drawing.Size(75, 23); + this.button4.TabIndex = 4; + this.button4.Text = "Save"; + this.button4.UseVisualStyleBackColor = true; + // + // radioButton1 + // + this.radioButton1.AutoSize = true; + this.radioButton1.Location = new System.Drawing.Point(6, 49); + this.radioButton1.Name = "radioButton1"; + this.radioButton1.Size = new System.Drawing.Size(100, 17); + this.radioButton1.TabIndex = 0; + this.radioButton1.TabStop = true; + this.radioButton1.Text = "Active Directory"; + this.radioButton1.UseVisualStyleBackColor = true; + // + // radioButton2 + // + this.radioButton2.AutoSize = true; + this.radioButton2.Location = new System.Drawing.Point(6, 72); + this.radioButton2.Name = "radioButton2"; + this.radioButton2.Size = new System.Drawing.Size(130, 17); + this.radioButton2.TabIndex = 1; + this.radioButton2.TabStop = true; + this.radioButton2.Text = "Azure Active Directory"; + this.radioButton2.UseVisualStyleBackColor = true; + // + // radioButton3 + // + this.radioButton3.AutoSize = true; + this.radioButton3.Location = new System.Drawing.Point(6, 95); + this.radioButton3.Name = "radioButton3"; + this.radioButton3.Size = new System.Drawing.Size(82, 17); + this.radioButton3.TabIndex = 2; + this.radioButton3.TabStop = true; + this.radioButton3.Text = "Other LDAP"; + this.radioButton3.UseVisualStyleBackColor = true; + // + // loginButton + // + this.loginButton.Location = new System.Drawing.Point(3, 105); + this.loginButton.Name = "loginButton"; + this.loginButton.Size = new System.Drawing.Size(75, 23); + this.loginButton.TabIndex = 9; + this.loginButton.Text = "Log In"; + this.loginButton.UseVisualStyleBackColor = true; + this.loginButton.Click += new System.EventHandler(this.loginButton_Click); + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Location = new System.Drawing.Point(0, 63); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(53, 13); + this.label7.TabIndex = 7; + this.label7.Text = "Password"; + // + // usernameTextBox + // + this.usernameTextBox.Location = new System.Drawing.Point(3, 39); + this.usernameTextBox.Name = "usernameTextBox"; + this.usernameTextBox.Size = new System.Drawing.Size(294, 20); + this.usernameTextBox.TabIndex = 6; + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Location = new System.Drawing.Point(0, 23); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(55, 13); + this.label8.TabIndex = 5; + this.label8.Text = "Username"; + // + // passwordTextBox + // + this.passwordTextBox.Location = new System.Drawing.Point(3, 79); + this.passwordTextBox.Name = "passwordTextBox"; + this.passwordTextBox.Size = new System.Drawing.Size(294, 20); + this.passwordTextBox.TabIndex = 10; + this.passwordTextBox.UseSystemPasswordChar = true; + // + // Main + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(603, 512); + this.Controls.Add(this.linkLabel1); + this.Controls.Add(this.label2); + this.Controls.Add(this.pictureBox1); + this.Controls.Add(this.label1); + this.Controls.Add(this.tabControl1); + this.Name = "Main"; this.Text = "Main"; + this.Load += new System.EventHandler(this.Main_Load); + this.tabControl1.ResumeLayout(false); + this.tabPage1.ResumeLayout(false); + this.tabPage2.ResumeLayout(false); + this.tabPage2.PerformLayout(); + this.tabPage4.ResumeLayout(false); + this.tabPage4.PerformLayout(); + this.tabPage5.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); + this.panel1.ResumeLayout(false); + this.panel1.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + } #endregion + + private System.Windows.Forms.TabControl tabControl1; + private System.Windows.Forms.TabPage tabPage1; + private System.Windows.Forms.TabPage tabPage2; + private System.Windows.Forms.TabPage tabPage3; + private System.Windows.Forms.TabPage tabPage4; + private System.Windows.Forms.TabPage tabPage5; + private System.Windows.Forms.TabPage tabPage6; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.PictureBox pictureBox1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.LinkLabel linkLabel1; + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Button button3; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.MaskedTextBox passwordTextBox; + private System.Windows.Forms.Button loginButton; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.TextBox usernameTextBox; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.RadioButton radioButton3; + private System.Windows.Forms.RadioButton radioButton2; + private System.Windows.Forms.RadioButton radioButton1; + private System.Windows.Forms.Button button4; + private System.Windows.Forms.TextBox textBox2; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.Label label5; } } \ No newline at end of file diff --git a/src/App/Main.cs b/src/App/Main.cs index 7b77231d..2e4db716 100644 --- a/src/App/Main.cs +++ b/src/App/Main.cs @@ -1,4 +1,6 @@ -using System; +using Bit.Core.Models; +using Bit.Core.Services; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; @@ -16,5 +18,69 @@ namespace App { InitializeComponent(); } + + private void Main_Load(object sender, EventArgs e) + { + + } + + private async void loginButton_Click(object sender, EventArgs e) + { + var result = await AuthService.Instance.LogInAsync(usernameTextBox.Text, passwordTextBox.Text); + + if(result.TwoFactorRequired) + { + string token = null; + using(var prompt = new Prompt("Verification Code", "Enter your two-step verification code", "Submit")) + { + var promptResult = prompt.ShowDialog(); + if(promptResult == DialogResult.OK) + { + token = prompt.ReturnValue; + } + } + + result = await AuthService.Instance.LogInTwoFactorWithHashAsync(token, usernameTextBox.Text, + result.MasterPasswordHash); + } + + if(result.Success && result.Organizations.Count > 1) + { + Organization org = null; + + var orgs = new Dictionary(); + for(int i = 0; i < result.Organizations.Count; i++) + { + orgs.Add(result.Organizations[i].Id, result.Organizations[i].Name); + } + + // TODO: alert about org + + if(org == null) + { + result.Success = false; + result.ErrorMessage = "Organization not found."; + AuthService.Instance.LogOut(); + } + else + { + SettingsService.Instance.Organization = org; + } + } + + if(result.Success) + { + + } + else + { + using(var prompt = new Alert("Error", result.ErrorMessage)) + { + var promptResult = prompt.ShowDialog(); + } + } + + passwordTextBox.Text = null; + } } } diff --git a/src/App/Main.resx b/src/App/Main.resx new file mode 100644 index 00000000..1af7de15 --- /dev/null +++ b/src/App/Main.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/src/App/Prompt.Designer.cs b/src/App/Prompt.Designer.cs new file mode 100644 index 00000000..da52e993 --- /dev/null +++ b/src/App/Prompt.Designer.cs @@ -0,0 +1,83 @@ +namespace App +{ + partial class Prompt + { + /// + /// 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.label1 = new System.Windows.Forms.Label(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.button1 = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // label1 + // + this.label1.Location = new System.Drawing.Point(12, 9); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(224, 41); + this.label1.TabIndex = 0; + this.label1.Text = "label1"; + this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(12, 63); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(224, 20); + this.textBox1.TabIndex = 1; + // + // button1 + // + this.button1.Location = new System.Drawing.Point(12, 89); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(224, 23); + this.button1.TabIndex = 2; + this.button1.Text = "Ok"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // Prompt + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(248, 135); + this.Controls.Add(this.button1); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.label1); + this.Name = "Prompt"; + this.Text = "Prompt"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.Button button1; + } +} \ No newline at end of file diff --git a/src/App/Prompt.cs b/src/App/Prompt.cs new file mode 100644 index 00000000..f5573128 --- /dev/null +++ b/src/App/Prompt.cs @@ -0,0 +1,32 @@ +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 App +{ + public partial class Prompt : Form + { + public string ReturnValue { get; set; } + + public Prompt(string title, string label, string buttonText) + { + InitializeComponent(); + Text = title; + label1.Text = label; + button1.Text = buttonText; + } + + private void button1_Click(object sender, EventArgs e) + { + ReturnValue = textBox1.Text; + DialogResult = DialogResult.OK; + Close(); + } + } +} diff --git a/src/App/Prompt.resx b/src/App/Prompt.resx new file mode 100644 index 00000000..1af7de15 --- /dev/null +++ b/src/App/Prompt.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