Ejemplo n.º 1
0
        private void AddOfflineNodeFromTransfer(TransferObjectModel megaTransfer)
        {
            var parentNode = SdkService.MegaSdk.getParentNode(megaTransfer.SelectedNode.OriginalMNode);

            // Need get the path on the transfer finish because the file name can be changed if already exists in the destiny path.
            var offlineNodePath = Path.Combine(
                OfflineService.GetOfflineParentNodePath(megaTransfer.SelectedNode.OriginalMNode),
                megaTransfer.Transfer.getFileName());

            var sfoNode = new SavedForOfflineDB
            {
                Fingerprint        = SdkService.MegaSdk.getNodeFingerprint(megaTransfer.SelectedNode.OriginalMNode),
                Base64Handle       = megaTransfer.SelectedNode.OriginalMNode.getBase64Handle(),
                LocalPath          = offlineNodePath,
                ParentBase64Handle = parentNode != null?
                                     parentNode.getBase64Handle() : string.Empty
            };

            if (SavedForOfflineDB.ExistsNodeByLocalPath(sfoNode.LocalPath))
            {
                SavedForOfflineDB.UpdateNode(sfoNode);
            }
            else
            {
                SavedForOfflineDB.InsertNode(sfoNode);
            }

            UiService.OnUiThread(() => megaTransfer.SelectedNode.IsSavedForOffline = true);

            OfflineService.CheckOfflineNodePath(megaTransfer.SelectedNode.OriginalMNode);
        }
Ejemplo n.º 2
0
 private void RemoveOfflineNodeFromTransfer(TransferObjectModel megaTransfer)
 {
     if (SavedForOfflineDB.ExistsNodeByLocalPath(megaTransfer.TransferPath))
     {
         SavedForOfflineDB.DeleteNodeByLocalPath(megaTransfer.TransferPath);
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Search into a transfers list the <see cref="TransferObjectModel"/> corresponding to a <see cref="MTransfer"/>.
        /// </summary>
        /// <param name="transfersList">Transfers list where search the transfer.</param>
        /// <param name="transfer">Transfer to search.</param>
        /// <returns>The transfer object if exists or NULL in other case.</returns>
        public static TransferObjectModel SearchTransfer(IList <TransferObjectModel> transfersList, MTransfer transfer)
        {
            // Folder transfers are not included into the transfers list.
            if (transfersList == null || transfer == null || transfer.isFolderTransfer())
            {
                return(null);
            }

            TransferObjectModel megaTransfer = null;

            try
            {
                megaTransfer = transfersList.FirstOrDefault(
                    t => (t.Transfer != null && t.Transfer.getTag() == transfer.getTag()) ||
                    (t.TransferPath != null && t.TransferPath.Equals(transfer.getPath())));
            }
            catch (Exception e)
            {
                var fileName = transfer.getFileName();
                var message  = (fileName == null) ? "Error searching transfer" :
                               string.Format("Error searching transfer. File: '{0}'", fileName);
                LogService.Log(MLogLevel.LOG_LEVEL_ERROR, message, e);
                return(null);
            }

            return(megaTransfer);
        }
Ejemplo n.º 4
0
        private async void OnAcceptClick(object sender, System.EventArgs e)
        {
            if (LstMediaItems.CheckedItems == null || LstMediaItems.CheckedItems.Count < 1)
            {
                new CustomMessageDialog(
                    AppMessages.MinimalPictureSelection_Title,
                    AppMessages.MinimalPictureSelection,
                    App.AppInformation,
                    MessageDialogButtons.Ok).ShowDialog();
                return;
            }

            ProgressService.SetProgressIndicator(true, ProgressMessages.PrepareUploads);
            SetControlState(false);

            // Set upload directory only once for speed improvement and if not exists, create dir
            var uploadDir = AppService.GetUploadDirectoryPath(true);

            foreach (var checkedItem in LstMediaItems.CheckedItems)
            {
                var item = (BaseMediaViewModel <Picture>)checkedItem;
                if (item == null)
                {
                    continue;
                }

                try
                {
                    string fileName = Path.GetFileName(item.Name);
                    if (fileName != null)
                    {
                        string newFilePath = Path.Combine(uploadDir, fileName);
                        using (var fs = new FileStream(newFilePath, FileMode.Create))
                        {
                            await item.BaseObject.GetImage().CopyToAsync(fs);

                            await fs.FlushAsync();

                            fs.Close();
                        }
                        var uploadTransfer = new TransferObjectModel(SdkService.MegaSdk, App.CloudDrive.CurrentRootNode, MTransferType.TYPE_UPLOAD, newFilePath);
                        TransfersService.MegaTransfers.Add(uploadTransfer);
                        uploadTransfer.StartTransfer();
                    }
                }
                catch (Exception)
                {
                    new CustomMessageDialog(
                        AppMessages.PrepareImageForUploadFailed_Title,
                        String.Format(AppMessages.PrepareImageForUploadFailed, item.Name),
                        App.AppInformation,
                        MessageDialogButtons.Ok).ShowDialog();
                }
            }

            ProgressService.SetProgressIndicator(false);
            SetControlState(true);

            App.CloudDrive.NoFolderUpAction = true;
        }
Ejemplo n.º 5
0
        public static void CaptureCameraImage(FolderViewModel currentFolder)
        {
            try
            {
                var cameraCaptureTask = new CameraCaptureTask();

                cameraCaptureTask.Completed += async(sender, result) =>
                {
                    if (result == null || result.TaskResult != TaskResult.OK)
                    {
                        return;
                    }

                    try
                    {
                        string fileName = Path.GetFileName(result.OriginalFileName);
                        if (fileName != null)
                        {
                            string newFilePath = Path.Combine(AppService.GetUploadDirectoryPath(), fileName);
                            using (var fs = new FileStream(newFilePath, FileMode.Create))
                            {
                                await result.ChosenPhoto.CopyToAsync(fs);

                                await fs.FlushAsync();

                                fs.Close();
                            }
                            var uploadTransfer = new TransferObjectModel(currentFolder.MegaSdk,
                                                                         currentFolder.FolderRootNode,
                                                                         TransferType.Upload,
                                                                         newFilePath);
                            App.MegaTransfers.Insert(0, uploadTransfer);
                            uploadTransfer.StartTransfer();
                        }

                        NavigateService.NavigateTo(typeof(TransferPage), NavigationParameter.Normal);
                    }
                    catch (Exception)
                    {
                        new CustomMessageDialog(
                            AppMessages.PhotoUploadError_Title,
                            AppMessages.PhotoUploadError,
                            App.AppInformation,
                            MessageDialogButtons.Ok).ShowDialog();
                    }
                };

                cameraCaptureTask.Show();
            }
            catch (Exception e)
            {
                new CustomMessageDialog(
                    AppMessages.CapturePhotoFailed_Title,
                    String.Format(AppMessages.CapturePhotoFailed, e.Message),
                    App.AppInformation,
                    MessageDialogButtons.Ok).ShowDialog();
            }
        }
        private async void OnUploadClick(object sender, System.EventArgs e)
        {
            string fileName = String.Format("WP_Selfie_{0}{1:D2}{2:D2}{3}{4}.jpg",
                                            DateTime.Now.Year,
                                            DateTime.Now.Month,
                                            DateTime.Now.Day,
                                            DateTime.Now.Hour,
                                            DateTime.Now.Minute);

            try
            {
                string newFilePath = Path.Combine(AppService.GetUploadDirectoryPath(true), fileName);
                using (var fs = new FileStream(newFilePath, FileMode.Create))
                {
                    await fs.WriteAsync(_previewSelfieViewModel.Selfie.ConvertToBytes().ToArray(), 0,
                                        _previewSelfieViewModel.Selfie.ConvertToBytes().Count());

                    await fs.FlushAsync();

                    fs.Close();
                }

                var uploadTransfer = new TransferObjectModel(SdkService.MegaSdk, App.CloudDrive.CurrentRootNode, MTransferType.TYPE_UPLOAD, newFilePath);
                TransfersService.MegaTransfers.Add(uploadTransfer);
                uploadTransfer.StartTransfer();

                App.CloudDrive.NoFolderUpAction = true;

                // Remove the `PhotoCameraPage` from the back stack and go back
                NavigationService.RemoveBackEntry();

                if (NavigateService.CanGoBack())
                {
                    NavigateService.GoBack();
                }
                else
                {
                    NavigateService.NavigateTo(typeof(MainPage), NavigationParameter.Normal);
                }
            }
            catch (Exception)
            {
                new CustomMessageDialog(
                    AppMessages.UploadSelfieFailed_Title,
                    AppMessages.UploadSelfieFailed,
                    App.AppInformation,
                    MessageDialogButtons.Ok).ShowDialog();
            }
        }
Ejemplo n.º 7
0
        public void onTransferStart(MegaSDK api, MTransfer transfer)
        {
            TransferObjectModel megaTransfer = null;

            if (transfer.getType() == MTransferType.TYPE_DOWNLOAD)
            {
                // If is a public node
                MNode node = transfer.getPublicMegaNode();
                if (node == null) // If not
                {
                    node = api.getNodeByHandle(transfer.getNodeHandle());
                }

                if (node != null)
                {
                    megaTransfer = new TransferObjectModel(api,
                                                           NodeService.CreateNew(api, App.AppInformation, node, ContainerType.CloudDrive),
                                                           TransferType.Download, transfer.getPath());
                }
            }
            else
            {
                megaTransfer = new TransferObjectModel(api, App.MainPageViewModel.CloudDrive.FolderRootNode,
                                                       TransferType.Upload, transfer.getPath());
            }

            if (megaTransfer != null)
            {
                Deployment.Current.Dispatcher.BeginInvoke(() =>
                {
                    TransfersService.GetTransferAppData(transfer, megaTransfer);

                    megaTransfer.Transfer                      = transfer;
                    megaTransfer.Status                        = TransferStatus.Queued;
                    megaTransfer.CancelButtonState             = true;
                    megaTransfer.TransferButtonIcon            = new Uri("/Assets/Images/cancel transfers.Screen-WXGA.png", UriKind.Relative);
                    megaTransfer.TransferButtonForegroundColor = new SolidColorBrush(Colors.White);
                    megaTransfer.IsBusy                        = true;
                    megaTransfer.TotalBytes                    = transfer.getTotalBytes();
                    megaTransfer.TransferedBytes               = transfer.getTransferredBytes();
                    megaTransfer.TransferSpeed                 = transfer.getSpeed().ToStringAndSuffixPerSecond();

                    App.MegaTransfers.Add(megaTransfer);
                    Transfers.Add(megaTransfer);
                });
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Moves a transfer to the completed transfers list.
        /// </summary>
        /// <param name="megaTransfers"><see cref="TransferQueue"/> which contains the transfers list(s).</param>
        /// <param name="megaTransfer"><see cref="TransferObjectModel"/> of the transfer to move.</param>
        public static void MoveMegaTransferToCompleted(TransferQueue megaTransfers, TransferObjectModel megaTransfer)
        {
            switch (megaTransfer.Type)
            {
            case MTransferType.TYPE_DOWNLOAD:
                megaTransfers.Downloads.Remove(megaTransfer);
                break;

            case MTransferType.TYPE_UPLOAD:
                megaTransfers.Uploads.Remove(megaTransfer);
                break;

            default:
                throw new ArgumentOutOfRangeException("megaTransfer.Type", megaTransfer.Type, null);
            }

            megaTransfers.Completed.Add(megaTransfer);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Remove a transfer to the Transfer Queue.
        /// </summary>
        /// <param name="transferObjectModel">Transfer to remove</param>
        public void Remove(TransferObjectModel transferObjectModel)
        {
            if (transferObjectModel.TransferState == MTransferState.STATE_COMPLETED)
            {
                this.Completed.Remove(transferObjectModel);
                return;
            }

            switch (transferObjectModel.Type)
            {
            case MTransferType.TYPE_DOWNLOAD:
                this.Downloads.Remove(transferObjectModel);
                break;

            case MTransferType.TYPE_UPLOAD:
                this.Uploads.Remove(transferObjectModel);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Add a transfer to the Transfer Queue.
        /// </summary>
        /// <param name="transferObjectModel">Transfer to add</param>
        public void Add(TransferObjectModel transferObjectModel)
        {
            // Folder transfers are not included into the transfers list.
            if (transferObjectModel.IsFolderTransfer)
            {
                return;
            }

            switch (transferObjectModel.Type)
            {
            case MTransferType.TYPE_DOWNLOAD:
                Sort(this.Downloads, transferObjectModel);
                break;

            case MTransferType.TYPE_UPLOAD:
                Sort(this.Uploads, transferObjectModel);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
        private async void OnUploadClick(object sender, System.EventArgs e)
        {
            string fileName = String.Format("WP_Selfie_{0}{1:D2}{2:D2}{3}{4}.jpg",
                                            DateTime.Now.Year,
                                            DateTime.Now.Month,
                                            DateTime.Now.Day,
                                            DateTime.Now.Hour,
                                            DateTime.Now.Minute);

            try
            {
                string newFilePath = Path.Combine(AppService.GetUploadDirectoryPath(true), fileName);
                using (var fs = new FileStream(newFilePath, FileMode.Create))
                {
                    await fs.WriteAsync(_previewSelfieViewModel.Selfie.ConvertToBytes().ToArray(), 0,
                                        _previewSelfieViewModel.Selfie.ConvertToBytes().Count());

                    await fs.FlushAsync();

                    fs.Close();
                }

                var uploadTransfer = new TransferObjectModel(App.MegaSdk, App.CloudDrive.CurrentRootNode, TransferType.Upload, newFilePath);
                App.MegaTransfers.Insert(0, uploadTransfer);
                uploadTransfer.StartTransfer();

                App.CloudDrive.NoFolderUpAction = true;
                this.Dispatcher.BeginInvoke(() => NavigateService.NavigateTo(typeof(TransferPage), NavigationParameter.SelfieSelected));
            }
            catch (Exception)
            {
                new CustomMessageDialog(
                    AppMessages.UploadSelfieFailed_Title,
                    AppMessages.UploadSelfieFailed,
                    App.AppInformation,
                    MessageDialogButtons.Ok).ShowDialog();
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Get the transfer "AppData" (substrings separated by '#')
        /// <para>- Substring 1: Boolean value to indicate if the download is for Save For Offline (SFO).</para>
        /// <para>- Substring 2: String which contains the download folder path external to the app sandbox cache.</para>
        /// </summary>
        /// <param name="transfer">MEGA SDK transfer to obtain the "AppData".</param>
        /// <param name="megaTransfer">App transfer object to be displayed.</param>
        /// <returns>Boolean value indicating if all was good.</returns>
        public static bool GetTransferAppData(MTransfer transfer, TransferObjectModel megaTransfer)
        {
            // Default values
            megaTransfer.IsSaveForOfflineTransfer = false;
            megaTransfer.ExternalDownloadPath     = null;

            // Only the downloads can contain app data
            if (transfer.getType() != MTransferType.TYPE_DOWNLOAD)
            {
                return(false);
            }

            // Get the transfer "AppData"
            String transferAppData = transfer.getAppData();

            if (String.IsNullOrWhiteSpace(transferAppData))
            {
                return(false);
            }

            // Split the string into the substrings separated by '#'
            string[] splittedAppData = transferAppData.Split("#".ToCharArray(), 2);
            if (splittedAppData.Count() < 1)
            {
                return(false);
            }

            // Set the corresponding values
            megaTransfer.IsSaveForOfflineTransfer = Convert.ToBoolean(splittedAppData[0]);

            if (splittedAppData.Count() >= 2)
            {
                megaTransfer.ExternalDownloadPath = splittedAppData[1];
            }

            return(true);
        }
Ejemplo n.º 13
0
        public static void Sort(ObservableCollection <TransferObjectModel> transferList,
                                TransferObjectModel transferObject)
        {
            if (transferList == null || transferObject == null)
            {
                return;
            }

            try
            {
                var existing = (transferObject.Transfer != null) ?
                               TransfersService.SearchTransfer(transferList, transferObject.Transfer) :
                               transferList.FirstOrDefault(t => (t.TransferPath != null && t.TransferPath.Equals(transferObject.TransferPath)));

                bool handled = false;
                bool move    = existing != null;
                var  index   = transferList.IndexOf(existing);
                var  count   = transferList.Count - 1;

                for (var i = 0; i <= count; i++)
                {
                    if ((int)transferObject.TransferPriority > (int)transferList[i].TransferPriority)
                    {
                        continue;
                    }

                    if (move)
                    {
                        if (index != i)
                        {
                            transferList.RemoveAt(index);
                            transferList.Insert(i, transferObject);
                        }
                    }
                    else
                    {
                        transferList.Insert(i, transferObject);
                    }
                    handled = true;
                    break;
                }

                if (handled)
                {
                    return;
                }

                if (move)
                {
                    if (index != count)
                    {
                        transferList.RemoveAt(index);
                        transferList.Insert(count, transferObject);
                    }
                }
                else
                {
                    transferList.Add(transferObject);
                }
            }
            catch (Exception e)
            {
                var message = (transferObject.DisplayName == null) ? "Error sorting transfer" :
                              string.Format("Error sorting transfer. File: '{0}'", transferObject.DisplayName);
                LogService.Log(MLogLevel.LOG_LEVEL_ERROR, message, e);
                return;
            }
        }
Ejemplo n.º 14
0
        private async void ContinueFileOpenPicker(FileOpenPickerContinuationEventArgs args)
        {
            try
            {
                if (args == null || (args.ContinuationData["Operation"] as string) != "SelectedFiles" ||
                    args.Files == null || args.Files.Count <= 0)
                {
                    ResetFilePicker();
                    return;
                }

                if (!App.CloudDrive.IsUserOnline())
                {
                    return;
                }

                ProgressService.SetProgressIndicator(true, ProgressMessages.PrepareUploads);

                // Set upload directory only once for speed improvement and if not exists, create dir
                var uploadDir = AppService.GetUploadDirectoryPath(true);

                // Get picked files only once for speed improvement and to try avoid ArgumentException in the loop
                IReadOnlyList <StorageFile> pickedFiles = args.Files;
                foreach (StorageFile file in pickedFiles)
                {
                    if (file == null)
                    {
                        continue;               // To avoid null references
                    }
                    try
                    {
                        string newFilePath = Path.Combine(uploadDir, file.Name);
                        using (var fs = new FileStream(newFilePath, FileMode.Create))
                        {
                            var stream = await file.OpenStreamForReadAsync();

                            await stream.CopyToAsync(fs);

                            await fs.FlushAsync();

                            fs.Close();
                        }
                        var uploadTransfer = new TransferObjectModel(
                            SdkService.MegaSdk, _cameraUploadsPageViewModel.CameraUploads.FolderRootNode, MTransferType.TYPE_UPLOAD, newFilePath);
                        TransfersService.MegaTransfers.Add(uploadTransfer);
                        uploadTransfer.StartTransfer();
                    }
                    catch (Exception)
                    {
                        new CustomMessageDialog(
                            AppMessages.PrepareFileForUploadFailed_Title,
                            String.Format(AppMessages.PrepareFileForUploadFailed, file.Name),
                            App.AppInformation,
                            MessageDialogButtons.Ok).ShowDialog();
                    }
                }
            }
            catch (Exception)
            {
                new CustomMessageDialog(
                    AppMessages.AM_PrepareFilesForUploadFailed_Title,
                    String.Format(AppMessages.AM_PrepareFilesForUploadFailed),
                    App.AppInformation,
                    MessageDialogButtons.Ok).ShowDialog();
            }
            finally
            {
                ResetFilePicker();
                ProgressService.SetProgressIndicator(false);
            }
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Create a <see cref="TransferObjectModel"/> from a <see cref="MTransfer"/>.
        /// </summary>
        /// <param name="transfer"></param>
        /// <returns>The new <see cref="TransferObjectModel"/></returns>
        public static TransferObjectModel CreateTransferObjectModel(MTransfer transfer)
        {
            if (transfer == null)
            {
                return(null);
            }

            try
            {
                TransferObjectModel megaTransfer = null;

                switch (transfer.getType())
                {
                case MTransferType.TYPE_DOWNLOAD:
                    MNode node = transfer.getPublicMegaNode() ??                               // If is a public node
                                 SdkService.MegaSdk.getNodeByHandle(transfer.getNodeHandle()); // If not

                    if (node == null)
                    {
                        return(null);
                    }

                    megaTransfer = new TransferObjectModel(SdkService.MegaSdk,
                                                           NodeService.CreateNew(SdkService.MegaSdk, App.AppInformation, node, ContainerType.CloudDrive),
                                                           MTransferType.TYPE_DOWNLOAD, transfer.getPath());
                    break;

                case MTransferType.TYPE_UPLOAD:
                    var parentNode = SdkService.MegaSdk.getNodeByHandle(transfer.getParentHandle());

                    if (parentNode == null)
                    {
                        return(null);
                    }

                    megaTransfer = new TransferObjectModel(SdkService.MegaSdk,
                                                           NodeService.CreateNew(SdkService.MegaSdk, App.AppInformation, parentNode, ContainerType.CloudDrive),
                                                           MTransferType.TYPE_UPLOAD, transfer.getPath());
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }

                if (megaTransfer != null)
                {
                    GetTransferAppData(transfer, megaTransfer);

                    megaTransfer.Transfer          = transfer;
                    megaTransfer.TransferState     = transfer.getState();
                    megaTransfer.TransferPriority  = transfer.getPriority();
                    megaTransfer.IsBusy            = false;
                    megaTransfer.TotalBytes        = transfer.getTotalBytes();
                    megaTransfer.TransferedBytes   = transfer.getTransferredBytes();
                    megaTransfer.TransferSpeed     = string.Empty;
                    megaTransfer.TransferMeanSpeed = 0;

                    megaTransfer.TransferState = !SdkService.MegaSdk.areTransfersPaused((int)transfer.getType())
                        ? MTransferState.STATE_QUEUED : MTransferState.STATE_PAUSED;
                }

                return(megaTransfer);
            }
            catch (Exception) { return(null); }
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Update the transfers list/queue.
        /// </summary>
        /// <param name="MegaTransfers">Transfers list/queue to update.</param>
        public static void UpdateMegaTransfersList(TransferQueu MegaTransfers)
        {
            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                MegaTransfers.Clear();
                MegaTransfers.Downloads.Clear();
                MegaTransfers.Uploads.Clear();
            });

            App.GlobalTransferListener.Transfers.Clear();

            // Get transfers and fill the transfers list again.
            var transfers    = App.MegaSdk.getTransfers();
            var numTransfers = transfers.size();

            for (int i = 0; i < numTransfers; i++)
            {
                var transfer = transfers.get(i);

                TransferObjectModel megaTransfer = null;
                if (transfer.getType() == MTransferType.TYPE_DOWNLOAD)
                {
                    // If is a public node
                    MNode node = transfer.getPublicMegaNode();
                    if (node == null) // If not
                    {
                        node = App.MegaSdk.getNodeByHandle(transfer.getNodeHandle());
                    }

                    if (node != null)
                    {
                        megaTransfer = new TransferObjectModel(App.MegaSdk,
                                                               NodeService.CreateNew(App.MegaSdk, App.AppInformation, node, ContainerType.CloudDrive),
                                                               TransferType.Download, transfer.getPath());
                    }
                }
                else
                {
                    megaTransfer = new TransferObjectModel(App.MegaSdk, App.MainPageViewModel.CloudDrive.FolderRootNode,
                                                           TransferType.Upload, transfer.getPath());
                }

                if (megaTransfer != null)
                {
                    Deployment.Current.Dispatcher.BeginInvoke(() =>
                    {
                        GetTransferAppData(transfer, megaTransfer);

                        megaTransfer.Transfer                      = transfer;
                        megaTransfer.Status                        = TransferStatus.Queued;
                        megaTransfer.CancelButtonState             = true;
                        megaTransfer.TransferButtonIcon            = new Uri("/Assets/Images/cancel transfers.Screen-WXGA.png", UriKind.Relative);
                        megaTransfer.TransferButtonForegroundColor = new SolidColorBrush(Colors.White);
                        megaTransfer.IsBusy                        = true;
                        megaTransfer.TotalBytes                    = transfer.getTotalBytes();
                        megaTransfer.TransferedBytes               = transfer.getTransferredBytes();
                        megaTransfer.TransferSpeed                 = transfer.getSpeed().ToStringAndSuffixPerSecond();

                        MegaTransfers.Add(megaTransfer);
                        App.GlobalTransferListener.Transfers.Add(megaTransfer);
                    });
                }
            }
        }