You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.6 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using System.Windows.Forms;
using BirdyFlash.Lib;
using MaterialSkin;
using MaterialSkin.Controls;
namespace BirdyFlash {
partial class ChangeSerialDialog : MaterialForm {
public string oldSN;
public string newSN;
public ChangeSerialDialog() {
InitializeComponent();
}
private void ChangeSerialDialog_Load(object sender, EventArgs e) {
MaterialSkinManager.Instance.AddFormToManage(this);
}
private void materialTextBox1_TextChanged(object sender, EventArgs e) {
}
internal void Setup(DeviceInfo deviceInfo) {
string oldSerial = deviceInfo.deviceSerial;
this.oldSN = oldSerial;
switch(deviceInfo.model) {
case "BirdyIOT":
oldSerial = deviceInfo.deviceSerial[0] + deviceInfo.deviceSerial.Substring(2);
break;
}
this.newSN = "";
this.txtCurrentSN.Text = oldSerial;
this.txtNewSN.MaxLength = oldSerial.Length;
}
private void materialButton1_Click(object sender, EventArgs e) {
this.DialogResult = DialogResult.Cancel;
this.Close();
}
private void materialButton2_Click(object sender, EventArgs e) {
this.newSN = this.txtNewSN.Text;
this.DialogResult = DialogResult.Yes;
this.Close();
}
}
}