private async void CopyKey() { var data = new DataPackage(); data.SetText(this.Value); try { Clipboard.SetContent(data); SdkService.MegaSdk.masterKeyExported(); ToastService.ShowTextNotification( ResourceService.AppMessages.GetString("AM_RecoveryKeyCopied_Title"), ResourceService.AppMessages.GetString("AM_RecoveryKeyCopied")); } catch (Exception e) { LogService.Log(MLogLevel.LOG_LEVEL_ERROR, e.Message, e); if (DialogService.IsAnyDialogVisible()) { ToastService.ShowAlertNotification( ResourceService.AppMessages.GetString("AM_RecoveryKeyCopiedFailed_Title"), ResourceService.AppMessages.GetString("AM_RecoveryKeyCopiedFailed")); return; } await DialogService.ShowAlertAsync( ResourceService.AppMessages.GetString("AM_RecoveryKeyCopiedFailed_Title"), ResourceService.AppMessages.GetString("AM_RecoveryKeyCopiedFailed")); } }
private async Task <bool> SaveKey() { var file = await FileService.SaveFile(new KeyValuePair <string, IList <string> >( ResourceService.UiResources.GetString("UI_PlainText"), new List <string>() { ".txt" }), ResourceService.AppResources.GetString("AR_RecoveryKeyFileName")); if (file == null) { return(false); } try { await FileIO.WriteTextAsync(file, this.Value); SdkService.MegaSdk.masterKeyExported(); ToastService.ShowTextNotification( ResourceService.AppMessages.GetString("AM_RecoveryKeyExported_Title"), ResourceService.AppMessages.GetString("AM_RecoveryKeyExported")); return(true); } catch (Exception e) { LogService.Log(MLogLevel.LOG_LEVEL_ERROR, e.Message, e); if (DialogService.IsAnyDialogVisible()) { ToastService.ShowAlertNotification( ResourceService.AppMessages.GetString("AM_RecoveryKeyExportFailed_Title"), ResourceService.AppMessages.GetString("AM_RecoveryKeyExportFailed")); return(false); } await DialogService.ShowAlertAsync( ResourceService.AppMessages.GetString("AM_RecoveryKeyExportFailed_Title"), ResourceService.AppMessages.GetString("AM_RecoveryKeyExportFailed")); return(false); } }