mirror of
https://github.com/mashed-potatoes/PotatoNV.git
synced 2024-11-10 01:02:20 +01:00
Finish NVForm class
This commit is contained in:
parent
1c20528fe3
commit
cb6292a977
1 changed files with 20 additions and 10 deletions
|
@ -48,6 +48,11 @@ namespace PotatoNV_next.Controls
|
|||
{
|
||||
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
|
||||
|
@ -134,19 +139,24 @@ namespace PotatoNV_next.Controls
|
|||
|
||||
IsEnabled = false;
|
||||
|
||||
if (IsSelectedDeviceInFastbootMode)
|
||||
var eventArgs = new FormEventArgs
|
||||
{
|
||||
OnFormSubmit?.Invoke(new FormEventArgs {
|
||||
TargetMode = UsbController.Device.DMode.Fastboot,
|
||||
Target = deviceList.SelectedItem.ToString(),
|
||||
BoardID = nvBidNumber.Text,
|
||||
UnlockCode = nvUnlockCode.Text,
|
||||
SerialNumber = nvSerialNumber.Text,
|
||||
DisableFBLOCK = disableFBLOCK.IsChecked.Value
|
||||
});
|
||||
TargetMode = IsSelectedDeviceInFastbootMode
|
||||
? UsbController.Device.DMode.Fastboot
|
||||
: UsbController.Device.DMode.DownloadVCOM,
|
||||
Target = deviceList.SelectedItem.ToString(),
|
||||
BoardID = nvBidNumber.Text,
|
||||
UnlockCode = nvUnlockCode.Text,
|
||||
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)
|
||||
|
|
Loading…
Reference in a new issue