⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmeditprofile.cs

📁 通过手机蓝牙控制个人电脑上的幻灯片的播放
💻 CS
📖 第 1 页 / 共 2 页
字号:
            // 
            // txtAddr3
            // 
            this.txtAddr3.Font = new System.Drawing.Font("Nina", 9F, System.Drawing.FontStyle.Regular);
            this.txtAddr3.Location = new System.Drawing.Point(83, 228);
            this.txtAddr3.MaxLength = 2;
            this.txtAddr3.Size = new System.Drawing.Size(21, 28);
            this.txtAddr3.Text = "00";
            // 
            // label8
            // 
            this.label8.Location = new System.Drawing.Point(146, 228);
            this.label8.Size = new System.Drawing.Size(3, 30);
            this.label8.Text = ":";
            this.label8.TextAlign = System.Drawing.ContentAlignment.TopCenter;
            // 
            // txtAddr4
            // 
            this.txtAddr4.Font = new System.Drawing.Font("Nina", 9F, System.Drawing.FontStyle.Regular);
            this.txtAddr4.Location = new System.Drawing.Point(119, 228);
            this.txtAddr4.MaxLength = 2;
            this.txtAddr4.Size = new System.Drawing.Size(21, 28);
            this.txtAddr4.Text = "00";
            // 
            // label9
            // 
            this.label9.Location = new System.Drawing.Point(182, 228);
            this.label9.Size = new System.Drawing.Size(3, 30);
            this.label9.Text = ":";
            this.label9.TextAlign = System.Drawing.ContentAlignment.TopCenter;
            // 
            // txtAddr5
            // 
            this.txtAddr5.Font = new System.Drawing.Font("Nina", 9F, System.Drawing.FontStyle.Regular);
            this.txtAddr5.Location = new System.Drawing.Point(155, 228);
            this.txtAddr5.MaxLength = 2;
            this.txtAddr5.Size = new System.Drawing.Size(21, 28);
            this.txtAddr5.Text = "00";
            // 
            // txtAddr6
            // 
            this.txtAddr6.Font = new System.Drawing.Font("Nina", 9F, System.Drawing.FontStyle.Regular);
            this.txtAddr6.Location = new System.Drawing.Point(191, 228);
            this.txtAddr6.MaxLength = 2;
            this.txtAddr6.Size = new System.Drawing.Size(21, 28);
            this.txtAddr6.Text = "00";
            // 
            // mainMenuEdit
            // 
            this.mainMenuEdit.MenuItems.Add(this.miEditSave);
            this.mainMenuEdit.MenuItems.Add(this.miEditCancel);
            // 
            // miEditSave
            // 
            this.miEditSave.Text = "Save";
            this.miEditSave.Click += new System.EventHandler(this.miEditSave_Click);
            // 
            // miEditCancel
            // 
            this.miEditCancel.Text = "Cancel";
            this.miEditCancel.Click += new System.EventHandler(this.miEditCancel_Click);
            // 
            // frmEditProfile
            // 
            this.ClientSize = new System.Drawing.Size(240, 266);
            this.Controls.Add(this.comboBoxProfile);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.txtLogin);
            this.Controls.Add(this.txtPassword);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.label3);
            this.Controls.Add(this.label4);
            this.Controls.Add(this.txtAddr1);
            this.Controls.Add(this.label5);
            this.Controls.Add(this.txtAddr2);
            this.Controls.Add(this.label6);
            this.Controls.Add(this.txtAddr3);
            this.Controls.Add(this.label7);
            this.Controls.Add(this.txtAddr4);
            this.Controls.Add(this.label8);
            this.Controls.Add(this.txtAddr5);
            this.Controls.Add(this.label9);
            this.Controls.Add(this.txtAddr6);
            this.Menu = this.mainMenu;
            this.Text = "Edit Profile";
            this.Load += new System.EventHandler(this.frmEditProfile_Load);

        }

        #endregion

        private void frmEditProfile_Load(object sender, EventArgs e)
        {   
            EnableControl(false);
            BindCBData();
        }

        private void EnableControl(bool IsEnable)
        {
            txtLogin.Enabled = IsEnable;
            txtPassword.Enabled = IsEnable;
            txtAddr1.Enabled = IsEnable;
            txtAddr2.Enabled = IsEnable;
            txtAddr3.Enabled = IsEnable;
            txtAddr4.Enabled = IsEnable;
            txtAddr5.Enabled = IsEnable;
            txtAddr6.Enabled = IsEnable;
        }

        private void comboBoxProfile_SelectedIndexChanged(object sender, EventArgs e)
        {
            Profile.Profile p;
            p = (Profile.Profile)comboBoxProfile.SelectedItem;
            txtLogin.Text = p.Login;
            txtPassword.Text = p.Password;
            char[] sperator = new char[1];
            sperator[0] = ':';
            string[] strAddr;
            strAddr = p.Address.Split(sperator);

            txtAddr1.Text = strAddr[0];
            txtAddr2.Text = strAddr[1];
            txtAddr3.Text = strAddr[2];
            txtAddr4.Text = strAddr[3];
            txtAddr5.Text = strAddr[4];
            txtAddr6.Text = strAddr[5];
        }

        private void BindCBData()
        {
            _profileList.LoadFile(Global.PROFILE_PATH);
            if (_profileList.List.Count > 0)
            {
                comboBoxProfile.DataSource = _profileList.List;
                comboBoxProfile.DisplayMember = "ProfileName";
            }
            else
            {
                Global.ShowCaution("No profile found \nClick OK to back to main menu", "No Profile found");
                this.Dispose();
            }
        }

        private void miEdit_Click(object sender, EventArgs e)
        {
            EnableControl(true);
            comboBoxProfile.Enabled = false;
            this.Menu = mainMenuEdit;
            //BindCBData();
        }

        private void miConfirm_Click(object sender, EventArgs e)
        {
            this.Dispose();
        }

        private void miEditSave_Click(object sender, EventArgs e)
        {
            Profile.Profile p = new Profile.Profile();
            p = (Profile.Profile)comboBoxProfile.SelectedItem;
            string strAddr = "";
            strAddr = txtAddr1.Text + ":" + txtAddr2.Text + ":" + txtAddr3.Text + ":" + txtAddr4.Text + ":" + txtAddr5.Text + ":" + txtAddr6.Text;
            if (!BTHWrapper.BTHUtil.IsAddressVaild(strAddr))
            {
                Global.ShowCaution("Invaild Address", "Invaild Address");
            }
            else
            {
                _profileList.Modify(p.ProfileName, strAddr, p.DeviceName, txtLogin.Text, txtPassword.Text);
                _profileList.SaveFile(Global.PROFILE_PATH);
                this.Menu = this.mainMenu;

                comboBoxProfile.Enabled = true;
                EnableControl(false);
                BindCBData();
            }
        }

        private void miEditCancel_Click(object sender, EventArgs e)
        {
            EnableControl(false);
            this.Menu = this.mainMenu;
        }

        private void miDelete_Click(object sender, EventArgs e)
        {
            bool IsOK = Global.ShowOCChoice("Click OK to delete this profile " + comboBoxProfile.SelectedItem.ToString(), "Confirm delete");
            if (IsOK)
            {
                Profile.Profile p = new Profile.Profile();
                p = (Profile.Profile)comboBoxProfile.SelectedItem;
                _profileList.Remove(p.ProfileName);
                _profileList.SaveFile(Global.PROFILE_PATH);
                BindCBData();
            }
            else
            {

            }

        }

    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -