private async void uploadImageButton_Clicked(object sender, EventArgs e)
        {
            var folder = await _service.GetAppRoot();

            using (var stream = this._photo.GetStream())
            {
                this._response = await _service.SaveFile(folder.Id, System.IO.Path.GetFileName(this._photo.Path), stream);

                Debug.WriteLine(this._response.WebUrl);

                await DisplayAlert("アップロード", "ファイルを以下のURLにアップロードしました。" + this._response.WebUrl, "OK");

                this.result.Text = this._response.WebUrl;
            }
        }
Пример #2
0
        private async void CreaBackupDB()
        {
            // Obtengo la ruta completa al archivo de DB de Sqlite
            var lfolder = Windows.Storage.ApplicationData.Current.LocalFolder;
            var dbFile  = await lfolder.GetFileAsync("Storage.sqlite");

            // Proceso a subir a OneDrive el archvio, dentro de la carpeta especial Aplicaciones
            ShowBusy(true);

            Exception error = null;

            try
            {
                var folder = await _service.GetAppRoot();

                using (var stream = await dbFile.OpenStreamForReadAsync())
                {
                    var info = await _service.SaveFile(folder.Id, dbFile.Name, stream);

                    // Save for the GetLink demo
                    _savedId = info.Id;

                    var successDialog = new MessageDialog(traduce("MsgBackupFin"), traduce("NameApp"));
                    await successDialog.ShowAsync();
                }

                ShowBusy(false);
            }
            catch (Exception ex)
            {
                error = ex;
            }

            if (error != null)
            {
                var dialog2 = new MessageDialog(traduce("MsgErrorGeneral") + " " + error.Message, traduce("NameApp"));
                await dialog2.ShowAsync();

                ShowBusy(false);
            }
        }