public CreateAccountViewModel(MegaSDK megaSdk) { this._megaSdk = megaSdk; this.ControlState = true; this.CreateAccountCommand = new DelegateCommand(this.CreateAccount); this.NavigateTermsOfUseCommand = new DelegateCommand(NavigateTermsOfUse); }
public void onRequestStart(MegaSDK api, MRequest request) { Deployment.Current.Dispatcher.BeginInvoke(() => ProgessService.SetProgressIndicator(true, String.Format("Fetching files & folders...[{0}/{1}]", request.getTransferredBytes().ToStringAndSuffix(), request.getTotalBytes().ToStringAndSuffix()))); }
public LoginViewModel(MegaSDK megaSdk) { this._megaSdk = megaSdk; this.ControlState = true; this.LoginCommand = new DelegateCommand(this.DoLogin); this.NavigateCreateAccountCommand = new DelegateCommand(NavigateCreateAccount); }
public virtual void onRequestStart(MegaSDK api, MRequest request) { Deployment.Current.Dispatcher.BeginInvoke(() => { this.ControlState = false; ProgessService.SetProgressIndicator(true, ProgressMessage); }); }
protected override void OnSuccesAction(MegaSDK api, MRequest request) { // ALREADY MOVED ON THE GlobalDriveListener /*Deployment.Current.Dispatcher.BeginInvoke(() => * { * try { ((ObservableCollection<NodeViewModel>)_rootNode.ChildCollection).Add(_nodeToMove); } * catch (Exception) { } * }); */ }
public PaymentViewModel(MegaSDK megaSdk) { this.ControlState = true; this._megaSdk = megaSdk; this.ProductSelectionIsEnabled = true; this.CreditCardPaymentIsEnabled = false; this.BillingDetails = new BillingDetails(); this.CreditCard = new CreditCard(); }
protected override void OnSuccesAction(MegaSDK api, MRequest request) { Deployment.Current.Dispatcher.BeginInvoke(() => { _mainPageViewModel.FetchNodes(); // Validate product subscription license on background thread Task.Run(() => LicenseService.ValidateLicenses()); }); }
public virtual void onRequestTemporaryError(MegaSDK api, MRequest request, MError e) { this.api = api; if(DebugService.DebugSettings.IsDebugMode || Debugger.IsAttached) { Deployment.Current.Dispatcher.BeginInvoke(() => ProgressService.ChangeProgressBarBackgroundColor((Color)Application.Current.Resources["MegaRedColor"])); } }
protected NodeViewModel(MegaSDK megaSdk, AppInformation appInformation, MNode megaNode, ContainerType parentContainerType, ObservableCollection <IMegaNode> parentCollection = null, ObservableCollection <IMegaNode> childCollection = null) : base(megaSdk, appInformation) { Update(megaNode, parentContainerType); SetDefaultValues(); this.ParentCollection = parentCollection; this.ChildCollection = childCollection; }
public void onTransferTemporaryError(MegaSDK api, MTransfer transfer, MError e) { // Transfer overquota error if (e.getErrorCode() == MErrorType.API_EOVERQUOTA) { LogService.Log(MLogLevel.LOG_LEVEL_INFO, "Transfer quota exceeded (API_EOVERQUOTA)"); OnTransferQuotaExceeded(EventArgs.Empty); _tcs.TrySetResult(e.getErrorString()); } }
public override void onRequestStart(MegaSDK api, MRequest request) { Deployment.Current.Dispatcher.BeginInvoke(() => this._confirmAccountViewModel.ControlState = false); if (request.getType() == MRequestType.TYPE_CONFIRM_ACCOUNT) { base.onRequestStart(api, request); } }
public void onRequestFinish(MegaSDK api, MRequest request, MError e) { if (e.getErrorCode() == MErrorType.API_OK) { switch (request.getType()) { case MRequestType.TYPE_ACCOUNT_DETAILS: ulong TotalSpace = request.getMAccountDetails().getStorageMax(); ulong UsedSpace = request.getMAccountDetails().getStorageUsed(); int usedSpacePercent; if ((TotalSpace > 0) && (UsedSpace > 0)) { usedSpacePercent = (int)(UsedSpace * 100 / TotalSpace); } else { usedSpacePercent = 0; } // If used space is less than 95% and is a free account, the 5% of the times show a message to upgrade the account if (usedSpacePercent <= 95) { if (request.getMAccountDetails().getProLevel() == MAccountType.ACCOUNT_TYPE_FREE) { Task.Run(() => { Visibility visibility = GetRandomVisibility(5); Deployment.Current.Dispatcher.BeginInvoke(() => _mainPage.ChangeGetProAccountBorderVisibility(visibility)); if (visibility == Visibility.Visible) { this.TimerGetProAccountVisibility(30000); } }); } } // Else show a warning message indicating the user is running out of space else { Task.Run(() => { Deployment.Current.Dispatcher.BeginInvoke(() => _mainPage.ChangeWarningOutOfSpaceBorderVisibility(Visibility.Visible)); this.TimerWarningOutOfSpaceVisibility(15000); }); } break; default: break; } } }
public void onTransferTemporaryError(MegaSDK api, MTransfer transfer, MError e) { // Extra checking to avoid NullReferenceException if (transfer == null) { return; } // Search the corresponding transfer in the transfers list var megaTransfer = TransfersService.SearchTransfer(TransfersService.MegaTransfers.SelectAll(), transfer); if (megaTransfer == null) { return; } var isBusy = api.areTransfersPaused((int)transfer.getType()) ? false : true; var transferState = api.areTransfersPaused((int)transfer.getType()) ? MTransferState.STATE_QUEUED : transfer.getState(); var transferPriority = transfer.getPriority(); Deployment.Current.Dispatcher.BeginInvoke(() => { if (DebugService.DebugSettings.IsDebugMode || Debugger.IsAttached) { if (ProgressService.GetProgressBarBackgroundColor() != (Color)Application.Current.Resources["MegaRedColor"]) { ProgressService.ChangeProgressBarBackgroundColor((Color)Application.Current.Resources["MegaRedColor"]); } } // Only update the values if they have changed to improve the UI performance if (megaTransfer.Transfer != transfer) { megaTransfer.Transfer = transfer; } if (megaTransfer.IsBusy != isBusy) { megaTransfer.IsBusy = isBusy; } if (megaTransfer.TransferState != transferState) { megaTransfer.TransferState = transferState; } if (megaTransfer.TransferPriority != transferPriority) { megaTransfer.TransferPriority = transferPriority; } // Transfer overquota error if (e.getErrorCode() == MErrorType.API_EOVERQUOTA) { DialogService.ShowTransferOverquotaWarning(); } }); }
public void onTransferFinish(MegaSDK api, MTransfer transfer, MError e) { if (_timer != null) { _timer.Dispose(); } if (e.getErrorCode() == MErrorType.API_EGOINGOVERQUOTA || e.getErrorCode() == MErrorType.API_EOVERQUOTA) { //Stop the Camera Upload Service LogService.Log(MLogLevel.LOG_LEVEL_INFO, "Storage quota exceeded ({0}) - Disabling CAMERA UPLOADS service", e.getErrorCode().ToString()); OnStorageQuotaExceeded(EventArgs.Empty); return; } try { if (e.getErrorCode() == MErrorType.API_OK) { ulong mtime = api.getNodeByHandle(transfer.getNodeHandle()).getModificationTime(); DateTime pictureDate = new DateTime(1970, 1, 1, 0, 0, 0, 0).AddSeconds(Convert.ToDouble(mtime)); SettingsService.SaveSettingToFile <DateTime>("LastUploadDate", pictureDate); // If file upload succeeded. Clear the error information for a clean sheet. ErrorProcessingService.Clear(); } else { // An error occured. Log and process it. switch (e.getErrorCode()) { case MErrorType.API_EFAILED: case MErrorType.API_EEXIST: case MErrorType.API_EARGS: case MErrorType.API_EREAD: case MErrorType.API_EWRITE: { LogService.Log(MLogLevel.LOG_LEVEL_ERROR, e.getErrorString()); ErrorProcessingService.ProcessFileError(transfer.getFileName()); break; } } } } catch (Exception) { // Setting could not be saved. Just continue the run } finally { // Start a new upload action ScheduledAgent.Upload(); } }
public virtual void onRequestFinish(MegaSDK api, MRequest request, MError e) { switch (e.getErrorCode()) { case MErrorType.API_EINCOMPLETE: if (request.getType() == MRequestType.TYPE_LOGOUT && request.getParamType() == (int)MErrorType.API_ESSL) { if (SSLCertificateAlertDisplayed) { break; } SSLCertificateAlertDisplayed = true; UiService.OnUiThread(async() => { var result = await DialogService.ShowSSLCertificateAlert(); SSLCertificateAlertDisplayed = false; switch (result) { // "Retry" button case ContentDialogResult.Primary: api.reconnect(); break; // "Open browser" button case ContentDialogResult.Secondary: await Launcher.LaunchUriAsync( new Uri(ResourceService.AppResources.GetString("AR_MegaUrl"), UriKind.RelativeOrAbsolute)); break; // "Ignore" or "Close" button case ContentDialogResult.None: default: api.setPublicKeyPinning(false); api.reconnect(); break; } }); } break; case MErrorType.API_ESID: AppService.LogoutActions(); // Show the login page with the corresponding navigation parameter UiService.OnUiThread(() => { NavigateService.Instance.Navigate(typeof(LoginAndCreateAccountPage), true, NavigationObject.Create(typeof(MainViewModel), NavigationActionType.API_ESID)); }); break; } }
public virtual void onRequestTemporaryError(MegaSDK api, MRequest request, MError e) { UiService.OnUiThread(() => { // If is the first error/retry (timer is not running) start the timer if (apiErrorTimer != null && !apiErrorTimer.IsEnabled) { apiErrorTimer.Start(); } }); }
protected override void OnSuccesAction(MegaSDK api, MRequest request) { SettingsService.SaveMegaLoginData(_loginViewModel.Email, _loginViewModel.SessionKey); // Validate product subscription license on background thread Task.Run(() => LicenseService.ValidateLicenses()); // Initialize the DB AppService.InitializeDatabase(); }
public TransfersViewModel(MegaSDK megaSdk, AppInformation appInformation, TransferQueu megaTransfers) : base(megaSdk, appInformation) { MegaTransfers = megaTransfers; UpdateUserData(); InitializeMenu(HamburgerMenuItemType.Transfers); SetEmptyContentTemplate(); }
public virtual void onRequestTemporaryError(MegaSDK api, MRequest request, MError e) { Deployment.Current.Dispatcher.BeginInvoke(() => { // If is the first error/retry (timer is not running) start the timer if (apiErrorTimer != null && !apiErrorTimer.IsEnabled) { apiErrorTimer.Start(); } }); }
public void onContactRequestsUpdate(MegaSDK api, MContactRequestList requests) { foreach (var contacts in Contacts) { Deployment.Current.Dispatcher.BeginInvoke(() => { contacts.GetReceivedContactRequests(); contacts.GetSentContactRequests(); }); } }
public override void onRequestTemporaryError(MegaSDK api, MRequest request, MError e) { // Starts the timer when receives the first API_EAGAIN (-3) if (e.getErrorCode() == MErrorType.API_EAGAIN && this.isFirstAPI_EAGAIN) { this.isFirstAPI_EAGAIN = false; Deployment.Current.Dispatcher.BeginInvoke(() => timerAPI_EAGAIN.Start()); } base.onRequestTemporaryError(api, request, e); }
public ImageNodeViewModel(MegaSDK megaSdk, AppInformation appInformation, MNode megaNode, ContainerType parentContainerType, ObservableCollection <IMegaNode> parentCollection = null, ObservableCollection <IMegaNode> childCollection = null) : base(megaSdk, appInformation, megaNode, parentContainerType, parentCollection, childCollection) { // Image node downloads to the image path of the full original image this.Transfer = new TransferObjectModel(MegaSdk, this, MTransferType.TYPE_DOWNLOAD, LocalFilePath); this.DefaultImagePathData = ImageService.GetDefaultFileTypePathData(this.Name); // Default false for preview slide InViewingRange = false; }
protected override void OnSuccesAction(MegaSDK api, MRequest request) { if (Convert.ToBoolean(api.isLoggedIn())) { api.logout(new LogOutRequestListener(false)); } App.AppInformation.IsNewlyActivatedAccount = true; api.login(request.getEmail(), request.getPassword(), new LoginRequestListener(new LoginViewModel(api))); }
/// <summary> /// This function is called when a folder transfer has finished /// </summary> /// <param name="api">MegaApi object that started the transfer</param> /// <param name="transfer">Information about the transfer</param> /// <param name="e">Error information</param> private async void FolderTransferFinish(MegaSDK api, MTransfer transfer, MError e) { // In this case the transfer is not included in the transfers list. // We need to create a new 'TransferObjectModel' to work with it. var megaTransfer = TransferService.CreateTransferObjectModel(transfer); if (megaTransfer == null) { return; } megaTransfer.Transfer = transfer; UiService.OnUiThread(() => { megaTransfer.TransferState = transfer.getState(); megaTransfer.TransferPriority = transfer.getPriority(); }); switch (e.getErrorCode()) { case MErrorType.API_OK: if (transfer.getType() == MTransferType.TYPE_DOWNLOAD) { if (megaTransfer.IsSaveForOfflineTransfer) { this.AddOfflineNodeFromTransfer(megaTransfer); return; } if (!await megaTransfer.FinishDownload(megaTransfer.TransferPath, megaTransfer.SelectedNode.Name)) { UiService.OnUiThread(() => megaTransfer.TransferState = MTransferState.STATE_FAILED); } } break; case MErrorType.API_EGOINGOVERQUOTA: // Not enough quota case MErrorType.API_EOVERQUOTA: //Storage overquota error ProcessOverquotaError(api, e); break; case MErrorType.API_EINCOMPLETE: if (megaTransfer.IsSaveForOfflineTransfer) { this.RemoveOfflineNodeFromTransfer(megaTransfer); } break; default: ProcessDefaultError(transfer); break; } }
public async virtual void onRequestFinish(MegaSDK api, MRequest request, MError e) { switch (e.getErrorCode()) { case MErrorType.API_OK: if (ShowSuccesMessage) { await DialogService.ShowAlertAsync( SuccessMessageTitle, SuccessMessage); } if (ActionOnSucces) { OnSuccesAction(api, request); } if (NavigateOnSucces) { UiService.OnUiThread(() => NavigateService.Instance.Navigate(NavigateToPage, true, NavigationObject)); } break; case MErrorType.API_EGOINGOVERQUOTA: // Not enough storage quota LogService.Log(MLogLevel.LOG_LEVEL_INFO, string.Format("Not enough storage quota ({0})", e.getErrorCode().ToString())); UiService.OnUiThread(() => DialogService.ShowStorageOverquotaAlert(true)); break; case MErrorType.API_EOVERQUOTA: //Storage overquota error LogService.Log(MLogLevel.LOG_LEVEL_INFO, string.Format("Storage quota exceeded ({0})", e.getErrorCode().ToString())); UiService.OnUiThread(() => { AccountService.AccountDetails.IsInStorageOverquota = true; DialogService.ShowStorageOverquotaAlert(false); }); break; default: if (e.getErrorCode() != MErrorType.API_EINCOMPLETE) { if (ShowErrorMessage) { UiService.OnUiThread(async() => { await DialogService.ShowAlertAsync(ErrorMessageTitle, string.Format(ErrorMessage, e.getErrorString())); }); } } break; } }
public override void onRequestStart(MegaSDK api, MRequest request) { base.onRequestStart(api, request); if (request.getType() != MRequestType.TYPE_LOGIN) { return; } UiService.OnUiThread(() => ProgressService.SetProgressIndicator(true, ProgressMessages.FastLogin)); }
public override void onRequestStart(MegaSDK api, MRequest request) { base.onRequestStart(api, request); if (request.getType() != MRequestType.TYPE_FETCH_NODES) { return; } UiService.OnUiThread(() => ProgressService.SetProgressIndicator(true, ProgressMessages.PM_FetchNodes)); }
public override void onRequestStart(MegaSDK api, MRequest request) { base.onRequestStart(api, request); if (request.getType() != MRequestType.TYPE_CHANGE_PW) { return; } Deployment.Current.Dispatcher.BeginInvoke(() => ProgressService.SetProgressIndicator(true, ProgressMessages.PM_ChangePassword)); }
public override void onRequestFinish(MegaSDK api, MRequest request, MError e) { Deployment.Current.Dispatcher.BeginInvoke(() => { ProgressService.ChangeProgressBarBackgroundColor((Color)Application.Current.Resources["PhoneChromeColor"]); ProgressService.SetProgressIndicator(false); }); if (e.getErrorCode() == MErrorType.API_OK) { if (this._waitEventRequest != null) { this._waitEventRequest.Set(); } if (ShowSuccesMessage && !_isMultiRemove) { Deployment.Current.Dispatcher.BeginInvoke(() => { new CustomMessageDialog( SuccessMessageTitle, SuccessMessage, App.AppInformation, MessageDialogButtons.Ok).ShowDialog(); }); } if (ActionOnSucces) { OnSuccesAction(api, request); } if (NavigateOnSucces) { Deployment.Current.Dispatcher.BeginInvoke(() => NavigateService.NavigateTo(NavigateToPage, NavigationParameter)); } } else if (e.getErrorCode() != MErrorType.API_EINCOMPLETE) { if (ShowErrorMessage) { Deployment.Current.Dispatcher.BeginInvoke(() => { new CustomMessageDialog( ErrorMessageTitle, String.Format(ErrorMessage, e.getErrorString()), App.AppInformation, MessageDialogButtons.Ok).ShowDialog(); }); } } }
protected override void OnSuccesAction(MegaSDK api, MRequest request) { if (_isImportFolderProcess) { MNode parentNode = api.getNodeByHandle(request.getParentHandle()); MNode newFolderNode = api.getNodeByHandle(request.getNodeHandle()); if (!App.LinkInformation.FoldersToImport.ContainsKey(parentNode.getBase64Handle())) { return; } // Get from the corresponding dictionary all the folders parent folder and explore them. var megaNodes = App.LinkInformation.FoldersToImport[parentNode.getBase64Handle()]; foreach (var node in megaNodes) { if (App.LinkInformation.FolderPaths.ContainsKey(node.getBase64Handle())) { String nodePath = App.LinkInformation.FolderPaths[node.getBase64Handle()]; // If the name of the new folder matches with the last part of the node path // obtained from the dictionary, then this is the current imported folder. if (String.Compare(newFolderNode.getName(), nodePath.Split('/').Last()) == 0) { // Import the content of a recently created node folder. ImportNodeContents(node, newFolderNode); // Remove the node from the list and update the dictionaries. megaNodes.Remove(node); if (App.LinkInformation.FoldersToImport.ContainsKey(parentNode.getBase64Handle())) { App.LinkInformation.FoldersToImport.Remove(parentNode.getBase64Handle()); } if (megaNodes.Count > 0) { if (!App.LinkInformation.FoldersToImport.ContainsKey(parentNode.getBase64Handle())) { App.LinkInformation.FoldersToImport.Add(parentNode.getBase64Handle(), megaNodes); } } if (App.LinkInformation.FolderPaths.ContainsKey(node.getBase64Handle())) { App.LinkInformation.FolderPaths.Remove(node.getBase64Handle()); } break; } } } } }
public override void onRequestFinish(MegaSDK api, MRequest request, MError e) { Deployment.Current.Dispatcher.BeginInvoke(() => { ProgressService.ChangeProgressBarBackgroundColor((Color)Application.Current.Resources["PhoneChromeColor"]); ProgressService.SetProgressIndicator(false); _loginViewModel.ControlState = true; timerAPI_EAGAIN.Stop(); }); if (e.getErrorCode() == MErrorType.API_OK) { _loginViewModel.SessionKey = api.dumpSession(); } else { if (_loginPage != null) { Deployment.Current.Dispatcher.BeginInvoke(() => _loginPage.SetApplicationBar(true)); } switch (e.getErrorCode()) { case MErrorType.API_ENOENT: // E-mail unassociated with a MEGA account or Wrong password Deployment.Current.Dispatcher.BeginInvoke(() => new CustomMessageDialog(ErrorMessageTitle, AppMessages.WrongEmailPasswordLogin, App.AppInformation, MessageDialogButtons.Ok).ShowDialog()); return; case MErrorType.API_ETOOMANY: // Too many failed login attempts. Wait one hour. Deployment.Current.Dispatcher.BeginInvoke(() => new CustomMessageDialog(ErrorMessageTitle, String.Format(AppMessages.AM_TooManyFailedLoginAttempts, DateTime.Now.AddHours(1).ToString("HH:mm:ss")), App.AppInformation, MessageDialogButtons.Ok).ShowDialog()); return; case MErrorType.API_EINCOMPLETE: // Account not confirmed Deployment.Current.Dispatcher.BeginInvoke(() => new CustomMessageDialog(ErrorMessageTitle, AppMessages.AM_AccountNotConfirmed, App.AppInformation, MessageDialogButtons.Ok).ShowDialog()); return; case MErrorType.API_EBLOCKED: // Account blocked base.onRequestFinish(api, request, e); return; } } base.onRequestFinish(api, request, e); }
protected override void OnSuccesAction(MegaSDK api, MRequest request) { App.LinkInformation.ActiveLink = request.getLink(); MNode publicNode = App.LinkInformation.PublicNode = request.getPublicMegaNode(); if (publicNode != null) { // Save the handle of the last public node accessed (Task #10800) SettingsService.SaveLastPublicNodeHandle(publicNode.getHandle()); #if WINDOWS_PHONE_80 // Detect if is an image to allow directly download to camera albums bool isImage = false; if (publicNode.isFile()) { FileNodeViewModel node = new FileNodeViewModel(api, null, publicNode, ContainerType.PublicLink); isImage = node.IsImage; } #endif Deployment.Current.Dispatcher.BeginInvoke(() => { try { #if WINDOWS_PHONE_80 DialogService.ShowOpenLink(publicNode, _folderViewModel, isImage); #elif WINDOWS_PHONE_81 DialogService.ShowOpenLink(publicNode, _folderViewModel); #endif } catch (Exception e) { new CustomMessageDialog( ErrorMessageTitle, String.Format(ErrorMessage, e.Message), App.AppInformation, MessageDialogButtons.Ok).ShowDialog(); } }); } else { Deployment.Current.Dispatcher.BeginInvoke(() => { new CustomMessageDialog( ErrorMessageTitle, AppMessages.AM_ImportFileFailedNoErrorCode, App.AppInformation, MessageDialogButtons.Ok).ShowDialog(); }); } }
public async virtual void onRequestFinish(MegaSDK api, MRequest request, MError e) { switch (e.getErrorCode()) { case MErrorType.API_OK: if (ShowSuccesMessage) { await DialogService.ShowAlertAsync( SuccessMessageTitle, SuccessMessage); } if (ActionOnSucces) { OnSuccesAction(api, request); } if (NavigateOnSucces) { UiService.OnUiThread(() => NavigateService.Instance.Navigate(NavigateToPage, true, NavigationObject)); } break; case MErrorType.API_EGOINGOVERQUOTA: // Not enough quota case MErrorType.API_EOVERQUOTA: //Storage overquota error UiService.OnUiThread(DialogService.ShowOverquotaAlert); // Stop all upload transfers LogService.Log(MLogLevel.LOG_LEVEL_INFO, string.Format("Storage quota exceeded ({0}) - Canceling uploads", e.getErrorCode().ToString())); api.cancelTransfers((int)MTransferType.TYPE_UPLOAD); // Disable the "Camera Uploads" service if is enabled if (TaskService.IsBackGroundTaskActive(CameraUploadService.TaskEntryPoint, CameraUploadService.TaskName)) { LogService.Log(MLogLevel.LOG_LEVEL_INFO, string.Format("Storage quota exceeded ({0}) - Disabling CAMERA UPLOADS service", e.getErrorCode().ToString())); TaskService.UnregisterBackgroundTask(CameraUploadService.TaskEntryPoint, CameraUploadService.TaskName); } break; default: if (e.getErrorCode() != MErrorType.API_EINCOMPLETE) { if (ShowErrorMessage) { await DialogService.ShowAlertAsync(ErrorMessageTitle, string.Format(ErrorMessage, e.getErrorString())); } } break; } }
public override void onRequestStart(MegaSDK api, MRequest request) { base.onRequestStart(api, request); Deployment.Current.Dispatcher.BeginInvoke(() => { // Disable MainPage appbar buttons if (_mainPageViewModel != null) { _mainPageViewModel.SetCommandStatus(false); } }); }
public NodeViewModel(MegaSDK megaSdk, MNode baseNode) { this._megaSdk = megaSdk; this._baseNode = baseNode; this.Name = baseNode.getName(); this.Size = baseNode.getSize(); this.CreationTime = ConvertDateToString(_baseNode.getCreationTime()).ToString("dd MMM yyyy"); this.ModificationTime = ConvertDateToString(_baseNode.getModificationTime()).ToString("dd MMM yyyy"); this.SizeAndSuffix = Size.ToStringAndSuffix(); this.Type = baseNode.getType(); this.NumberOfFiles = this.Type != MNodeType.TYPE_FOLDER ? null : String.Format("{0} {1}", this._megaSdk.getNumChildren(this._baseNode), UiResources.Files); if (this.Type == MNodeType.TYPE_FOLDER || this.Type == MNodeType.TYPE_FILE) this.ThumbnailImageUri = new Uri((String)new FileTypeToImageConverter().Convert(this, null, null, null), UriKind.Relative); }
public void onRequestFinish(MegaSDK api, MRequest request, MError e) { Deployment.Current.Dispatcher.BeginInvoke(() => { if (e.getErrorCode() == MErrorType.API_OK) { _cloudDriveViewModel.CurrentRootNode = new NodeViewModel(api, api.getRootNode()); _cloudDriveViewModel.LoadNodes(); } else { MessageBox.Show(e.getErrorString()); } ProgessService.SetProgressIndicator(false); }); }
public virtual void onRequestFinish(MegaSDK api, MRequest request, MError e) { Deployment.Current.Dispatcher.BeginInvoke(() => { ProgessService.SetProgressIndicator(false); this.ControlState = true; if (e.getErrorCode() == MErrorType.API_OK) { if (ShowSuccesMessage) MessageBox.Show(SuccessMessage, SuccessMessageTitle, MessageBoxButton.OK); if (ActionOnSucces) SuccesAction.Invoke(); if (NavigateOnSucces) NavigateService.NavigateTo(NavigateToPage, NavigationParameter); } else MessageBox.Show(String.Format(ErrorMessage, e.getErrorString()), ErrorMessageTitle, MessageBoxButton.OK); }); }
public CloudDriveViewModel(MegaSDK megaSdk) { this._megaSdk = megaSdk; this.CurrentRootNode = null; this.ChildNodes = new ObservableCollection<NodeViewModel>(); }
public void onRequestTemporaryError(MegaSDK api, MRequest request, MError e) { Deployment.Current.Dispatcher.BeginInvoke(() => MessageBox.Show(e.getErrorString())); }
// Do not add any additional code to this method private void InitializePhoneApplication() { if (phoneApplicationInitialized) return; // Create the frame but don't set it as RootVisual yet; this allows the splash // screen to remain active until the application is ready to render. RootFrame = new PhoneApplicationFrame(); RootFrame.Navigated += CompleteInitializePhoneApplication; // Handle navigation failures RootFrame.NavigationFailed += RootFrame_NavigationFailed; // Handle reset requests for clearing the backstack RootFrame.Navigated += CheckForResetNavigation; //The next line enables a custom logger, if this function is not used OutputDebugString() is called //in the native library and log messages are only readable with the native debugger attached. //The default behavior of MegaLogger() is to print logs using Debug.WriteLine() but it could //be used to sends log to a file, for example. MegaSDK.setLoggerObject(new MegaLogger()); //You can select the maximum output level for debug messages. //By default FATAL, ERROR, WARNING and INFO will be enabled //DEBUG and MAX can only be enabled in Debug builds, they are ignored in Release builds MegaSDK.setLogLevel(MLogLevel.LOG_LEVEL_DEBUG); //You can send messages to the logger using MEGASDK.log(), those messages will be received //in the active logger MegaSDK.log(MLogLevel.LOG_LEVEL_INFO, "Example log message"); // Initialize MegaSDK MegaSdk = new MegaSDK(AppResources.AppKey, AppResources.UserAgent, ApplicationData.Current.LocalFolder.Path, new MegaRandomNumberProvider()); // Initialize the main drive CloudDrive = new CloudDriveViewModel(MegaSdk); // Ensure we don't initialize again phoneApplicationInitialized = true; }
public virtual void onRequestTemporaryError(MegaSDK api, MRequest request, MError e) { Deployment.Current.Dispatcher.BeginInvoke(() => { ProgessService.SetProgressIndicator(false); MessageBox.Show(String.Format(ErrorMessage, e.getErrorString()), ErrorMessageTitle, MessageBoxButton.OK); }); }
public virtual void onRequestUpdate(MegaSDK api, MRequest request) { // No update status necessary }
public override void onRequestFinish(MegaSDK api, MRequest request, MError e) { if (e.getErrorCode() == MErrorType.API_OK) SessionKey = api.dumpSession(); base.onRequestFinish(api, request, e); }