예제 #1
0
    protected async void lnkSaveDropbox_Click(object sender, EventArgs e)
    {
        Profile       pf = MyFlightbook.Profile.GetUser(User.Identity.Name);
        LogbookBackup lb = new LogbookBackup(pf);

        try
        {
            if (await new MFBDropbox().ValidateDropboxToken(pf, true, true) == MFBDropbox.TokenStatus.None)
            {
                return;
            }

            Dropbox.Api.Files.FileMetadata result = await lb.BackupToDropbox();

            if (ckIncludeImages.Checked)
            {
                result = await lb.BackupImagesToDropbox(Branding.CurrentBrand);
            }

            lblDropBoxSuccess.Visible = true;
        }
        catch (Dropbox.Api.ApiException <Dropbox.Api.Auth.TokenFromOAuth1Error> ex)
        {
            ShowDropboxError(ex.Message);
        }
        catch (Dropbox.Api.AuthException ex)
        {
            ShowDropboxError(ex.Message);
        }
        catch (Dropbox.Api.ApiException <Dropbox.Api.Files.UploadError> ex)
        {
            if (ex.ErrorResponse.IsPath && ex.ErrorResponse.AsPath != null && ex.ErrorResponse.AsPath.Value.Reason.IsInsufficientSpace)
            {
                ShowDropboxError(Resources.LocalizedText.DropboxErrorOutOfSpace);
            }
            else
            {
                ShowDropboxError(ex.Message);
            }
        }
        catch (Dropbox.Api.BadInputException ex)
        {
            ShowDropboxError(ex.Message);
        }
        catch (Dropbox.Api.HttpException ex)
        {
            ShowDropboxError(ex.Message);
        }
        catch (UnauthorizedAccessException ex)
        {
            ShowDropboxError(ex.Message);
        }
        catch (MyFlightbookException ex)
        {
            ShowDropboxError(ex.Message);
        }
    }
예제 #2
0
 /// <summary>
 /// <para>Initializes a new instance of the <see cref="Success" /> class.</para>
 /// </summary>
 /// <param name="value">The value</param>
 public Success(FileMetadata value)
 {
     this.Value = value;
 }
예제 #3
0
 /// <summary>
 /// <para>Initializes a new instance of the <see cref="Complete" /> class.</para>
 /// </summary>
 /// <param name="value">The value</param>
 public Complete(FileMetadata value)
 {
     this.Value = value;
 }
예제 #4
0
 /// <summary>
 /// <para>Initializes a new instance of the <see cref="PreviewResult" /> class.</para>
 /// </summary>
 /// <param name="fileMetadata">Metadata corresponding to the file received as an
 /// argument. Will be populated if the endpoint is called with a path
 /// (ReadPath).</param>
 /// <param name="linkMetadata">Minimal metadata corresponding to the file received as
 /// an argument. Will be populated if the endpoint is called using a shared link
 /// (SharedLinkFileInfo).</param>
 public PreviewResult(FileMetadata fileMetadata            = null,
                      MinimalFileLinkMetadata linkMetadata = null)
 {
     this.FileMetadata = fileMetadata;
     this.LinkMetadata = linkMetadata;
 }