Finish NVForm class

This commit is contained in:
mashed-potatoes 2020-06-28 21:39:49 +05:00
parent 1c20528fe3
commit cb6292a977

View file

@ -48,6 +48,11 @@ namespace PotatoNV_next.Controls
{ {
deviceBootloader.SelectedIndex = 0; deviceBootloader.SelectedIndex = 0;
} }
var random = new Random(Guid.NewGuid().GetHashCode());
nvUnlockCode.Text = new string(Enumerable.Repeat("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", 16)
.Select(s => s[random.Next(s.Length)]).ToArray());
} }
public class FormEventArgs : EventArgs public class FormEventArgs : EventArgs
@ -134,19 +139,24 @@ namespace PotatoNV_next.Controls
IsEnabled = false; IsEnabled = false;
if (IsSelectedDeviceInFastbootMode) var eventArgs = new FormEventArgs
{ {
OnFormSubmit?.Invoke(new FormEventArgs { TargetMode = IsSelectedDeviceInFastbootMode
TargetMode = UsbController.Device.DMode.Fastboot, ? UsbController.Device.DMode.Fastboot
Target = deviceList.SelectedItem.ToString(), : UsbController.Device.DMode.DownloadVCOM,
BoardID = nvBidNumber.Text, Target = deviceList.SelectedItem.ToString(),
UnlockCode = nvUnlockCode.Text, BoardID = nvBidNumber.Text,
SerialNumber = nvSerialNumber.Text, UnlockCode = nvUnlockCode.Text,
DisableFBLOCK = disableFBLOCK.IsChecked.Value SerialNumber = nvSerialNumber.Text,
}); DisableFBLOCK = disableFBLOCK.IsChecked.Value
};
return; if (!IsSelectedDeviceInFastbootMode)
{
eventArgs.Bootloader = bootloaders.First(x => x.Title == deviceBootloader.SelectedItem.ToString());
} }
OnFormSubmit?.Invoke(eventArgs);
} }
private void NVForm_IsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e) private void NVForm_IsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e)