internal async void DoUnlockPhone() { try { IsSwitchingInterface = true; await SwitchModeViewModel.SwitchToWithProgress(PhoneNotifier, PhoneInterfaces.Lumia_MassStorage, (msg, sub) => ActivateSubContext(new BusyViewModel(msg, sub))); bool HasNewBootloader = HasNewBootloaderFromMassStorage(); string EFIESPPath = HasNewBootloader ? null : ((MassStorage)PhoneNotifier.CurrentModel).Drive + @"\EFIESP\"; string MainOSPath = ((MassStorage)PhoneNotifier.CurrentModel).Drive + @"\"; bool HasV11Patches = HasV11PatchesFromMassStorage(); StartPatch(EFIESPPath, MainOSPath, HasNewBootloader, HasV11Patches); } catch (Exception Ex) { ActivateSubContext(new MessageViewModel(Ex.Message, () => { Callback(); ActivateSubContext(null); })); } }
internal async void DoRestore(string EFIESPPath, string MainOSPath, string DataPath) { try { await SwitchModeViewModel.SwitchToWithProgress(PhoneNotifier, PhoneInterfaces.Lumia_Flash, (msg, sub) => ActivateSubContext(new BusyViewModel(msg, sub))); RestoreTask(EFIESPPath, MainOSPath, DataPath); } catch (Exception Ex) { ActivateSubContext(new MessageViewModel(Ex.Message, Callback)); } }
internal async void DoBackupArchiveProvisioning(string ArchiveProvisioningPath) { try { IsSwitchingInterface = true; await SwitchModeViewModel.SwitchToWithProgress(PhoneNotifier, PhoneInterfaces.Lumia_MassStorage, (msg, sub) => ActivateSubContext(new BusyViewModel(msg, sub))); BackupArchiveProvisioningTask(ArchiveProvisioningPath); } catch (Exception Ex) { ActivateSubContext(new MessageViewModel(Ex.Message, Callback)); } }
internal async void DoBackup(string EFIESPPath, string MainOSPath, string DataPath) { try { IsSwitchingInterface = true; await SwitchModeViewModel.SwitchToWithProgress(PhoneNotifier, PhoneInterfaces.Lumia_MassStorage, (msg, sub) => ActivateSubContext(new BusyViewModel(msg, sub))); BackupTask(EFIESPPath, MainOSPath, DataPath); } catch (Exception Ex) { ActivateSubContext(new MessageViewModel(Ex.Message, Callback)); } }
// Called from an event-handler. So, "async void" is valid here. internal async void FlashMMOS(string MMOSPath) { IsSwitchingInterface = true; // Prevents that a device is forced to Flash mode on this screen which is meant for flashing try { await SwitchModeViewModel.SwitchToWithProgress(PhoneNotifier, PhoneInterfaces.Lumia_Flash, (msg, sub) => ActivateSubContext(new BusyViewModel(msg, sub))); FlashMMOSTask(MMOSPath); } catch (Exception Ex) { ActivateSubContext(new MessageViewModel(Ex.Message, Callback)); } }
internal async void Exit() { IsSwitchingInterface = false; try { await SwitchModeViewModel.SwitchToWithProgress(PhoneNotifier, PhoneInterfaces.Lumia_Normal, (msg, sub) => ActivateSubContext(new BusyViewModel(msg, sub))); Callback(); ActivateSubContext(null); } catch (Exception Ex) { ActivateSubContext(new MessageViewModel(Ex.Message, Callback)); } }
private void SwitchToFlashMode() { // SwitchModeViewModel must be created on the UI thread IsSwitchingInterface = true; UIContext.Post(async(t) => { LogFile.Log("Switching to Flash-mode"); try { await SwitchModeViewModel.SwitchToWithProgress(PhoneNotifier, PhoneInterfaces.Lumia_Flash, (msg, sub) => ActivateSubContext(new BusyViewModel(msg, sub))); } catch (Exception Ex) { ActivateSubContext(new MessageViewModel(Ex.Message, Callback)); } }, null); }
// Called from an event-handler. So, "async void" is valid here. internal async void FlashPartitions(string EFIESPPath, string MainOSPath, string DataPath) { IsSwitchingInterface = true; // Prevents that a device is forced to Flash mode on this screen which is meant for flashing try { await SwitchModeViewModel.SwitchToWithProgress(PhoneNotifier, PhoneInterfaces.Lumia_Flash, (msg, sub) => ActivateSubContext(new BusyViewModel(msg, sub))); if (((NokiaFlashModel)PhoneNotifier.CurrentModel).ReadPhoneInfo(ExtendedInfo: false).FlashAppProtocolVersionMajor < 2) { FlashPartitionsTask(EFIESPPath, MainOSPath, DataPath); } else { await Task.Run(async() => await LumiaV2UnlockBootViewModel.LumiaV2FlashPartitions(PhoneNotifier, EFIESPPath, MainOSPath, DataPath, SetWorkingStatus, UpdateWorkingStatus, ExitSuccess, ExitFailure)); } } catch (Exception Ex) { ActivateSubContext(new MessageViewModel(Ex.Message, Callback)); } }