mirror of
https://github.com/mashed-potatoes/PotatoNV.git
synced 2024-09-20 04:54:00 +02:00
Disable bootloader ComboBox if selected device in fastboot mode
This commit is contained in:
parent
dccfa80598
commit
54df618fd0
2 changed files with 19 additions and 4 deletions
|
@ -9,7 +9,7 @@
|
|||
<StackPanel Style="{x:Null}">
|
||||
<StackPanel>
|
||||
<Label Content="Target device" />
|
||||
<ComboBox Name="deviceList" />
|
||||
<ComboBox Name="deviceList" SelectionChanged="DeviceList_SelectionChanged" />
|
||||
</StackPanel>
|
||||
<StackPanel>
|
||||
<Label Content="Bootloader" />
|
||||
|
|
|
@ -26,6 +26,8 @@ namespace PotatoNV_next.Controls
|
|||
public delegate void FormHandler(FormEventArgs formEventArgs);
|
||||
public static event FormHandler OnFormSubmit;
|
||||
|
||||
private bool IsSelectedDeviceInFastbootMode;
|
||||
|
||||
public NVForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
@ -42,7 +44,7 @@ namespace PotatoNV_next.Controls
|
|||
public string UnlockCode { get; set; }
|
||||
public string SerialNumber { get; set; }
|
||||
public bool FBLOCK { get; set; }
|
||||
public Bootloader bootloader { get; set; } = null;
|
||||
public Bootloader Bootloader { get; set; } = null;
|
||||
}
|
||||
|
||||
private void Assert(bool result, string message)
|
||||
|
@ -115,9 +117,8 @@ namespace PotatoNV_next.Controls
|
|||
}
|
||||
|
||||
Log.Success("Form is valid, starting");
|
||||
IsEnabled = false;
|
||||
|
||||
//OnFormSubmit();
|
||||
IsEnabled = false;
|
||||
}
|
||||
|
||||
private void NVForm_IsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e)
|
||||
|
@ -130,5 +131,19 @@ namespace PotatoNV_next.Controls
|
|||
disableFBLOCK.IsEnabled = IsEnabled;
|
||||
startButton.IsEnabled = IsEnabled;
|
||||
}
|
||||
|
||||
private void DeviceList_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (deviceList.SelectedIndex == -1)
|
||||
{
|
||||
IsSelectedDeviceInFastbootMode = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
IsSelectedDeviceInFastbootMode = deviceList.SelectedItem.ToString().StartsWith("Fastboot");
|
||||
}
|
||||
|
||||
deviceBootloader.IsEnabled = !IsSelectedDeviceInFastbootMode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue