예제 #1
0
        private async void Upload_Executed()
        {
            this.IsBusy = true;

            try
            {
                if (string.IsNullOrEmpty(this.selectedName))
                {
                    throw new Exception("You forgot to enter a file name.");
                }

                // Connect to working folder
                await MyOneDrive.SetWorkingFolder(_WORKING_FOLDER_NAME);

                await MyOneDrive.SaveFile(
                    MyOneDrive.WorkingFolder,
                    this.selectedName,
                    this.selectedContent.AsStream());

                Toast.ShowInfo("Upload successful.");
            }
            catch (Exception ex)
            {
                Toast.ShowError(ex.Message);
            }
            finally
            {
                this.IsBusy = false;
            }
        }
예제 #2
0
        private async void CreateAssets_Executed()
        {
            this.IsBusy = true;

            try
            {
                // Create Assets
                await MyOneDrive.SetWorkingFolder(_WORKING_FOLDER_NAME);

                for (int i = 1; i < 9; i++)
                {
                    Debug.WriteLine("Creating file {0}", i);
                    await MyOneDrive.SaveFile(
                        MyOneDrive.WorkingFolder,
                        string.Format("Sample file {0}.txt", i),
                        string.Format("This is the content of sample file {0}", i).AsStream());
                }
            }
            catch (Exception ex)
            {
                Toast.ShowError(ex.Message);
            }
            finally
            {
                this.IsBusy = false;
            }
        }