diff --git a/.gitignore b/.gitignore
index 407c8bf..a98fb5a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -111,3 +111,4 @@ UpgradeLog*.XML
.DS_Store
/packages
+/DropNetRT.Sample.WP8/packages
diff --git a/.nuget/NuGet.Config b/.nuget/NuGet.Config
deleted file mode 100644
index 67f8ea0..0000000
--- a/.nuget/NuGet.Config
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.nuget/NuGet.exe b/.nuget/NuGet.exe
deleted file mode 100644
index c41a0d0..0000000
Binary files a/.nuget/NuGet.exe and /dev/null differ
diff --git a/.nuget/NuGet.targets b/.nuget/NuGet.targets
deleted file mode 100644
index 3f8c37b..0000000
--- a/.nuget/NuGet.targets
+++ /dev/null
@@ -1,144 +0,0 @@
-
-
-
- $(MSBuildProjectDirectory)\..\
-
-
- false
-
-
- false
-
-
- true
-
-
- false
-
-
-
-
-
-
-
-
-
-
- $([System.IO.Path]::Combine($(SolutionDir), ".nuget"))
-
-
-
-
- $(SolutionDir).nuget
-
-
-
- $(MSBuildProjectDirectory)\packages.$(MSBuildProjectName.Replace(' ', '_')).config
- $(MSBuildProjectDirectory)\packages.$(MSBuildProjectName).config
-
-
-
- $(MSBuildProjectDirectory)\packages.config
- $(PackagesProjectConfig)
-
-
-
-
- $(NuGetToolsPath)\NuGet.exe
- @(PackageSource)
-
- "$(NuGetExePath)"
- mono --runtime=v4.0.30319 "$(NuGetExePath)"
-
- $(TargetDir.Trim('\\'))
-
- -RequireConsent
- -NonInteractive
-
- "$(SolutionDir) "
- "$(SolutionDir)"
-
-
- $(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir)
- $(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols
-
-
-
- RestorePackages;
- $(BuildDependsOn);
-
-
-
-
- $(BuildDependsOn);
- BuildPackage;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/DropNetRT.Sample.WP8/App.xaml b/DropNetRT.Sample.WP8/App.xaml
deleted file mode 100644
index f5cea62..0000000
--- a/DropNetRT.Sample.WP8/App.xaml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/DropNetRT.Sample.WP8/App.xaml.cs b/DropNetRT.Sample.WP8/App.xaml.cs
deleted file mode 100644
index 36a40f4..0000000
--- a/DropNetRT.Sample.WP8/App.xaml.cs
+++ /dev/null
@@ -1,229 +0,0 @@
-using System;
-using System.Diagnostics;
-using System.Resources;
-using System.Windows;
-using System.Windows.Markup;
-using System.Windows.Navigation;
-using Microsoft.Phone.Controls;
-using Microsoft.Phone.Shell;
-using DropNetRT.Sample.WP8.Resources;
-
-namespace DropNetRT.Sample.WP8
-{
- public partial class App : Application
- {
- public static DropNetRT.DropNetClient DropNetClient;
-
-
-
- ///
- /// Provides easy access to the root frame of the Phone Application.
- ///
- /// The root frame of the Phone Application.
- public static PhoneApplicationFrame RootFrame { get; private set; }
-
- ///
- /// Constructor for the Application object.
- ///
- public App()
- {
- // Global handler for uncaught exceptions.
- UnhandledException += Application_UnhandledException;
-
- // Standard XAML initialization
- InitializeComponent();
-
- // Phone-specific initialization
- InitializePhoneApplication();
-
- // Language display initialization
- InitializeLanguage();
-
- // Show graphics profiling information while debugging.
- if (Debugger.IsAttached)
- {
- // Display the current frame rate counters.
- Application.Current.Host.Settings.EnableFrameRateCounter = true;
-
- // Show the areas of the app that are being redrawn in each frame.
- //Application.Current.Host.Settings.EnableRedrawRegions = true;
-
- // Enable non-production analysis visualization mode,
- // which shows areas of a page that are handed off to GPU with a colored overlay.
- //Application.Current.Host.Settings.EnableCacheVisualization = true;
-
- // Prevent the screen from turning off while under the debugger by disabling
- // the application's idle detection.
- // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run
- // and consume battery power when the user is not using the phone.
- PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
- }
-
- DropNetClient = new DropNetRT.DropNetClient("y0mm6cm3psurvi7", "zfeijf4xbzdi072");
- DropNetClient.UseSandbox = true;
- }
-
- // Code to execute when the application is launching (eg, from Start)
- // This code will not execute when the application is reactivated
- private void Application_Launching(object sender, LaunchingEventArgs e)
- {
- }
-
- // Code to execute when the application is activated (brought to foreground)
- // This code will not execute when the application is first launched
- private void Application_Activated(object sender, ActivatedEventArgs e)
- {
- }
-
- // Code to execute when the application is deactivated (sent to background)
- // This code will not execute when the application is closing
- private void Application_Deactivated(object sender, DeactivatedEventArgs e)
- {
- }
-
- // Code to execute when the application is closing (eg, user hit Back)
- // This code will not execute when the application is deactivated
- private void Application_Closing(object sender, ClosingEventArgs e)
- {
- }
-
- // Code to execute if a navigation fails
- private void RootFrame_NavigationFailed(object sender, NavigationFailedEventArgs e)
- {
- if (Debugger.IsAttached)
- {
- // A navigation has failed; break into the debugger
- Debugger.Break();
- }
- }
-
- // Code to execute on Unhandled Exceptions
- private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
- {
- if (Debugger.IsAttached)
- {
- // An unhandled exception has occurred; break into the debugger
- Debugger.Break();
- }
- }
-
- #region Phone application initialization
-
- // Avoid double-initialization
- private bool phoneApplicationInitialized = false;
-
- // 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;
-
- // Ensure we don't initialize again
- phoneApplicationInitialized = true;
- }
-
- // Do not add any additional code to this method
- private void CompleteInitializePhoneApplication(object sender, NavigationEventArgs e)
- {
- // Set the root visual to allow the application to render
- if (RootVisual != RootFrame)
- RootVisual = RootFrame;
-
- // Remove this handler since it is no longer needed
- RootFrame.Navigated -= CompleteInitializePhoneApplication;
- }
-
- private void CheckForResetNavigation(object sender, NavigationEventArgs e)
- {
- // If the app has received a 'reset' navigation, then we need to check
- // on the next navigation to see if the page stack should be reset
- if (e.NavigationMode == NavigationMode.Reset)
- RootFrame.Navigated += ClearBackStackAfterReset;
- }
-
- private void ClearBackStackAfterReset(object sender, NavigationEventArgs e)
- {
- // Unregister the event so it doesn't get called again
- RootFrame.Navigated -= ClearBackStackAfterReset;
-
- // Only clear the stack for 'new' (forward) and 'refresh' navigations
- if (e.NavigationMode != NavigationMode.New && e.NavigationMode != NavigationMode.Refresh)
- return;
-
- // For UI consistency, clear the entire page stack
- while (RootFrame.RemoveBackEntry() != null)
- {
- ; // do nothing
- }
- }
-
- #endregion
-
- // Initialize the app's font and flow direction as defined in its localized resource strings.
- //
- // To ensure that the font of your application is aligned with its supported languages and that the
- // FlowDirection for each of those languages follows its traditional direction, ResourceLanguage
- // and ResourceFlowDirection should be initialized in each resx file to match these values with that
- // file's culture. For example:
- //
- // AppResources.es-ES.resx
- // ResourceLanguage's value should be "es-ES"
- // ResourceFlowDirection's value should be "LeftToRight"
- //
- // AppResources.ar-SA.resx
- // ResourceLanguage's value should be "ar-SA"
- // ResourceFlowDirection's value should be "RightToLeft"
- //
- // For more info on localizing Windows Phone apps see http://go.microsoft.com/fwlink/?LinkId=262072.
- //
- private void InitializeLanguage()
- {
- try
- {
- // Set the font to match the display language defined by the
- // ResourceLanguage resource string for each supported language.
- //
- // Fall back to the font of the neutral language if the Display
- // language of the phone is not supported.
- //
- // If a compiler error is hit then ResourceLanguage is missing from
- // the resource file.
- RootFrame.Language = XmlLanguage.GetLanguage(AppResources.ResourceLanguage);
-
- // Set the FlowDirection of all elements under the root frame based
- // on the ResourceFlowDirection resource string for each
- // supported language.
- //
- // If a compiler error is hit then ResourceFlowDirection is missing from
- // the resource file.
- FlowDirection flow = (FlowDirection)Enum.Parse(typeof(FlowDirection), AppResources.ResourceFlowDirection);
- RootFrame.FlowDirection = flow;
- }
- catch
- {
- // If an exception is caught here it is most likely due to either
- // ResourceLangauge not being correctly set to a supported language
- // code or ResourceFlowDirection is set to a value other than LeftToRight
- // or RightToLeft.
-
- if (Debugger.IsAttached)
- {
- Debugger.Break();
- }
-
- throw;
- }
- }
- }
-}
\ No newline at end of file
diff --git a/DropNetRT.Sample.WP8/Assets/AlignmentGrid.png b/DropNetRT.Sample.WP8/Assets/AlignmentGrid.png
deleted file mode 100644
index f7d2e97..0000000
Binary files a/DropNetRT.Sample.WP8/Assets/AlignmentGrid.png and /dev/null differ
diff --git a/DropNetRT.Sample.WP8/Assets/ApplicationIcon.png b/DropNetRT.Sample.WP8/Assets/ApplicationIcon.png
deleted file mode 100644
index 7d95d4e..0000000
Binary files a/DropNetRT.Sample.WP8/Assets/ApplicationIcon.png and /dev/null differ
diff --git a/DropNetRT.Sample.WP8/Assets/Tiles/FlipCycleTileLarge.png b/DropNetRT.Sample.WP8/Assets/Tiles/FlipCycleTileLarge.png
deleted file mode 100644
index e0c59ac..0000000
Binary files a/DropNetRT.Sample.WP8/Assets/Tiles/FlipCycleTileLarge.png and /dev/null differ
diff --git a/DropNetRT.Sample.WP8/Assets/Tiles/FlipCycleTileMedium.png b/DropNetRT.Sample.WP8/Assets/Tiles/FlipCycleTileMedium.png
deleted file mode 100644
index e93b89d..0000000
Binary files a/DropNetRT.Sample.WP8/Assets/Tiles/FlipCycleTileMedium.png and /dev/null differ
diff --git a/DropNetRT.Sample.WP8/Assets/Tiles/FlipCycleTileSmall.png b/DropNetRT.Sample.WP8/Assets/Tiles/FlipCycleTileSmall.png
deleted file mode 100644
index 550b1b5..0000000
Binary files a/DropNetRT.Sample.WP8/Assets/Tiles/FlipCycleTileSmall.png and /dev/null differ
diff --git a/DropNetRT.Sample.WP8/Assets/Tiles/IconicTileMediumLarge.png b/DropNetRT.Sample.WP8/Assets/Tiles/IconicTileMediumLarge.png
deleted file mode 100644
index 686e6b5..0000000
Binary files a/DropNetRT.Sample.WP8/Assets/Tiles/IconicTileMediumLarge.png and /dev/null differ
diff --git a/DropNetRT.Sample.WP8/Assets/Tiles/IconicTileSmall.png b/DropNetRT.Sample.WP8/Assets/Tiles/IconicTileSmall.png
deleted file mode 100644
index d4b5ede..0000000
Binary files a/DropNetRT.Sample.WP8/Assets/Tiles/IconicTileSmall.png and /dev/null differ
diff --git a/DropNetRT.Sample.WP8/ContentsPage.xaml b/DropNetRT.Sample.WP8/ContentsPage.xaml
deleted file mode 100644
index b6acb8d..0000000
--- a/DropNetRT.Sample.WP8/ContentsPage.xaml
+++ /dev/null
@@ -1,65 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/DropNetRT.Sample.WP8/ContentsPage.xaml.cs b/DropNetRT.Sample.WP8/ContentsPage.xaml.cs
deleted file mode 100644
index 6fa9c6b..0000000
--- a/DropNetRT.Sample.WP8/ContentsPage.xaml.cs
+++ /dev/null
@@ -1,74 +0,0 @@
-using DropNetRT.Models;
-using DropNetRT.Sample.WP8.Extensions;
-using DropNetRT.Sample.WP8.ViewModels;
-using Microsoft.Phone.Controls;
-using System.Windows.Navigation;
-
-namespace DropNetRT.Sample.WP8
-{
- public partial class ContentsPage : PhoneApplicationPage
- {
- private ContentsViewModel _model;
-
- public ContentsPage()
- {
- InitializeComponent();
- }
-
- protected override void OnNavigatedTo(NavigationEventArgs e)
- {
- base.OnNavigatedTo(e);
-
- _model = new ContentsViewModel(this.GetProgressIndicator(), Dispatcher);
- this.DataContext = _model;
-
- _model.LoadPath("/");
- }
-
- protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
- {
- if (_model.MetaData.Path == "/")
- {
- base.OnBackKeyPress(e);
- }
- else
- {
- var lastslash = _model.MetaData.Path.LastIndexOf("/");
- var parentPath = _model.MetaData.Path.Remove(lastslash);
- //Check if you can go up a directory
- if (string.IsNullOrEmpty(parentPath))
- {
- //root
- _model.LoadPath("/");
- e.Cancel = true;
- }
- else
- {
- _model.LoadPath(parentPath);
- e.Cancel = true;
- }
- }
- }
-
- private void lsbContents_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
- {
- if (e.AddedItems.Count > 0)
- {
- var selected = (e.AddedItems[0] as Metadata);
-
- if (selected == null) return;
-
- if (selected.IsDirectory)
- {
- //navigate to the new dir
- _model.LoadPath(selected.Path);
- }
- else
- {
- //Do something here for files
- }
- }
- }
-
- }
-}
\ No newline at end of file
diff --git a/DropNetRT.Sample.WP8/Converters/BoolToNotVisConverter.cs b/DropNetRT.Sample.WP8/Converters/BoolToNotVisConverter.cs
deleted file mode 100644
index 9796862..0000000
--- a/DropNetRT.Sample.WP8/Converters/BoolToNotVisConverter.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
-using System.Windows.Data;
-
-namespace DropNetRT.Sample.WP8.Converters
-{
- public class BoolToNotVisConverter : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- return System.Convert.ToBoolean(value) ? Visibility.Collapsed : Visibility.Visible;
- }
-
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- return value.Equals(Visibility.Visible);
- }
- }
-}
diff --git a/DropNetRT.Sample.WP8/Converters/BoolToVisConverter.cs b/DropNetRT.Sample.WP8/Converters/BoolToVisConverter.cs
deleted file mode 100644
index 4c13251..0000000
--- a/DropNetRT.Sample.WP8/Converters/BoolToVisConverter.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
-using System.Windows.Data;
-
-namespace DropNetRT.Sample.WP8.Converters
-{
- public class BoolToVisConverter : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- return System.Convert.ToBoolean(value) ? Visibility.Visible : Visibility.Collapsed;
- }
-
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- return value.Equals(Visibility.Visible);
- }
- }
-}
diff --git a/DropNetRT.Sample.WP8/Converters/DropboxIconConverter.cs b/DropNetRT.Sample.WP8/Converters/DropboxIconConverter.cs
deleted file mode 100644
index ccaa818..0000000
--- a/DropNetRT.Sample.WP8/Converters/DropboxIconConverter.cs
+++ /dev/null
@@ -1,67 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
-using System.Windows.Data;
-using System.Windows.Media.Imaging;
-
-namespace DropNetRT.Sample.WP8.Converters
-{
- public class DropboxIconConverter : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- var theme = (Visibility)Application.Current.Resources["PhoneDarkThemeVisibility"] == Visibility.Visible ? "dark" : "light";
-
- try
- {
- //Overrides
- switch (value.ToString())
- {
- case "page_white_cplusplus":
- case "page_white_csharp":
- case "page_white_actionscript":
- case "page_white_c":
- case "page_white_h":
- value = "page_white_code";
- break;
- case "folder_photos":
- value = "folder_public";
- break;
- case "page_white_zip":
- case "page_white_compressed":
- value = "page_white_new";
- break;
- case "page_white_flash":
- case "page_white_ruby":
- case "page_white_php":
- value = "page_white_visualstudio";
- break;
- }
-
- var iconpath = string.Format("/icons/{0}/{1}.png", theme, value.ToString());
-
- return new BitmapImage(new Uri(iconpath, UriKind.Relative));
- }
- catch (Exception ex)
- {
- //TODO - Default Icon
- if (value != null && value.ToString().Contains("folder"))
- {
- return new BitmapImage(new Uri(string.Format("/icons/{0}/folder.png", theme), UriKind.Relative));
- }
- else
- {
- return new BitmapImage(new Uri(string.Format("/icons/{0}/page_white.png", theme), UriKind.Relative));
- }
- }
- }
-
- public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- return string.Empty;
- }
- }
-}
diff --git a/DropNetRT.Sample.WP8/DropNetRT.Sample.WP8.csproj b/DropNetRT.Sample.WP8/DropNetRT.Sample.WP8.csproj
deleted file mode 100644
index 8760db1..0000000
--- a/DropNetRT.Sample.WP8/DropNetRT.Sample.WP8.csproj
+++ /dev/null
@@ -1,250 +0,0 @@
-
-
-
- Debug
- AnyCPU
- 10.0.20506
- 2.0
- {30BC4D5F-FF12-4EE2-8792-A00FF701302E}
- {C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
- Library
- Properties
- DropNetRTSample.WP8
- DropNetRTSample.WP8
- WindowsPhone
- v8.0
- $(TargetFrameworkVersion)
- true
-
-
- true
- true
- DropNetRTSample.WP8_Debug_AnyCPU.xap
- Properties\AppManifest.xml
- DropNetRTSample.App
- true
- 11.0
- true
- 5.0.31017.0
-
-
- true
- full
- false
- Bin\Debug
- DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE
- true
- true
- prompt
- 4
-
-
- pdbonly
- true
- Bin\Release
- TRACE;SILVERLIGHT;WINDOWS_PHONE
- true
- true
- prompt
- 4
-
-
- true
- full
- false
- Bin\x86\Debug
- DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE
- true
- true
- prompt
- 4
-
-
- pdbonly
- true
- Bin\x86\Release
- TRACE;SILVERLIGHT;WINDOWS_PHONE
- true
- true
- prompt
- 4
-
-
- true
- full
- false
- Bin\ARM\Debug
- DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE
- true
- true
- prompt
- 4
-
-
- pdbonly
- true
- Bin\ARM\Release
- TRACE;SILVERLIGHT;WINDOWS_PHONE
- true
- true
- prompt
- 4
-
-
-
- App.xaml
-
-
- ContentsPage.xaml
-
-
-
-
-
-
-
-
- MainPage.xaml
-
-
-
- True
- True
- AppResources.resx
-
-
-
-
-
-
-
- Designer
- MSBuild:Compile
-
-
- Designer
- MSBuild:Compile
-
-
- Designer
- MSBuild:Compile
-
-
-
-
-
-
-
- Designer
-
-
-
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PublicResXFileCodeGenerator
- AppResources.Designer.cs
-
-
-
-
- MSBuild:MarkupCompilePass1
-
-
-
-
- packages\DropNetRT.1.2\lib\portable-net45+sl50+win+wpa81+wp80\DropNetRT.dll
-
-
- ..\packages\Microsoft.Bcl.Async.1.0.165\lib\wp8\Microsoft.Threading.Tasks.dll
-
-
- ..\packages\Microsoft.Bcl.Async.1.0.165\lib\wp8\Microsoft.Threading.Tasks.Extensions.dll
-
-
- ..\packages\Microsoft.Bcl.Async.1.0.165\lib\wp8\Microsoft.Threading.Tasks.Extensions.Phone.dll
-
-
- ..\packages\Newtonsoft.Json.6.0.1\lib\portable-net45+wp80+win8\Newtonsoft.Json.dll
-
-
- ..\packages\Microsoft.Net.Http.2.2.18\lib\sl4-windowsphone71\System.Net.Http.dll
-
-
- ..\packages\Microsoft.Net.Http.2.2.18\lib\sl4-windowsphone71\System.Net.Http.Extensions.dll
-
-
- ..\packages\Microsoft.Net.Http.2.2.18\lib\sl4-windowsphone71\System.Net.Http.Primitives.dll
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/DropNetRT.Sample.WP8/DropNetRT.Sample.WP8.sln b/DropNetRT.Sample.WP8/DropNetRT.Sample.WP8.sln
deleted file mode 100644
index 0ab03cf..0000000
--- a/DropNetRT.Sample.WP8/DropNetRT.Sample.WP8.sln
+++ /dev/null
@@ -1,40 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2013
-VisualStudioVersion = 12.0.30501.0
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DropNetRT.Sample.WP8", "DropNetRT.Sample.WP8.csproj", "{30BC4D5F-FF12-4EE2-8792-A00FF701302E}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Debug|ARM = Debug|ARM
- Debug|x86 = Debug|x86
- Release|Any CPU = Release|Any CPU
- Release|ARM = Release|ARM
- Release|x86 = Release|x86
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {30BC4D5F-FF12-4EE2-8792-A00FF701302E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {30BC4D5F-FF12-4EE2-8792-A00FF701302E}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {30BC4D5F-FF12-4EE2-8792-A00FF701302E}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
- {30BC4D5F-FF12-4EE2-8792-A00FF701302E}.Debug|ARM.ActiveCfg = Debug|ARM
- {30BC4D5F-FF12-4EE2-8792-A00FF701302E}.Debug|ARM.Build.0 = Debug|ARM
- {30BC4D5F-FF12-4EE2-8792-A00FF701302E}.Debug|ARM.Deploy.0 = Debug|ARM
- {30BC4D5F-FF12-4EE2-8792-A00FF701302E}.Debug|x86.ActiveCfg = Debug|x86
- {30BC4D5F-FF12-4EE2-8792-A00FF701302E}.Debug|x86.Build.0 = Debug|x86
- {30BC4D5F-FF12-4EE2-8792-A00FF701302E}.Debug|x86.Deploy.0 = Debug|x86
- {30BC4D5F-FF12-4EE2-8792-A00FF701302E}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {30BC4D5F-FF12-4EE2-8792-A00FF701302E}.Release|Any CPU.Build.0 = Release|Any CPU
- {30BC4D5F-FF12-4EE2-8792-A00FF701302E}.Release|Any CPU.Deploy.0 = Release|Any CPU
- {30BC4D5F-FF12-4EE2-8792-A00FF701302E}.Release|ARM.ActiveCfg = Release|ARM
- {30BC4D5F-FF12-4EE2-8792-A00FF701302E}.Release|ARM.Build.0 = Release|ARM
- {30BC4D5F-FF12-4EE2-8792-A00FF701302E}.Release|ARM.Deploy.0 = Release|ARM
- {30BC4D5F-FF12-4EE2-8792-A00FF701302E}.Release|x86.ActiveCfg = Release|x86
- {30BC4D5F-FF12-4EE2-8792-A00FF701302E}.Release|x86.Build.0 = Release|x86
- {30BC4D5F-FF12-4EE2-8792-A00FF701302E}.Release|x86.Deploy.0 = Release|x86
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/DropNetRT.Sample.WP8/Extensions/CollectionExtensions.cs b/DropNetRT.Sample.WP8/Extensions/CollectionExtensions.cs
deleted file mode 100644
index 1bf2b68..0000000
--- a/DropNetRT.Sample.WP8/Extensions/CollectionExtensions.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace DropNetRT.Sample.WP8.Extensions
-{
- public static class CollectionExtensions
- {
- public static ObservableCollection ToObservableCollection(this IEnumerable source)
- {
- ObservableCollection result = new ObservableCollection();
-
- foreach (T item in source)
- result.Add(item);
-
- return result;
- }
- }
-}
diff --git a/DropNetRT.Sample.WP8/Extensions/PageExtensions.cs b/DropNetRT.Sample.WP8/Extensions/PageExtensions.cs
deleted file mode 100644
index 68ddad0..0000000
--- a/DropNetRT.Sample.WP8/Extensions/PageExtensions.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-using Microsoft.Phone.Controls;
-using Microsoft.Phone.Shell;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace DropNetRT.Sample.WP8.Extensions
-{
- public static class PageExtensions
- {
- public static ProgressIndicator GetProgressIndicator(this PhoneApplicationPage page)
- {
- var progressIndicator = SystemTray.ProgressIndicator;
- if (progressIndicator == null)
- {
- progressIndicator = new ProgressIndicator();
- SystemTray.SetProgressIndicator(page, progressIndicator);
- }
- return progressIndicator;
- }
- }
-}
diff --git a/DropNetRT.Sample.WP8/LocalizedStrings.cs b/DropNetRT.Sample.WP8/LocalizedStrings.cs
deleted file mode 100644
index 70a79e5..0000000
--- a/DropNetRT.Sample.WP8/LocalizedStrings.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using DropNetRT.Sample.WP8.Resources;
-
-namespace DropNetRT.Sample.WP8
-{
- ///
- /// Provides access to string resources.
- ///
- public class LocalizedStrings
- {
- private static AppResources _localizedResources = new AppResources();
-
- public AppResources LocalizedResources { get { return _localizedResources; } }
- }
-}
\ No newline at end of file
diff --git a/DropNetRT.Sample.WP8/MainPage.xaml b/DropNetRT.Sample.WP8/MainPage.xaml
deleted file mode 100644
index 28e4271..0000000
--- a/DropNetRT.Sample.WP8/MainPage.xaml
+++ /dev/null
@@ -1,79 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/DropNetRT.Sample.WP8/MainPage.xaml.cs b/DropNetRT.Sample.WP8/MainPage.xaml.cs
deleted file mode 100644
index 1a980d6..0000000
--- a/DropNetRT.Sample.WP8/MainPage.xaml.cs
+++ /dev/null
@@ -1,81 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Net;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Navigation;
-using Microsoft.Phone.Controls;
-using Microsoft.Phone.Shell;
-using DropNetRT.Sample.WP8.Resources;
-using DropNetRT.Sample.WP8.Extensions;
-using DropNetRT.Sample.WP8.ViewModels;
-
-namespace DropNetRT.Sample.WP8
-{
- public partial class MainPage : PhoneApplicationPage
- {
- //TODO - Your callback url here
- private const string _tokenCallbackUrl = "http://dkdevelopment.net/";
-
- private LoginViewModel _model;
-
- // Constructor
- public MainPage()
- {
- InitializeComponent();
-
- loginBrowser.LoadCompleted += loginBrowser_LoadCompleted;
- }
-
- protected override void OnNavigatedTo(NavigationEventArgs e)
- {
- base.OnNavigatedTo(e);
-
- //Show the splash screen
- MessageBox.Show("Welcome to the DropNet Sample App. This app demonstrates how to authenticate with the Dropbox API through DropNetRT as well as basic API functionality.");
-
- _model = new LoginViewModel(this.GetProgressIndicator(), Dispatcher);
- this.DataContext = _model;
- }
-
- private async void btnLogin_Click(object sender, System.Windows.RoutedEventArgs e)
- {
- _model.SetStatus("Loading...", true);
- _model.ShowBrowser = true;
-
- //Get the request token
- var requestToken = await App.DropNetClient.GetRequestToken();
-
- var tokenUrl = App.DropNetClient.BuildAuthorizeUrl(requestToken, _tokenCallbackUrl);
- //Open a browser with the URL
- loginBrowser.Navigate(new Uri(tokenUrl));
- }
-
- private async void loginBrowser_LoadCompleted(object sender, NavigationEventArgs e)
- {
- //check for the call back url here
- if (e.Uri.Host == "dkdevelopment.net")
- {
- //SUCCESS!
- _model.SetStatus("Getting Access Token...", true);
- var accessToken = await App.DropNetClient.GetAccessToken();
-
- //TODO - Save this token/Secret for remember me function
-
- //Set the user Token/Secret in the current instance of DropNetClient
- App.DropNetClient.SetUserToken(accessToken);
-
- _model.SetStatus("Login successful", false, 5000);
-
- NavigationService.Navigate(new Uri("/ContentsPage.xaml", UriKind.RelativeOrAbsolute));
- }
- else
- {
- //Loaded the login page
- _model.ClearStatus();
- }
- }
-
- }
-}
\ No newline at end of file
diff --git a/DropNetRT.Sample.WP8/Properties/AppManifest.xml b/DropNetRT.Sample.WP8/Properties/AppManifest.xml
deleted file mode 100644
index 6712a11..0000000
--- a/DropNetRT.Sample.WP8/Properties/AppManifest.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
diff --git a/DropNetRT.Sample.WP8/Properties/AssemblyInfo.cs b/DropNetRT.Sample.WP8/Properties/AssemblyInfo.cs
deleted file mode 100644
index d1a85c4..0000000
--- a/DropNetRT.Sample.WP8/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Resources;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("DropNetRT.Sample.WP8")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("DropNetRT.Sample.WP8")]
-[assembly: AssemblyCopyright("Copyright © 2013")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("12e3b39f-5ade-41b2-9647-e23e7dde78bc")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Revision and Build Numbers
-// by using the '*' as shown below:
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
-[assembly: NeutralResourcesLanguageAttribute("en-US")]
diff --git a/DropNetRT.Sample.WP8/Properties/WMAppManifest.xml b/DropNetRT.Sample.WP8/Properties/WMAppManifest.xml
deleted file mode 100644
index 5b3765a..0000000
--- a/DropNetRT.Sample.WP8/Properties/WMAppManifest.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
-
-
- Assets\ApplicationIcon.png
-
-
-
-
-
-
-
-
-
-
-
-
-
- Assets\Tiles\FlipCycleTileSmall.png
- 0
- Assets\Tiles\FlipCycleTileMedium.png
- DropNetRT.Sample
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/DropNetRT.Sample.WP8/Resources/AppResources.Designer.cs b/DropNetRT.Sample.WP8/Resources/AppResources.Designer.cs
deleted file mode 100644
index 0ec5962..0000000
--- a/DropNetRT.Sample.WP8/Resources/AppResources.Designer.cs
+++ /dev/null
@@ -1,108 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.18051
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace DropNetRT.Sample.WP8.Resources {
- using System;
-
-
- ///
- /// A strongly-typed resource class, for looking up localized strings, etc.
- ///
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- public class AppResources {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal AppResources() {
- }
-
- ///
- /// Returns the cached ResourceManager instance used by this class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- public static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DropNetRT.Sample.WP8.Resources.AppResources", typeof(AppResources).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- ///
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- public static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
-
- ///
- /// Looks up a localized string similar to add.
- ///
- public static string AppBarButtonText {
- get {
- return ResourceManager.GetString("AppBarButtonText", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Menu Item.
- ///
- public static string AppBarMenuItemText {
- get {
- return ResourceManager.GetString("AppBarMenuItemText", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to MY APPLICATION.
- ///
- public static string ApplicationTitle {
- get {
- return ResourceManager.GetString("ApplicationTitle", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to LeftToRight.
- ///
- public static string ResourceFlowDirection {
- get {
- return ResourceManager.GetString("ResourceFlowDirection", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to en-US.
- ///
- public static string ResourceLanguage {
- get {
- return ResourceManager.GetString("ResourceLanguage", resourceCulture);
- }
- }
- }
-}
diff --git a/DropNetRT.Sample.WP8/Resources/AppResources.resx b/DropNetRT.Sample.WP8/Resources/AppResources.resx
deleted file mode 100644
index 529a194..0000000
--- a/DropNetRT.Sample.WP8/Resources/AppResources.resx
+++ /dev/null
@@ -1,137 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- LeftToRight
- Controls the FlowDirection for all elements in the RootFrame. Set to the traditional direction of this resource file's language
-
-
- en-US
- Controls the Language and ensures that the font for all elements in the RootFrame aligns with the app's language. Set to the language code of this resource file's language.
-
-
- MY APPLICATION
-
-
- add
-
-
- Menu Item
-
-
\ No newline at end of file
diff --git a/DropNetRT.Sample.WP8/SampleData/ContentsViewModelSampleData.xaml b/DropNetRT.Sample.WP8/SampleData/ContentsViewModelSampleData.xaml
deleted file mode 100644
index 6b1a63a..0000000
--- a/DropNetRT.Sample.WP8/SampleData/ContentsViewModelSampleData.xaml
+++ /dev/null
@@ -1,582 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/DropNetRT.Sample.WP8/ViewModels/BaseViewModel.cs b/DropNetRT.Sample.WP8/ViewModels/BaseViewModel.cs
deleted file mode 100644
index 427a739..0000000
--- a/DropNetRT.Sample.WP8/ViewModels/BaseViewModel.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-using Microsoft.Phone.Shell;
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Linq;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-using System.Windows.Threading;
-
-namespace DropNetRT.Sample.WP8.ViewModels
-{
- public class BaseViewModel : INotifyPropertyChanged
- {
- private ProgressIndicator _prog;
- private Dispatcher _dispatcher;
-
- public BaseViewModel(ProgressIndicator prog, Dispatcher dispatcher)
- {
- _prog = prog;
- _dispatcher = dispatcher;
- }
-
- public event PropertyChangedEventHandler PropertyChanged;
- protected void NotifyPropertyChanged(String propertyName)
- {
- if (PropertyChanged != null)
- {
- _dispatcher.BeginInvoke(() =>
- {
- try
- {
- PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
- }
- catch { }
- });
- }
- }
- public void SetStatus(string message, bool isProgress, int? clearAfterMilliSeconds = null)
- {
- if (_prog == null) return;
-
- _dispatcher.BeginInvoke(() =>
- {
- _prog.IsIndeterminate = isProgress;
- _prog.IsVisible = true;
- _prog.Text = message;
- });
-
- if (clearAfterMilliSeconds.HasValue)
- {
- ThreadPool.QueueUserWorkItem(delegate
- {
- Thread.Sleep(clearAfterMilliSeconds.Value);
- ClearStatus();
- });
- }
- }
-
- public void ClearStatus()
- {
- if (_prog == null) return;
-
- _dispatcher.BeginInvoke(() =>
- {
- _prog.IsIndeterminate = false;
- _prog.IsVisible = false;
- _prog.Text = string.Empty;
- });
- }
- }
-}
diff --git a/DropNetRT.Sample.WP8/ViewModels/ContentsViewModel.cs b/DropNetRT.Sample.WP8/ViewModels/ContentsViewModel.cs
deleted file mode 100644
index f1b7da8..0000000
--- a/DropNetRT.Sample.WP8/ViewModels/ContentsViewModel.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-using DropNetRT.Models;
-using Microsoft.Phone.Shell;
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Threading;
-using DropNetRT.Sample.WP8.Extensions;
-
-namespace DropNetRT.Sample.WP8.ViewModels
-{
- public class ContentsViewModel : BaseViewModel
- {
- private Metadata _meta;
- public Metadata MetaData
- {
- get { return _meta; }
- set
- {
- _meta = value;
- NotifyPropertyChanged("MetaData");
- }
- }
-
- private ObservableCollection _contents;
- public ObservableCollection Contents
- {
- get { return _contents; }
- set
- {
- _contents = value;
- NotifyPropertyChanged("Contents");
- }
- }
-
- private Metadata _selectedMeta;
- public Metadata SelectedMeta
- {
- get { return _selectedMeta; }
- set
- {
- _selectedMeta = value;
- NotifyPropertyChanged("SelectedMeta");
- }
- }
-
- public ContentsViewModel(ProgressIndicator prog, Dispatcher dispatcher)
- : base(prog, dispatcher)
- {
- }
-
-
- internal async void LoadPath(string p)
- {
- //get the metadata
- var metadata = await App.DropNetClient.GetMetaData(p);
-
- //now load the viewmodel with it
- MetaData = metadata;
- Contents = metadata.Contents.ToObservableCollection();
- SelectedMeta = null;
- }
- }
-}
diff --git a/DropNetRT.Sample.WP8/ViewModels/LoginViewModel.cs b/DropNetRT.Sample.WP8/ViewModels/LoginViewModel.cs
deleted file mode 100644
index 7415361..0000000
--- a/DropNetRT.Sample.WP8/ViewModels/LoginViewModel.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using Microsoft.Phone.Shell;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Threading;
-
-namespace DropNetRT.Sample.WP8.ViewModels
-{
- public class LoginViewModel : BaseViewModel
- {
-
- private bool _showBrowser;
- public bool ShowBrowser
- {
- get { return _showBrowser; }
- set
- {
- _showBrowser = value;
- NotifyPropertyChanged("ShowBrowser");
- NotifyPropertyChanged("ShowButton");
- }
- }
- public bool ShowButton
- {
- get { return !_showBrowser; }
- }
-
- public LoginViewModel(ProgressIndicator prog, Dispatcher dispatcher)
- : base(prog, dispatcher)
- {
- }
-
- }
-}
diff --git a/DropNetRT.Sample.WP8/app.config b/DropNetRT.Sample.WP8/app.config
deleted file mode 100644
index d0c7419..0000000
--- a/DropNetRT.Sample.WP8/app.config
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/DropNetRT.Sample.WP8/icons/dark/folder.png b/DropNetRT.Sample.WP8/icons/dark/folder.png
deleted file mode 100644
index 11c7cde..0000000
Binary files a/DropNetRT.Sample.WP8/icons/dark/folder.png and /dev/null differ
diff --git a/DropNetRT.Sample.WP8/icons/dark/folder_app.png b/DropNetRT.Sample.WP8/icons/dark/folder_app.png
deleted file mode 100644
index 31e317d..0000000
Binary files a/DropNetRT.Sample.WP8/icons/dark/folder_app.png and /dev/null differ
diff --git a/DropNetRT.Sample.WP8/icons/dark/folder_gray.png b/DropNetRT.Sample.WP8/icons/dark/folder_gray.png
deleted file mode 100644
index 254932d..0000000
Binary files a/DropNetRT.Sample.WP8/icons/dark/folder_gray.png and /dev/null differ
diff --git a/DropNetRT.Sample.WP8/icons/dark/folder_public.png b/DropNetRT.Sample.WP8/icons/dark/folder_public.png
deleted file mode 100644
index 561b3c7..0000000
Binary files a/DropNetRT.Sample.WP8/icons/dark/folder_public.png and /dev/null differ
diff --git a/DropNetRT.Sample.WP8/icons/dark/folder_star.png b/DropNetRT.Sample.WP8/icons/dark/folder_star.png
deleted file mode 100644
index 31e317d..0000000
Binary files a/DropNetRT.Sample.WP8/icons/dark/folder_star.png and /dev/null differ
diff --git a/DropNetRT.Sample.WP8/icons/dark/folder_user.png b/DropNetRT.Sample.WP8/icons/dark/folder_user.png
deleted file mode 100644
index 90ca2a0..0000000
Binary files a/DropNetRT.Sample.WP8/icons/dark/folder_user.png and /dev/null differ
diff --git a/DropNetRT.Sample.WP8/icons/dark/page_white.png b/DropNetRT.Sample.WP8/icons/dark/page_white.png
deleted file mode 100644
index 105c882..0000000
Binary files a/DropNetRT.Sample.WP8/icons/dark/page_white.png and /dev/null differ
diff --git a/DropNetRT.Sample.WP8/icons/dark/page_white_acrobat.png b/DropNetRT.Sample.WP8/icons/dark/page_white_acrobat.png
deleted file mode 100644
index e9cd5a8..0000000
Binary files a/DropNetRT.Sample.WP8/icons/dark/page_white_acrobat.png and /dev/null differ
diff --git a/DropNetRT.Sample.WP8/icons/dark/page_white_code.png b/DropNetRT.Sample.WP8/icons/dark/page_white_code.png
deleted file mode 100644
index b2932b7..0000000
Binary files a/DropNetRT.Sample.WP8/icons/dark/page_white_code.png and /dev/null differ
diff --git a/DropNetRT.Sample.WP8/icons/dark/page_white_excel.png b/DropNetRT.Sample.WP8/icons/dark/page_white_excel.png
deleted file mode 100644
index 0e595cb..0000000
Binary files a/DropNetRT.Sample.WP8/icons/dark/page_white_excel.png and /dev/null differ
diff --git a/DropNetRT.Sample.WP8/icons/dark/page_white_film.png b/DropNetRT.Sample.WP8/icons/dark/page_white_film.png
deleted file mode 100644
index 3bb4a35..0000000
Binary files a/DropNetRT.Sample.WP8/icons/dark/page_white_film.png and /dev/null differ
diff --git a/DropNetRT.Sample.WP8/icons/dark/page_white_new.png b/DropNetRT.Sample.WP8/icons/dark/page_white_new.png
deleted file mode 100644
index 7c4aadf..0000000
Binary files a/DropNetRT.Sample.WP8/icons/dark/page_white_new.png and /dev/null differ
diff --git a/DropNetRT.Sample.WP8/icons/dark/page_white_picture.png b/DropNetRT.Sample.WP8/icons/dark/page_white_picture.png
deleted file mode 100644
index bde3ada..0000000
Binary files a/DropNetRT.Sample.WP8/icons/dark/page_white_picture.png and /dev/null differ
diff --git a/DropNetRT.Sample.WP8/icons/dark/page_white_powerpoint.png b/DropNetRT.Sample.WP8/icons/dark/page_white_powerpoint.png
deleted file mode 100644
index f3cb567..0000000
Binary files a/DropNetRT.Sample.WP8/icons/dark/page_white_powerpoint.png and /dev/null differ
diff --git a/DropNetRT.Sample.WP8/icons/dark/page_white_sound.png b/DropNetRT.Sample.WP8/icons/dark/page_white_sound.png
deleted file mode 100644
index 3e836de..0000000
Binary files a/DropNetRT.Sample.WP8/icons/dark/page_white_sound.png and /dev/null differ
diff --git a/DropNetRT.Sample.WP8/icons/dark/page_white_text.png b/DropNetRT.Sample.WP8/icons/dark/page_white_text.png
deleted file mode 100644
index 8d97791..0000000
Binary files a/DropNetRT.Sample.WP8/icons/dark/page_white_text.png and /dev/null differ
diff --git a/DropNetRT.Sample.WP8/icons/dark/page_white_visualstudio.png b/DropNetRT.Sample.WP8/icons/dark/page_white_visualstudio.png
deleted file mode 100644
index 42c46f6..0000000
Binary files a/DropNetRT.Sample.WP8/icons/dark/page_white_visualstudio.png and /dev/null differ
diff --git a/DropNetRT.Sample.WP8/icons/dark/page_white_word.png b/DropNetRT.Sample.WP8/icons/dark/page_white_word.png
deleted file mode 100644
index 26fc92e..0000000
Binary files a/DropNetRT.Sample.WP8/icons/dark/page_white_word.png and /dev/null differ
diff --git a/DropNetRT.Sample.WP8/icons/light/folder.png b/DropNetRT.Sample.WP8/icons/light/folder.png
deleted file mode 100644
index d3f3dec..0000000
Binary files a/DropNetRT.Sample.WP8/icons/light/folder.png and /dev/null differ
diff --git a/DropNetRT.Sample.WP8/icons/light/folder_app.png b/DropNetRT.Sample.WP8/icons/light/folder_app.png
deleted file mode 100644
index bcdee7d..0000000
Binary files a/DropNetRT.Sample.WP8/icons/light/folder_app.png and /dev/null differ
diff --git a/DropNetRT.Sample.WP8/icons/light/folder_gray.png b/DropNetRT.Sample.WP8/icons/light/folder_gray.png
deleted file mode 100644
index 4c5edde..0000000
Binary files a/DropNetRT.Sample.WP8/icons/light/folder_gray.png and /dev/null differ
diff --git a/DropNetRT.Sample.WP8/icons/light/folder_public.png b/DropNetRT.Sample.WP8/icons/light/folder_public.png
deleted file mode 100644
index ac2f2b1..0000000
Binary files a/DropNetRT.Sample.WP8/icons/light/folder_public.png and /dev/null differ
diff --git a/DropNetRT.Sample.WP8/icons/light/folder_star.png b/DropNetRT.Sample.WP8/icons/light/folder_star.png
deleted file mode 100644
index 42920cf..0000000
Binary files a/DropNetRT.Sample.WP8/icons/light/folder_star.png and /dev/null differ
diff --git a/DropNetRT.Sample.WP8/icons/light/folder_user.png b/DropNetRT.Sample.WP8/icons/light/folder_user.png
deleted file mode 100644
index e20abe8..0000000
Binary files a/DropNetRT.Sample.WP8/icons/light/folder_user.png and /dev/null differ
diff --git a/DropNetRT.Sample.WP8/icons/light/page_white.png b/DropNetRT.Sample.WP8/icons/light/page_white.png
deleted file mode 100644
index efa2fbb..0000000
Binary files a/DropNetRT.Sample.WP8/icons/light/page_white.png and /dev/null differ
diff --git a/DropNetRT.Sample.WP8/icons/light/page_white_acrobat.png b/DropNetRT.Sample.WP8/icons/light/page_white_acrobat.png
deleted file mode 100644
index b84b5c0..0000000
Binary files a/DropNetRT.Sample.WP8/icons/light/page_white_acrobat.png and /dev/null differ
diff --git a/DropNetRT.Sample.WP8/icons/light/page_white_code.png b/DropNetRT.Sample.WP8/icons/light/page_white_code.png
deleted file mode 100644
index 6b2e6ae..0000000
Binary files a/DropNetRT.Sample.WP8/icons/light/page_white_code.png and /dev/null differ
diff --git a/DropNetRT.Sample.WP8/icons/light/page_white_excel.png b/DropNetRT.Sample.WP8/icons/light/page_white_excel.png
deleted file mode 100644
index 811770f..0000000
Binary files a/DropNetRT.Sample.WP8/icons/light/page_white_excel.png and /dev/null differ
diff --git a/DropNetRT.Sample.WP8/icons/light/page_white_film.png b/DropNetRT.Sample.WP8/icons/light/page_white_film.png
deleted file mode 100644
index 2329f01..0000000
Binary files a/DropNetRT.Sample.WP8/icons/light/page_white_film.png and /dev/null differ
diff --git a/DropNetRT.Sample.WP8/icons/light/page_white_new.png b/DropNetRT.Sample.WP8/icons/light/page_white_new.png
deleted file mode 100644
index 58e9fd7..0000000
Binary files a/DropNetRT.Sample.WP8/icons/light/page_white_new.png and /dev/null differ
diff --git a/DropNetRT.Sample.WP8/icons/light/page_white_picture.png b/DropNetRT.Sample.WP8/icons/light/page_white_picture.png
deleted file mode 100644
index 7648b7e..0000000
Binary files a/DropNetRT.Sample.WP8/icons/light/page_white_picture.png and /dev/null differ
diff --git a/DropNetRT.Sample.WP8/icons/light/page_white_powerpoint.png b/DropNetRT.Sample.WP8/icons/light/page_white_powerpoint.png
deleted file mode 100644
index d7ac41e..0000000
Binary files a/DropNetRT.Sample.WP8/icons/light/page_white_powerpoint.png and /dev/null differ
diff --git a/DropNetRT.Sample.WP8/icons/light/page_white_sound.png b/DropNetRT.Sample.WP8/icons/light/page_white_sound.png
deleted file mode 100644
index 0aaff6f..0000000
Binary files a/DropNetRT.Sample.WP8/icons/light/page_white_sound.png and /dev/null differ
diff --git a/DropNetRT.Sample.WP8/icons/light/page_white_text.png b/DropNetRT.Sample.WP8/icons/light/page_white_text.png
deleted file mode 100644
index 2a5ec0d..0000000
Binary files a/DropNetRT.Sample.WP8/icons/light/page_white_text.png and /dev/null differ
diff --git a/DropNetRT.Sample.WP8/icons/light/page_white_visualstudio.png b/DropNetRT.Sample.WP8/icons/light/page_white_visualstudio.png
deleted file mode 100644
index c0e0b25..0000000
Binary files a/DropNetRT.Sample.WP8/icons/light/page_white_visualstudio.png and /dev/null differ
diff --git a/DropNetRT.Sample.WP8/icons/light/page_white_word.png b/DropNetRT.Sample.WP8/icons/light/page_white_word.png
deleted file mode 100644
index ee037e6..0000000
Binary files a/DropNetRT.Sample.WP8/icons/light/page_white_word.png and /dev/null differ
diff --git a/DropNetRT.Sample.WP8/packages.config b/DropNetRT.Sample.WP8/packages.config
deleted file mode 100644
index c11acf9..0000000
--- a/DropNetRT.Sample.WP8/packages.config
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/DropNetRT.Tests/DropNetRT.Tests.csproj b/DropNetRT.Tests/DropNetRT.Tests.csproj
index 351be8b..5490f0b 100644
--- a/DropNetRT.Tests/DropNetRT.Tests.csproj
+++ b/DropNetRT.Tests/DropNetRT.Tests.csproj
@@ -84,13 +84,6 @@
-
-
-
- This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
diff --git a/DropNetRT.sln b/DropNetRT.sln
index d1101f8..2cfd0a3 100644
--- a/DropNetRT.sln
+++ b/DropNetRT.sln
@@ -1,21 +1,18 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
-VisualStudioVersion = 12.0.30723.0
+VisualStudioVersion = 12.0.31101.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DropNetRT", "DropNetRT\DropNetRT.csproj", "{CBD8709C-B82D-44ED-8F31-963B7EED2BA9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DropNetRT.Tests", "DropNetRT.Tests\DropNetRT.Tests.csproj", "{4892A78D-0053-4C4F-A683-F1ED48DDA4A7}"
EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{7038D114-F551-4DF3-9DC7-4C0581F98E71}"
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{A86FDA1C-ADD5-4E21-9093-D9C4086A2C38}"
ProjectSection(SolutionItems) = preProject
- .nuget\NuGet.Config = .nuget\NuGet.Config
- .nuget\NuGet.exe = .nuget\NuGet.exe
- .nuget\NuGet.targets = .nuget\NuGet.targets
+ appveyor.yml = appveyor.yml
+ README.md = README.md
EndProjectSection
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DropNetRT.Sample.WP8.1", "DropNetWPTest\DropNetRT.Sample.WP8.1.csproj", "{AB756513-EE5D-40E0-9376-26CE6F6A9F1A}"
-EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -42,24 +39,6 @@ Global
{4892A78D-0053-4C4F-A683-F1ED48DDA4A7}.Release|Any CPU.Build.0 = Release|Any CPU
{4892A78D-0053-4C4F-A683-F1ED48DDA4A7}.Release|ARM.ActiveCfg = Release|Any CPU
{4892A78D-0053-4C4F-A683-F1ED48DDA4A7}.Release|x86.ActiveCfg = Release|Any CPU
- {AB756513-EE5D-40E0-9376-26CE6F6A9F1A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {AB756513-EE5D-40E0-9376-26CE6F6A9F1A}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {AB756513-EE5D-40E0-9376-26CE6F6A9F1A}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
- {AB756513-EE5D-40E0-9376-26CE6F6A9F1A}.Debug|ARM.ActiveCfg = Debug|ARM
- {AB756513-EE5D-40E0-9376-26CE6F6A9F1A}.Debug|ARM.Build.0 = Debug|ARM
- {AB756513-EE5D-40E0-9376-26CE6F6A9F1A}.Debug|ARM.Deploy.0 = Debug|ARM
- {AB756513-EE5D-40E0-9376-26CE6F6A9F1A}.Debug|x86.ActiveCfg = Debug|x86
- {AB756513-EE5D-40E0-9376-26CE6F6A9F1A}.Debug|x86.Build.0 = Debug|x86
- {AB756513-EE5D-40E0-9376-26CE6F6A9F1A}.Debug|x86.Deploy.0 = Debug|x86
- {AB756513-EE5D-40E0-9376-26CE6F6A9F1A}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {AB756513-EE5D-40E0-9376-26CE6F6A9F1A}.Release|Any CPU.Build.0 = Release|Any CPU
- {AB756513-EE5D-40E0-9376-26CE6F6A9F1A}.Release|Any CPU.Deploy.0 = Release|Any CPU
- {AB756513-EE5D-40E0-9376-26CE6F6A9F1A}.Release|ARM.ActiveCfg = Release|ARM
- {AB756513-EE5D-40E0-9376-26CE6F6A9F1A}.Release|ARM.Build.0 = Release|ARM
- {AB756513-EE5D-40E0-9376-26CE6F6A9F1A}.Release|ARM.Deploy.0 = Release|ARM
- {AB756513-EE5D-40E0-9376-26CE6F6A9F1A}.Release|x86.ActiveCfg = Release|x86
- {AB756513-EE5D-40E0-9376-26CE6F6A9F1A}.Release|x86.Build.0 = Release|x86
- {AB756513-EE5D-40E0-9376-26CE6F6A9F1A}.Release|x86.Deploy.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/DropNetRT/Client.Files.cs b/DropNetRT/Client.Files.cs
index bc8c564..00a734c 100644
--- a/DropNetRT/Client.Files.cs
+++ b/DropNetRT/Client.Files.cs
@@ -1,4 +1,5 @@
-using DropNetRT.Exceptions;
+using System.Threading;
+using DropNetRT.Exceptions;
using DropNetRT.Extensions;
using DropNetRT.HttpHelpers;
using DropNetRT.Models;
@@ -55,7 +56,22 @@ public async Task GetMetaDataWithDeleted(string path, string hash = nu
/// If true, the folder's metadata will include a contents field with a list of metadata entries for the contents of the folder. If false, the contents field will be omitted.
/// Only applicable when list is set. If this parameter is set to true, then contents will include the metadata of deleted children. Note that the target of the metadata call is always returned even when it has been deleted (with is_deleted set to true) regardless of this flag.
///
- public async Task GetMetaData(string path, string hash, int? rev, bool list, bool includeDeleted)
+ public Task GetMetaData(string path, string hash, int? rev, bool list, bool includeDeleted)
+ {
+ return GetMetaData(path, hash, rev, list, includeDeleted, null, CancellationToken.None);
+ }
+
+ ///
+ /// Gets MetaData for a file or Folder (All options)
+ ///
+ /// Path to file or folder
+ /// Each call to /metadata on a folder will return a hash field, generated by hashing all of the metadata contained in that response. On later calls to /metadata, you should provide that value via this parameter so that if nothing has changed, the response will be a 304 (Not Modified)
+ /// If you include a particular revision number, then only the metadata for that revision will be returned.
+ /// If true, the folder's metadata will include a contents field with a list of metadata entries for the contents of the folder. If false, the contents field will be omitted.
+ /// Only applicable when list is set. If this parameter is set to true, then contents will include the metadata of deleted children. Note that the target of the metadata call is always returned even when it has been deleted (with is_deleted set to true) regardless of this flag.
+ ///
+ ///
+ public async Task GetMetaData(string path, string hash, int? rev, bool list, bool includeDeleted, bool? includeMembership, CancellationToken cancellationToken)
{
var requestUrl = MakeRequestString(string.Format("1/metadata/{0}/{1}", Root, path.CleanPath()), ApiType.Base);
@@ -70,8 +86,12 @@ public async Task GetMetaData(string path, string hash, int? rev, bool
{
request.Parameters.Add(new HttpParameter("rev", rev));
}
+ if (includeMembership.HasValue)
+ {
+ request.Parameters.Add(new HttpParameter("include_membership", includeMembership.Value));
+ }
- var response = await SendAsync(request);
+ var response = await SendAsync(request, cancellationToken);
return response;
}
@@ -81,13 +101,24 @@ public async Task GetMetaData(string path, string hash, int? rev, bool
///
///
///
- public async Task GetShare(string path)
+ public Task GetShare(string path)
+ {
+ return GetShare(path, CancellationToken.None);
+ }
+
+ ///
+ /// Gets a share link from a give path
+ ///
+ ///
+ ///
+ ///
+ public async Task GetShare(string path, CancellationToken cancellationToken)
{
var requestUrl = MakeRequestString(string.Format("1/shares/{0}/{1}", Root, path.CleanPath()), ApiType.Base);
var request = new HttpRequest(HttpMethod.Get, requestUrl);
- var response = await SendAsync(request);
+ var response = await SendAsync(request, cancellationToken);
return response;
}
@@ -98,14 +129,26 @@ public async Task GetShare(string path)
///
///
///
- public async Task GetShare(string path, bool shortUrl)
+ public Task GetShare(string path, bool shortUrl)
+ {
+ return GetShare(path, shortUrl, CancellationToken.None);
+ }
+
+ ///
+ /// Gets a share link from a give path
+ ///
+ ///
+ ///
+ ///
+ ///
+ public async Task GetShare(string path, bool shortUrl, CancellationToken cancellationToken)
{
var requestUrl = MakeRequestString(string.Format("1/shares/{0}/{1}", Root, path.CleanPath()), ApiType.Base);
var request = new HttpRequest(HttpMethod.Get, requestUrl);
request.Parameters.Add(new HttpParameter("short_url", shortUrl));
- var response = await SendAsync(request);
+ var response = await SendAsync(request, cancellationToken);
return response;
}
@@ -120,20 +163,43 @@ public async Task> Search(string searchString)
return await Search(searchString, string.Empty);
}
+ ///
+ /// Searches for a given text in the entire dropbox/sandbox folder
+ ///
+ ///
+ ///
+ ///
+ public async Task> Search(string searchString, CancellationToken cancellationToken)
+ {
+ return await Search(searchString, string.Empty, cancellationToken);
+ }
+
///
/// Searches for a given text in a specified folder
///
///
///
///
- public async Task> Search(string searchString, string path)
+ public Task> Search(string searchString, string path)
+ {
+ return Search(searchString, path, CancellationToken.None);
+ }
+
+ ///
+ /// Searches for a given text in a specified folder
+ ///
+ ///
+ ///
+ ///
+ ///
+ public async Task> Search(string searchString, string path, CancellationToken cancellationToken)
{
var requestUrl = MakeRequestString(string.Format("1/search/{0}/{1}", Root, path.CleanPath()), ApiType.Base);
var request = new HttpRequest(HttpMethod.Get, requestUrl);
request.Parameters.Add(new HttpParameter("query", searchString));
- var response = await SendAsync>(request);
+ var response = await SendAsync>(request, cancellationToken);
return response;
}
@@ -143,11 +209,22 @@ public async Task> Search(string searchString, string path)
///
/// Path of the file in Dropbox to go
///
- public async Task GetFile(string path)
+ public Task GetFile(string path)
+ {
+ return GetFile(path, CancellationToken.None);
+ }
+
+ ///
+ /// Gets a file from the given path
+ ///
+ /// Path of the file in Dropbox to go
+ ///
+ ///
+ public async Task GetFile(string path, CancellationToken cancellationToken)
{
var request = MakeGetFileRequest(path);
- var response = await _httpClient.SendAsync(request);
+ var response = await _httpClient.SendAsync(request, cancellationToken);
//TODO - Error Handling
@@ -159,11 +236,22 @@ public async Task GetFile(string path)
///
/// Path of the file in Dropbox to go
///
- public async Task GetFileStream(string path)
+ public Task GetFileStream(string path)
+ {
+ return GetFileStream(path, CancellationToken.None);
+ }
+
+ ///
+ /// Gets a file stream from the given path
+ ///
+ /// Path of the file in Dropbox to go
+ ///
+ ///
+ public async Task GetFileStream(string path, CancellationToken cancellationToken)
{
var request = MakeGetFileRequest(path);
- var response = await _httpClient.SendAsync(request);
+ var response = await _httpClient.SendAsync(request, cancellationToken);
//TODO - Error Handling
@@ -196,7 +284,19 @@ public Uri GetFileUrl(string path)
///
public Uri UploadUrl(string path, string filename)
{
- var request = MakeUploadRequest(path, filename);
+ return UploadUrl(path, filename, null);
+ }
+
+ ///
+ /// Gets the upload Uri for a file (for use with Background Transfers)
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Uri UploadUrl(string path, string filename, string parentRevision)
+ {
+ var request = MakeUploadRequest(path, filename, parentRevision);
return request.RequestUri;
}
@@ -208,9 +308,36 @@ public Uri UploadUrl(string path, string filename)
///
///
///
- public async Task Upload(string path, string filename, byte[] fileData)
+ public Task Upload(string path, string filename, byte[] fileData)
+ {
+ return Upload(path, filename, fileData, CancellationToken.None);
+ }
+
+ ///
+ /// Uploads a file to a Dropbox folder
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task Upload(string path, string filename, byte[] fileData, CancellationToken cancellationToken)
{
- var request = MakeUploadRequest(path, filename);
+ return Upload(path, filename, fileData, null, cancellationToken);
+ }
+
+ ///
+ /// Uploads a file to a Dropbox folder
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public async Task Upload(string path, string filename, byte[] fileData, string parentRevision, CancellationToken cancellationToken)
+ {
+ var request = MakeUploadRequest(path, filename, parentRevision);
var content = new MultipartFormDataContent(_formBoundary);
@@ -231,7 +358,7 @@ public async Task Upload(string path, string filename, byte[] fileData
HttpResponseMessage response;
try
{
- response = await _httpClient.PostAsync(request.RequestUri, content);
+ response = await _httpClient.PostAsync(request.RequestUri, content, cancellationToken);
}
catch (Exception ex)
{
@@ -249,6 +376,17 @@ public async Task Upload(string path, string filename, byte[] fileData
return JsonConvert.DeserializeObject(responseBody);
}
+ ///
+ /// Uploads a streamed data to a Dropbox folder
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task Upload(string path, string filename, Stream stream)
+ {
+ return Upload(path, filename, stream, CancellationToken.None);
+ }
///
/// Uploads a streamed data to a Dropbox folder
@@ -256,10 +394,24 @@ public async Task Upload(string path, string filename, byte[] fileData
///
///
///
+ ///
///
- public async Task Upload(string path, string filename, Stream stream)
+ public async Task Upload(string path, string filename, Stream stream, CancellationToken cancellationToken)
{
- var request = MakeUploadPutRequest(path, filename);
+ return await Upload(path, filename, stream, null, cancellationToken);
+ }
+
+ ///
+ /// Uploads a streamed data to a Dropbox folder
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public async Task Upload(string path, string filename, Stream stream, string parentRevision, CancellationToken cancellationToken)
+ {
+ var request = MakeUploadPutRequest(path, filename, parentRevision);
var content = new StreamContent(stream);
@@ -267,7 +419,7 @@ public async Task Upload(string path, string filename, Stream stream)
try
{
- response = await _httpClient.PutAsync(request.RequestUri, content);
+ response = await _httpClient.PutAsync(request.RequestUri, content, cancellationToken);
}
catch (Exception ex)
{
@@ -285,13 +437,200 @@ public async Task Upload(string path, string filename, Stream stream)
return JsonConvert.DeserializeObject(responseBody);
}
+ private const int ChunkSize = 1024 * 1024;
+
+ private async Task UploadChunk(Stream stream, ChunkedUploadResponse lastResponse, CancellationToken cancellationToken)
+ {
+ return await UploadChunk(stream, ChunkSize, lastResponse, cancellationToken);
+ }
+
+ public async Task UploadChunk(Stream stream, int chunkSize, ChunkedUploadResponse lastResponse, CancellationToken cancellationToken)
+ {
+ if(lastResponse == null)
+ {
+ throw new ArgumentNullException("lastResponse");
+ }
+
+ var offset = lastResponse.Offset;
+ var uploadId = lastResponse.UploadId;
+
+ var request = MakeChunkedUploadPutRequest(offset, uploadId);
+
+ var buffer = new byte[chunkSize];
+
+ stream.Seek(lastResponse.Offset, SeekOrigin.Begin);
+ var contentSize = stream.Read(buffer, 0, chunkSize);
+
+ if(contentSize == 0)
+ {
+ // Nothing left to send
+ return null;
+ }
+
+ HttpContent content = new ByteArrayContent(buffer, 0, contentSize);
+
+ try
+ {
+ var response = await _httpClient.PutAsync(request.RequestUri, content, cancellationToken);
+
+ if (response.StatusCode != HttpStatusCode.OK)
+ {
+ throw new DropboxException(response);
+ }
+
+ var body = await response.Content.ReadAsStringAsync();
+ return JsonConvert.DeserializeObject(body);
+ }
+ catch (AggregateException)
+ {
+ throw;
+ }
+ catch (DropboxException)
+ {
+ throw;
+ }
+ catch (Exception ex)
+ {
+ throw new DropboxException(ex);
+ }
+ }
+
+ private async Task StartChunkedUpload(Stream stream, CancellationToken cancellationToken)
+ {
+ return await StartChunkedUpload(stream, ChunkSize, cancellationToken);
+ }
+
+ public async Task StartChunkedUpload(Stream stream, int chunkSize, CancellationToken cancellationToken)
+ {
+ var request = MakeChunkedUploadPutRequest(0);
+
+ var buffer = new byte[chunkSize];
+
+ var contentSize = stream.Read(buffer, 0, chunkSize);
+
+ HttpContent content = new ByteArrayContent(buffer, 0, contentSize);
+
+ try
+ {
+ var response = await _httpClient.PutAsync(request.RequestUri, content, cancellationToken);
+
+ if(response.StatusCode != HttpStatusCode.OK)
+ {
+ throw new DropboxException(response);
+ }
+
+ var body = await response.Content.ReadAsStringAsync();
+ return JsonConvert.DeserializeObject(body);
+ }
+ catch (AggregateException)
+ {
+ throw;
+ }
+ catch(DropboxException)
+ {
+ throw;
+ }
+ catch(Exception ex)
+ {
+ throw new DropboxException(ex);
+ }
+ }
+
+ public async Task UploadChunked(string path, string filename, Stream stream, CancellationToken cancellationToken, IProgress progress = null)
+ {
+ try
+ {
+ // Upload the initial chunk so we can get the upload_id value
+ var chunkedUploadResponse = await StartChunkedUpload(stream, cancellationToken);
+
+ if(chunkedUploadResponse == null)
+ {
+ throw new Exception("Initial chunk upload response was null.");
+ }
+
+ var uploadId = chunkedUploadResponse.UploadId;
+
+ if(progress != null)
+ {
+ progress.Report(chunkedUploadResponse.Offset);
+ }
+
+ // Keep uploading subsequent chunks until we don't have anything left to upload
+ while(chunkedUploadResponse != null)
+ {
+ chunkedUploadResponse = await UploadChunk(stream, chunkedUploadResponse, cancellationToken);
+
+ if(progress != null && chunkedUploadResponse != null)
+ {
+ progress.Report(chunkedUploadResponse.Offset);
+ }
+ }
+
+ // Commit the upload
+ return await CommitChunkedUpload(path, filename, null, uploadId, cancellationToken);
+ }
+ catch(AggregateException)
+ {
+ throw;
+ }
+ catch(DropboxException)
+ {
+ throw;
+ }
+ catch(Exception ex)
+ {
+ throw new DropboxException(ex);
+ }
+ }
+
+ public async Task CommitChunkedUpload(string path, string filename, string parentRevision, string uploadId, CancellationToken cancellationToken)
+ {
+ try
+ {
+ var commitRequest = MakeChunkedUploadCommitRequest(path, filename, parentRevision, uploadId);
+
+ var response = await _httpClient.PostAsync(commitRequest.RequestUri, null, cancellationToken);
+
+ if (response.StatusCode != HttpStatusCode.OK)
+ {
+ throw new DropboxException(response);
+ }
+
+ var responseBody = await response.Content.ReadAsStringAsync();
+
+ return JsonConvert.DeserializeObject(responseBody);
+ }
+ catch (AggregateException)
+ {
+ throw;
+ }
+ catch (DropboxException)
+ {
+ throw;
+ }
+ catch (Exception ex)
+ {
+ throw new DropboxException(ex);
+ }
+ }
///
/// Deletes the file or folder from dropbox with the given path
///
/// The Path of the file or folder to delete.
///
- public async Task Delete(string path)
+ public Task Delete(string path)
+ {
+ return Delete(path, CancellationToken.None);
+ }
+
+ ///
+ /// Deletes the file or folder from dropbox with the given path
+ ///
+ /// The Path of the file or folder to delete.
+ ///
+ ///
+ public async Task Delete(string path, CancellationToken cancellationToken)
{
var requestUrl = MakeRequestString("1/fileops/delete", ApiType.Base);
@@ -299,7 +638,7 @@ public async Task Delete(string path)
request.AddParameter("path", path);
request.AddParameter("root", Root);
- var response = await SendAsync(request);
+ var response = await SendAsync(request, cancellationToken);
return response;
}
@@ -310,7 +649,19 @@ public async Task Delete(string path)
///
///
///
- public async Task Copy(string fromPath, string toPath)
+ public Task Copy(string fromPath, string toPath)
+ {
+ return Copy(fromPath, toPath, CancellationToken.None);
+ }
+
+ ///
+ /// Copies a file or folder on Dropbox
+ ///
+ ///
+ ///
+ ///
+ ///
+ public async Task Copy(string fromPath, string toPath, CancellationToken cancellationToken)
{
var requestUrl = MakeRequestString("1/fileops/copy", ApiType.Base);
@@ -319,7 +670,7 @@ public async Task Copy(string fromPath, string toPath)
request.AddParameter("to_path", toPath);
request.AddParameter("root", Root);
- var response = await SendAsync(request);
+ var response = await SendAsync(request, cancellationToken);
return response;
}
@@ -330,7 +681,19 @@ public async Task Copy(string fromPath, string toPath)
///
///
///
- public async Task Move(string fromPath, string toPath)
+ public Task Move(string fromPath, string toPath)
+ {
+ return Move(fromPath, toPath, CancellationToken.None);
+ }
+
+ ///
+ /// Moves a file or folder on Dropbox
+ ///
+ ///
+ ///
+ ///
+ ///
+ public async Task Move(string fromPath, string toPath, CancellationToken cancellationToken)
{
var requestUrl = MakeRequestString("1/fileops/move", ApiType.Base);
@@ -339,7 +702,7 @@ public async Task Move(string fromPath, string toPath)
request.AddParameter("to_path", toPath);
request.AddParameter("root", Root);
- var response = await SendAsync(request);
+ var response = await SendAsync(request, cancellationToken);
return response;
}
@@ -349,7 +712,18 @@ public async Task Move(string fromPath, string toPath)
///
///
///
- public async Task CreateFolder(string path)
+ public Task CreateFolder(string path)
+ {
+ return CreateFolder(path, CancellationToken.None);
+ }
+
+ ///
+ /// Created a new folder with the given path
+ ///
+ ///
+ ///
+ ///
+ public async Task CreateFolder(string path, CancellationToken cancellationToken)
{
var requestUrl = MakeRequestString("1/fileops/create_folder", ApiType.Base);
@@ -357,7 +731,7 @@ public async Task CreateFolder(string path)
request.AddParameter("path", path);
request.AddParameter("root", Root);
- var response = await SendAsync(request);
+ var response = await SendAsync(request, cancellationToken);
return response;
}
@@ -368,13 +742,25 @@ public async Task CreateFolder(string path)
///
///
///
- public async Task GetMedia(string path)
+ public Task GetMedia(string path)
+ {
+ return GetMedia(path, CancellationToken.None);
+ }
+
+ ///
+ /// Returns a link directly to a file.
+ /// Similar to /shares. The difference is that this bypasses the Dropbox webserver, used to provide a preview of the file, so that you can effectively stream the contents of your media.
+ ///
+ ///
+ ///
+ ///
+ public async Task GetMedia(string path, CancellationToken cancellationToken)
{
var requestUrl = MakeRequestString(string.Format("1/media/{0}/{1}", Root, path.CleanPath()), ApiType.Base);
var request = new HttpRequest(HttpMethod.Get, requestUrl);
- var response = await SendAsync(request);
+ var response = await SendAsync(request, cancellationToken);
return response;
}
@@ -416,11 +802,23 @@ public async Task GetThumbnail(string path)
///
///
///
- public async Task GetThumbnail(string path, ThumbnailSize size)
+ public Task GetThumbnail(string path, ThumbnailSize size)
+ {
+ return GetThumbnail(path, size, CancellationToken.None);
+ }
+
+ ///
+ /// Gets the thumbnail of an image given its path
+ ///
+ ///
+ ///
+ ///
+ ///
+ public async Task GetThumbnail(string path, ThumbnailSize size, CancellationToken cancellationToken)
{
var request = MakeThumbnailRequest(path, size);
- var response = await _httpClient.SendAsync(request);
+ var response = await _httpClient.SendAsync(request, cancellationToken);
return await response.Content.ReadAsByteArrayAsync();
}
@@ -450,13 +848,23 @@ public Uri GetThumbnailUrl(string path, ThumbnailSize size)
return request.RequestUri;
}
+ ///
+ /// Gets the deltas for a user's folders and files.
+ ///
+ /// The value returned from the prior call to GetDelta or an empty string
+ ///
+ public Task GetDelta(string cursor)
+ {
+ return GetDelta(cursor, CancellationToken.None);
+ }
///
/// Gets the deltas for a user's folders and files.
///
/// The value returned from the prior call to GetDelta or an empty string
+ ///
///
- public async Task GetDelta(string cursor)
+ public async Task GetDelta(string cursor, CancellationToken cancellationToken)
{
var requestUrl = MakeRequestString("1/delta", ApiType.Base);
@@ -464,15 +872,7 @@ public async Task GetDelta(string cursor)
request.AddParameter("cursor", cursor);
- _oauthHandler.Authenticate(request);
-
- var response = await _httpClient.SendAsync(request);
-
- //TODO - Error Handling
-
- string responseBody = await response.Content.ReadAsStringAsync();
-
- var deltaResponse = JsonConvert.DeserializeObject(responseBody);
+ var deltaResponse = await SendAsync(request, cancellationToken);
var deltaPage = new DeltaPage
{
@@ -484,12 +884,47 @@ public async Task GetDelta(string cursor)
foreach (var stringList in deltaResponse.Entries)
{
- deltaPage.Entries.Add(StringListToDeltaEntry(stringList));
+ deltaPage.Entries.Add(JRawListToDeltaEntry(stringList));
}
return deltaPage;
}
+ ///
+ /// A long-poll endpoint to wait for changes on an account. In conjunction with /delta, this call gives you a low-latency way to monitor an account for file changes.
+ ///
+ /// The value returned from the prior call to GetDelta.
+ /// An optional integer indicating a timeout, in seconds.
+ /// The default value is 30 seconds, which is also the minimum allowed value. The maximum is 480 seconds.
+ ///
+ public Task GetLongpollDelta(string cursor, int timeout = 30)
+ {
+ return GetLongpollDelta(cursor, CancellationToken.None, timeout);
+ }
+ ///
+ /// A long-poll endpoint to wait for changes on an account. In conjunction with /delta, this call gives you a low-latency way to monitor an account for file changes.
+ ///
+ /// The value returned from the prior call to GetDelta.
+ ///
+ /// An optional integer indicating a timeout, in seconds.
+ /// The default value is 30 seconds, which is also the minimum allowed value. The maximum is 480 seconds.
+ ///
+ public async Task GetLongpollDelta(string cursor, CancellationToken cancellationToken, int timeout = 30)
+ {
+ var requestUrl = MakeRequestString("1/longpoll_delta", ApiType.Notify);
+
+ var request = new HttpRequest(HttpMethod.Get, requestUrl);
+
+ request.AddParameter("cursor", cursor);
+
+ if (timeout < 30)
+ timeout = 30;
+ if (timeout > 480)
+ timeout = 480;
+ request.AddParameter("timeout", timeout);
+
+ return await SendAsync(request, cancellationToken);
+ }
}
}
diff --git a/DropNetRT/Client.Helpers.cs b/DropNetRT/Client.Helpers.cs
index 120efe5..0c91717 100644
--- a/DropNetRT/Client.Helpers.cs
+++ b/DropNetRT/Client.Helpers.cs
@@ -5,6 +5,7 @@
using System;
using System.Collections.Generic;
using System.Net.Http;
+using Newtonsoft.Json.Linq;
namespace DropNetRT
{
@@ -75,7 +76,22 @@ public void SetUserToken(UserLogin userLogin)
private string MakeRequestString(string action, ApiType apiType)
{
//TODO - check for /
- return string.Format("{0}/{1}", apiType == ApiType.Base ? ApiBaseUrl : ApiContentBaseUrl, action);
+ return string.Format("{0}/{1}", GetBaseUrl(apiType), action);
+ }
+
+ private static string GetBaseUrl(ApiType apiType)
+ {
+ switch (apiType)
+ {
+ case ApiType.Base:
+ return ApiBaseUrl;
+ case ApiType.Content:
+ return ApiContentBaseUrl;
+ case ApiType.Notify:
+ return ApiNotifyBaseUrl;
+ default:
+ throw new ArgumentOutOfRangeException("apiType");
+ }
}
@@ -106,6 +122,11 @@ protected UserLogin GetUserLoginFromParams(string urlParams)
{
var userLogin = new UserLogin();
+ if (urlParams.StartsWith("?"))
+ {
+ urlParams = urlParams.Substring(1);
+ }
+
var parameters = urlParams.Split('&');
foreach (var parameter in parameters)
@@ -124,19 +145,19 @@ protected UserLogin GetUserLoginFromParams(string urlParams)
}
///
- /// Builds a DeltaEntry object from a list of string responses
+ /// Builds a DeltaEntry object from a list of JRaw responses
///
///
///
- private DeltaEntry StringListToDeltaEntry(List stringList)
+ private DeltaEntry JRawListToDeltaEntry(List stringList)
{
var deltaEntry = new DeltaEntry
{
- Path = stringList[0]
+ Path = JToken.Parse(stringList[0].ToString()).Value()
};
- if (!String.IsNullOrEmpty(stringList[1]))
+ if (!String.IsNullOrEmpty(stringList[1].ToString()))
{
- deltaEntry.MetaData = JsonConvert.DeserializeObject(stringList[1]);
+ deltaEntry.MetaData = JsonConvert.DeserializeObject(stringList[1].ToString());
}
return deltaEntry;
}
@@ -165,7 +186,7 @@ private HttpRequest MakeThumbnailRequest(string path, ThumbnailSize size)
return request;
}
- private HttpRequest MakeUploadRequest(string path, string filename)
+ private HttpRequest MakeUploadRequest(string path, string filename, string parentRevision)
{
var requestUrl = MakeRequestString(string.Format("1/files/{0}/{1}", Root, path.CleanPath()), ApiType.Content);
@@ -173,10 +194,13 @@ private HttpRequest MakeUploadRequest(string path, string filename)
_oauthHandler.Authenticate(request);
+ if (!string.IsNullOrEmpty(parentRevision))
+ request.AddParameter("parent_rev", parentRevision);
+
return request;
}
- private HttpRequest MakeUploadPutRequest(string path, string filename)
+ private HttpRequest MakeUploadPutRequest(string path, string filename, string parentRevision)
{
var requestUrl = MakeRequestString(string.Format("1/files_put/{0}/{1}/{2}", Root, path.CleanPath(), filename), ApiType.Content);
@@ -184,6 +208,43 @@ private HttpRequest MakeUploadPutRequest(string path, string filename)
_oauthHandler.Authenticate(request);
+ if (!string.IsNullOrEmpty(parentRevision))
+ request.AddParameter("parent_rev", parentRevision);
+
+ return request;
+ }
+
+ private HttpRequest MakeChunkedUploadPutRequest(long offset, string uploadId = null)
+ {
+ var requestUrl = MakeRequestString(string.Format("1/chunked_upload"), ApiType.Content);
+
+ var request = new HttpRequest(HttpMethod.Put, requestUrl);
+
+ if (!String.IsNullOrEmpty(uploadId))
+ {
+ request.AddParameter("upload_id", uploadId);
+ }
+
+ request.AddParameter("offset", offset);
+
+ _oauthHandler.Authenticate(request);
+
+ return request;
+ }
+
+ private HttpRequest MakeChunkedUploadCommitRequest(string path, string filename, string parentRevision, string uploadId)
+ {
+ var requestUrl = MakeRequestString(string.Format("1/commit_chunked_upload/auto/{0}{2}{1}", path.CleanPath(), filename, path.CleanPath().Length > 0 ? "/" : ""), ApiType.Content);
+
+ var request = new HttpRequest(HttpMethod.Post, requestUrl);
+
+ request.AddParameter("upload_id", uploadId);
+
+ if (!string.IsNullOrEmpty(parentRevision))
+ request.AddParameter("parent_rev", parentRevision);
+
+ _oauthHandler.Authenticate(request);
+
return request;
}
}
diff --git a/DropNetRT/Client.User.cs b/DropNetRT/Client.User.cs
index 7634e6d..51e6ac8 100644
--- a/DropNetRT/Client.User.cs
+++ b/DropNetRT/Client.User.cs
@@ -1,4 +1,5 @@
-using DropNetRT.HttpHelpers;
+using System.Threading;
+using DropNetRT.HttpHelpers;
using DropNetRT.Models;
using System.Net.Http;
using System.Threading.Tasks;
@@ -54,36 +55,65 @@ public async Task GetAccessToken()
return UserLogin;
}
+ ///
+ /// Gets the account info of the current logged in user
+ ///
+ ///
+ public Task AccountInfo()
+ {
+ return AccountInfo(CancellationToken.None);
+ }
///
/// Gets the account info of the current logged in user
///
///
- public async Task AccountInfo()
+ public async Task AccountInfo(CancellationToken cancellationToken)
{
var requestUrl = MakeRequestString("1/account/info", ApiType.Base);
var request = new HttpRequest(HttpMethod.Get, requestUrl);
- var response = await SendAsync(request);
+ var response = await SendAsync(request, cancellationToken);
return response;
}
+ ///
+ /// Gets the oauth2 token for current logged in user
+ ///
+ ///
+ public Task GetOAuth2Token()
+ {
+ return GetOAuth2Token(CancellationToken.None);
+ }
///
/// Gets the oauth2 token for current logged in user
///
///
- public async Task GetOAuth2Token()
+ public async Task GetOAuth2Token(CancellationToken cancellationToken)
{
var requestUrl = MakeRequestString("1/oauth2/token_from_oauth1", ApiType.Base);
var request = new HttpRequest (HttpMethod.Post, requestUrl);
- var response = await SendAsync(request);
+ var response = await SendAsync(request, cancellationToken);
return response.Token;
}
+
+ ///
+ /// Disables the access token used to authenticate the call.
+ /// This method works for OAuth 1 and OAuth 2 tokens.
+ ///
+ public async Task DisableAccessToken(CancellationToken cancellationToken)
+ {
+ var requestUrl = MakeRequestString("1/disable_access_token", ApiType.Base);
+
+ var request = new HttpRequest(HttpMethod.Post, requestUrl);
+
+ await SendAsync(request, cancellationToken);
+ }
}
}
diff --git a/DropNetRT/Client.cs b/DropNetRT/Client.cs
index 97e5a37..c111399 100644
--- a/DropNetRT/Client.cs
+++ b/DropNetRT/Client.cs
@@ -1,4 +1,5 @@
-using DropNetRT.Authentication;
+using System.Threading;
+using DropNetRT.Authentication;
using DropNetRT.Exceptions;
using DropNetRT.HttpHelpers;
using DropNetRT.Models;
@@ -15,6 +16,7 @@ public partial class DropNetClient
{
private const string ApiBaseUrl = "https://api.dropbox.com";
private const string ApiContentBaseUrl = "https://api-content.dropbox.com";
+ private const string ApiNotifyBaseUrl = "https://api-notify.dropbox.com";
///
/// Do not set this property directly, instead use SetUserToken
@@ -26,6 +28,12 @@ public partial class DropNetClient
///
public bool UseSandbox { get; set; }
+ public TimeSpan Timeout
+ {
+ get { return _httpClient.Timeout; }
+ set { _httpClient.Timeout = value; }
+ }
+
private const string SandboxRoot = "sandbox";
private const string DropboxRoot = "dropbox";
@@ -36,6 +44,8 @@ public partial class DropNetClient
private OAuthMessageHandler _oauthHandler;
private HttpClient _httpClient;
+ private IWebProxy _proxy;
+
private const string _lineBreak = "\r\n";
private const string _formBoundary = "-----------------------------28947758029299";
@@ -67,13 +77,16 @@ public DropNetClient(string apiKey, string appSecret)
/// The Api Secret to use for the Dropbox Requests
/// The User authentication token
/// The Users matching secret
- public DropNetClient(string apiKey, string apiSecret, string userToken, string userSecret)
+ /// The proxy to use for web requests
+ public DropNetClient(string apiKey, string apiSecret, string userToken, string userSecret, IWebProxy proxy = null)
{
_apiKey = apiKey;
_apisecret = apiSecret;
UserLogin = new UserLogin { Token = userToken, Secret = userSecret };
+ _proxy = proxy;
+
LoadClient();
}
@@ -85,7 +98,15 @@ private void LoadClient()
//Default to full access
UseSandbox = false;
- _httpHandler = new HttpClientHandler();
+ var handler = new HttpClientHandler();
+
+ if (_proxy != null)
+ {
+ handler.Proxy = _proxy;
+ handler.UseProxy = true;
+ }
+
+ _httpHandler = handler;
if (UserLogin != null)
{
@@ -106,7 +127,8 @@ private void LoadClient()
enum ApiType
{
Base,
- Content
+ Content,
+ Notify
}
@@ -115,8 +137,16 @@ enum ApiType
///
///
///
+ ///
///
- private async Task SendAsync(HttpRequest request) where T : class
+ private async Task SendAsync(HttpRequest request, CancellationToken cancellationToken) where T : class
+ {
+ string responseBody = await SendAsync(request, cancellationToken);
+
+ return JsonConvert.DeserializeObject(responseBody);
+ }
+
+ private async Task SendAsync(HttpRequest request, CancellationToken cancellationToken)
{
//Authenticate with oauth
_oauthHandler.Authenticate(request);
@@ -124,7 +154,16 @@ private async Task SendAsync(HttpRequest request) where T : class
HttpResponseMessage response;
try
{
- response = await _httpClient.SendAsync(request);
+ response = await _httpClient.SendAsync(request, cancellationToken);
+ }
+ catch (TaskCanceledException ex)
+ {
+ // Expiration (cancellation) of the longpoll call is a normal situation, it happens regularly if longpoll set to higher values (480 is the max) and as a part of an expected workflow. Seen from this angle it is not an 'exception'.
+ // For that reason (and the possibility of a simpler consumer code) we simulate "no changes" reply from the server in this very particular case instead of throwing a generic DropBoxException.
+ if (request.RequestUri.AbsolutePath.Contains("longpoll"))
+ return "{\"changes\" : false}";
+
+ throw new DropboxException(ex);
}
catch (Exception ex)
{
@@ -137,10 +176,7 @@ private async Task SendAsync(HttpRequest request) where T : class
throw new DropboxException(response);
}
- string responseBody = await response.Content.ReadAsStringAsync();
-
- return JsonConvert.DeserializeObject(responseBody);
+ return await response.Content.ReadAsStringAsync();
}
-
}
}
diff --git a/DropNetRT/DropNetRT.csproj b/DropNetRT/DropNetRT.csproj
index 5c09b9d..499d131 100644
--- a/DropNetRT/DropNetRT.csproj
+++ b/DropNetRT/DropNetRT.csproj
@@ -36,6 +36,8 @@
true
..\..\..\Source\
true
+
+
true
@@ -92,9 +94,11 @@
+
+
@@ -108,26 +112,33 @@
..\packages\Microsoft.Bcl.Async.1.0.168\lib\portable-net40+sl4+win8+wp71+wpa81\Microsoft.Threading.Tasks.Extensions.dll
-
- ..\packages\Newtonsoft.Json.6.0.4\lib\portable-net40+sl5+wp80+win8+wpa81\Newtonsoft.Json.dll
+
+ ..\packages\Newtonsoft.Json.8.0.2\lib\portable-net40+sl5+wp80+win8+wpa81\Newtonsoft.Json.dll
+ True
-
- ..\packages\Microsoft.Bcl.1.1.9\lib\portable-net40+sl5+win8+wp8+wpa81\System.IO.dll
+
+ ..\packages\Microsoft.Bcl.1.1.10\lib\portable-net40+sl5+win8+wp8+wpa81\System.IO.dll
+ True
-
- ..\packages\Microsoft.Net.Http.2.2.22\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.dll
+
+ ..\packages\Microsoft.Net.Http.2.2.29\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.dll
+ True
-
- ..\packages\Microsoft.Net.Http.2.2.22\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Extensions.dll
+
+ ..\packages\Microsoft.Net.Http.2.2.29\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Extensions.dll
+ True
-
- ..\packages\Microsoft.Net.Http.2.2.22\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Primitives.dll
+
+ ..\packages\Microsoft.Net.Http.2.2.29\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Primitives.dll
+ True
-
- ..\packages\Microsoft.Bcl.1.1.9\lib\portable-net40+sl5+win8+wp8+wpa81\System.Runtime.dll
+
+ ..\packages\Microsoft.Bcl.1.1.10\lib\portable-net40+sl5+win8+wp8+wpa81\System.Runtime.dll
+ True
-
- ..\packages\Microsoft.Bcl.1.1.9\lib\portable-net40+sl5+win8+wp8+wpa81\System.Threading.Tasks.dll
+
+ ..\packages\Microsoft.Bcl.1.1.10\lib\portable-net40+sl5+win8+wp8+wpa81\System.Threading.Tasks.dll
+ True
@@ -146,17 +157,12 @@
-
+
- This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
+ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
-
-
-
+
-
- {cbd8709c-b82d-44ed-8f31-963b7eed2ba9}
- DropNetRT
-
-
-
-
- App.xaml
-
-
-
-
-
-
- MainPage.xaml
-
-
-
-
-
- Designer
-
-
-
-
-
-
-
-
-
-
-
-
- MSBuild:Compile
- Designer
-
-
- MSBuild:Compile
- Designer
-
-
-
-
-
-
-
-
- ..\packages\Microsoft.Bcl.Async.1.0.168\lib\wpa81\Microsoft.Threading.Tasks.dll
-
-
- ..\packages\Microsoft.Bcl.Async.1.0.168\lib\wpa81\Microsoft.Threading.Tasks.Extensions.dll
-
-
- ..\packages\Microsoft.Net.Http.2.2.22\lib\wpa81\System.Net.Http.Extensions.dll
-
-
- ..\packages\Microsoft.Net.Http.2.2.22\lib\wpa81\System.Net.Http.Primitives.dll
-
-
-
- 12.0
-
-
- WindowsPhoneApp
-
-
-
-
-
- This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/DropNetWPTest/LoginViewModel.cs b/DropNetWPTest/LoginViewModel.cs
deleted file mode 100644
index 101af7e..0000000
--- a/DropNetWPTest/LoginViewModel.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-namespace DropNetRTWP
-{
- using Windows.UI.Core;
- using Windows.UI.Xaml.Controls;
-
- public class LoginViewModel : BaseViewModel
- {
-
- private bool showBrowser;
- public bool ShowBrowser
- {
- get { return showBrowser; }
- set
- {
- showBrowser = value;
- NotifyPropertyChanged("ShowBrowser");
- NotifyPropertyChanged("ShowButton");
- }
- }
- public bool ShowButton
- {
- get { return !showBrowser; }
- }
-
- public LoginViewModel(ProgressBar prog, CoreDispatcher dispatcher)
- : base(prog, dispatcher)
- {
- }
-
- }
-}
diff --git a/DropNetWPTest/MainPage.xaml b/DropNetWPTest/MainPage.xaml
deleted file mode 100644
index fe1214f..0000000
--- a/DropNetWPTest/MainPage.xaml
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/DropNetWPTest/MainPage.xaml.cs b/DropNetWPTest/MainPage.xaml.cs
deleted file mode 100644
index b5cd889..0000000
--- a/DropNetWPTest/MainPage.xaml.cs
+++ /dev/null
@@ -1,99 +0,0 @@
-using System;
-using Windows.UI.Xaml;
-using Windows.UI.Xaml.Controls;
-using Windows.UI.Xaml.Navigation;
-
-// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=391641
-
-namespace DropNetRTWP
-{
- using Windows.UI.Popups;
- using DropNetRT;
-
- ///
- /// An empty page that can be used on its own or navigated to within a Frame.
- ///
- public sealed partial class MainPage : Page
- {
- private const string TokenCallbackUrl = "the call back url you defined in dropbox dashboard";
- private const string ApiKey = "API_Key";
- private const string ApiSecret = "API_Secret";
- private LoginViewModel model;
- private readonly DropNetClient dropNetClient;
-
-
- public MainPage()
- {
- InitializeComponent();
-
- NavigationCacheMode = NavigationCacheMode.Required;
- dropNetClient = new DropNetClient(ApiKey, ApiSecret) {UseSandbox = true};
- }
-
- ///
- /// Invoked when this page is about to be displayed in a Frame.
- ///
- /// Event data that describes how this page was reached.
- /// This parameter is typically used to configure the page.
- protected override async void OnNavigatedTo(NavigationEventArgs e)
- {
- base.OnNavigatedTo(e);
- var message = "Welcome to the DropNet Sample App.";
- message += "This app demonstrates how to authenticate with the Dropbox API";
- message += "through DropNetRT as well as basic API functionality.";
- var msgDialog = new MessageDialog(message);
- await msgDialog.ShowAsync();
-
-
- model = new LoginViewModel(prgBar, Dispatcher);
- DataContext = model;
- }
-
- private async void btnLogin_Click(object sender, RoutedEventArgs e)
- {
- model.SetStatus("Loading...", true, 1000);
- model.ShowBrowser = true;
-
- //Get the request token
- var requestToken = await dropNetClient.GetRequestToken();
-
- var tokenUrl = dropNetClient.BuildAuthorizeUrl(requestToken, TokenCallbackUrl);
-
- loginBrowser.Navigate(new Uri(tokenUrl));
- }
-
-
- private async void loginBrowser_NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
- {
- //check for the call back url here
- if (args.Uri.Host == "cmatskas.com")
- {
- //SUCCESS!
- model.SetStatus("Getting Access Token...", true, 1000);
- var accessToken = await dropNetClient.GetAccessToken();
-
- //TODO - Save this token/Secret for remember me function
-
- //Set the user Token/Secret in the current instance of DropNetClient
- dropNetClient.SetUserToken(accessToken);
-
-
- // Upload a file
-
- /* var testString = "hello world";
- var testData = new byte[testString.Length * sizeof(char)];
- Buffer.BlockCopy(testString.ToCharArray(), 0, testData, 0, testData.Length);
- await dropNetClient.Upload(@"/", "testfile.txt", testData);
-
- */
- model.SetStatus("Login successful", false, 5000);
-
- }
- else
- {
- //Loaded the login page
- await model.ClearStatus();
- }
- }
- }
-}
diff --git a/DropNetWPTest/Package.appxmanifest b/DropNetWPTest/Package.appxmanifest
deleted file mode 100644
index 5b09157..0000000
--- a/DropNetWPTest/Package.appxmanifest
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
-
-
-
-
-
- DropNetRTWP
- christos.matskas
- Assets\StoreLogo.png
-
-
-
- 6.3.1
- 6.3.1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/DropNetWPTest/Properties/AssemblyInfo.cs b/DropNetWPTest/Properties/AssemblyInfo.cs
deleted file mode 100644
index e18a275..0000000
--- a/DropNetWPTest/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("DropNetRT.Samples.WP8.1")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("DropNetRTWP")]
-[assembly: AssemblyCopyright("Copyright © 2014")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
-[assembly: ComVisible(false)]
\ No newline at end of file
diff --git a/DropNetWPTest/app.config b/DropNetWPTest/app.config
deleted file mode 100644
index 95c3292..0000000
--- a/DropNetWPTest/app.config
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/DropNetWPTest/packages.config b/DropNetWPTest/packages.config
deleted file mode 100644
index 5aad487..0000000
--- a/DropNetWPTest/packages.config
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/README.md b/README.md
index 7857529..fcaa9d2 100644
--- a/README.md
+++ b/README.md
@@ -2,3 +2,7 @@ DropNetRT
========
Portable .NET library for the Dropbox API built on HttpClient
+
+Full documentation here: http://dropnet.github.io/dropnetrt.html
+
+[](https://ci.appveyor.com/project/dkarzon/dropnetrt/branch/master)
diff --git a/appveyor.yml b/appveyor.yml
new file mode 100644
index 0000000..20ffe9a
--- /dev/null
+++ b/appveyor.yml
@@ -0,0 +1,19 @@
+version: 1.5.{build}
+
+configuration: Release
+test: off
+build:
+ project: DropNetRT.sln
+ publish_nuget: true
+ publish_nuget_symbols: true
+
+assembly_info:
+ patch: true
+ file: AssemblyInfo.*
+ assembly_version: "{version}"
+ assembly_file_version: "{version}"
+ assembly_informational_version: "{version}"
+
+
+# scripts to run before build
+before_build: nuget restore
\ No newline at end of file