📄 frmcreateprofile2.cs
字号:
#region Using directives
using System;
using System.Drawing;
using System.Collections;
using System.Windows.Forms;
using System.Data;
#endregion
namespace UI
{
/// <summary>
/// Summary description for frmLogin.
/// </summary>
public class frmCreateProfile2 : System.Windows.Forms.Form
{
private TextBox txtPW;
private TextBox txtID;
private Label label1;
private Label label2;
private MenuItem menuItemLogin;
private MenuItem menuItemReset;
/// <summary>
/// Main menu for the form.
/// </summary>
private System.Windows.Forms.MainMenu mainMenu1;
BTHWrapper.BTHConnector _connector;
Profile.ProfileList _profileList;
Profile.Profile _profile;
public frmCreateProfile2(BTHWrapper.BTHConnector inConn, Profile.ProfileList lstProfile,Profile.Profile objProfile)
{
_profile = objProfile;
_connector = inConn;
_profileList = lstProfile;
InitializeComponent();
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
}
#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.mainMenu1 = new System.Windows.Forms.MainMenu();
this.menuItemLogin = new System.Windows.Forms.MenuItem();
this.menuItemReset = new System.Windows.Forms.MenuItem();
this.txtPW = new System.Windows.Forms.TextBox();
this.txtID = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
//
// mainMenu1
//
this.mainMenu1.MenuItems.Add(this.menuItemLogin);
this.mainMenu1.MenuItems.Add(this.menuItemReset);
//
// menuItemLogin
//
this.menuItemLogin.Text = "Save";
this.menuItemLogin.Click += new System.EventHandler(this.menuItemLogin_Click);
//
// menuItemReset
//
this.menuItemReset.Text = "Reset";
this.menuItemReset.Click += new System.EventHandler(this.menuItemReset_Click);
//
// txtPW
//
this.txtPW.Location = new System.Drawing.Point(124, 133);
this.txtPW.PasswordChar = '*';
this.txtPW.Size = new System.Drawing.Size(109, 33);
//
// txtID
//
this.txtID.Location = new System.Drawing.Point(125, 87);
this.txtID.Size = new System.Drawing.Size(109, 33);
//
// label1
//
this.label1.Location = new System.Drawing.Point(3, 87);
this.label1.Size = new System.Drawing.Size(116, 30);
this.label1.Text = "User Name:";
//
// label2
//
this.label2.Location = new System.Drawing.Point(3, 136);
this.label2.Size = new System.Drawing.Size(109, 30);
this.label2.Text = "Password:";
//
// frmLogin
//
this.ClientSize = new System.Drawing.Size(240, 266);
this.Controls.Add(this.txtID);
this.Controls.Add(this.txtPW);
this.Controls.Add(this.label1);
this.Controls.Add(this.label2);
this.Menu = this.mainMenu1;
this.Text = "Login";
}
#endregion
private void menuItemReset_Click(object sender, EventArgs e)
{
txtID.Text = "";
txtPW.Text = "";
}
private void menuItemLogin_Click(object sender, EventArgs e)
{
///
/// TODO: Add Login Method here
/// if login failure display main menu or repeat input?
/// No cancel and quit for this form....just like the real login in window
///
/*
Profile.Profile p = new Profile.Profile();
p= _profileList.GetProfile(_profileName);
_connector.Connect(p.Address);
frmRemoteControl frmRC = new frmRemoteControl(_connector);
frmRC.Show();
this.Dispose();*/
//Profile.Profile newProfile = new Profile.Profile(textBox1.Text, strAddr, p.DeviceName, "", "");
//_profileList.AddProfile(textBox1.Text, strAddr, p.DeviceName, "", "");
_profile.Login = txtID.Text;
_profile.Password = txtPW.Text;
_profileList.AddProfile(_profile);
_profileList.SaveFile(Global.PROFILE_PATH);
frmConnectProfile frmCP = new frmConnectProfile(_connector,_profileList);
frmCP.Show();
this.Dispose();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -