diff --git a/.gitignore b/.gitignore index c562d42..a98fb5a 100644 --- a/.gitignore +++ b/.gitignore @@ -109,3 +109,6 @@ Backup*/ UpgradeLog*.XML .DS_Store + +/packages +/DropNetRT.Sample.WP8/packages diff --git a/DropNet2.sln b/DropNet2.sln deleted file mode 100644 index 0e181cd..0000000 --- a/DropNet2.sln +++ /dev/null @@ -1,58 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DropNet2", "DropNet2\DropNet2.csproj", "{CBD8709C-B82D-44ED-8F31-963B7EED2BA9}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DropNet2Sample", "DropNet2Sample\DropNet2Sample.csproj", "{30BC4D5F-FF12-4EE2-8792-A00FF701302E}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DropNet2Tests", "DropNet2Tests\DropNet2Tests.csproj", "{4892A78D-0053-4C4F-A683-F1ED48DDA4A7}" -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 - {CBD8709C-B82D-44ED-8F31-963B7EED2BA9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CBD8709C-B82D-44ED-8F31-963B7EED2BA9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CBD8709C-B82D-44ED-8F31-963B7EED2BA9}.Debug|ARM.ActiveCfg = Debug|Any CPU - {CBD8709C-B82D-44ED-8F31-963B7EED2BA9}.Debug|x86.ActiveCfg = Debug|Any CPU - {CBD8709C-B82D-44ED-8F31-963B7EED2BA9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CBD8709C-B82D-44ED-8F31-963B7EED2BA9}.Release|Any CPU.Build.0 = Release|Any CPU - {CBD8709C-B82D-44ED-8F31-963B7EED2BA9}.Release|ARM.ActiveCfg = Release|Any CPU - {CBD8709C-B82D-44ED-8F31-963B7EED2BA9}.Release|x86.ActiveCfg = Release|Any CPU - {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 - {4892A78D-0053-4C4F-A683-F1ED48DDA4A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4892A78D-0053-4C4F-A683-F1ED48DDA4A7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4892A78D-0053-4C4F-A683-F1ED48DDA4A7}.Debug|ARM.ActiveCfg = Debug|Any CPU - {4892A78D-0053-4C4F-A683-F1ED48DDA4A7}.Debug|x86.ActiveCfg = Debug|Any CPU - {4892A78D-0053-4C4F-A683-F1ED48DDA4A7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {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 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/DropNet2/Client.Files.cs b/DropNet2/Client.Files.cs deleted file mode 100644 index 33c0be5..0000000 --- a/DropNet2/Client.Files.cs +++ /dev/null @@ -1,363 +0,0 @@ -using DropNet2.Exceptions; -using DropNet2.HttpHelpers; -using DropNet2.Models; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.IO; -using System.Net; -using System.Net.Http; -using System.Net.Http.Headers; -using System.Threading.Tasks; - -namespace DropNet2 -{ - public partial class DropNetClient - { - - /// - /// Gets MetaData for a file or folder given the path - /// - /// Path to file or folder - /// for a file or folder - public async Task GetMetaData(string path) - { - var requestUrl = MakeRequestString(string.Format("1/metadata/{0}{1}", Root, path), ApiType.Base); - - var request = new HttpRequest(HttpMethod.Get, requestUrl); - - var response = await SendAsync(request); - - return response; - } - - /// - /// Gets a share link from a give path - /// - /// - /// - public async Task GetShare(string path) - { - var requestUrl = MakeRequestString(string.Format("1/shares/{0}{1}", Root, path), ApiType.Base); - - var request = new HttpRequest(HttpMethod.Get, requestUrl); - - var response = await SendAsync(request); - - return response; - } - - /// - /// Searches for a given text in the entire dropbox/sandbox folder - /// - /// - /// - public async Task> Search(string searchString) - { - return await Search(searchString, string.Empty); - } - - /// - /// Searches for a given text in a specified folder - /// - /// - /// - /// - public async Task> Search(string searchString, string path) - { - var requestUrl = MakeRequestString(string.Format("1/search/{0}{1}", Root, path), ApiType.Base); - - var request = new HttpRequest(HttpMethod.Get, requestUrl); - request.Parameters.Add(new HttpParameter("query", searchString)); - - var response = await SendAsync>(request); - - return response; - } - - /// - /// Gets a file from the given path - /// - /// - /// - public async Task GetFile(string path) - { - var requestUrl = MakeRequestString(string.Format("1/files/{0}{1}", Root, path), ApiType.Content); - - var request = new HttpRequest(HttpMethod.Get, requestUrl); - - _oauthHandler.Authenticate(request); - - var response = await _httpClient.SendAsync(request); - - //TODO - Error Handling - - return await response.Content.ReadAsByteArrayAsync(); - } - - - /// - /// Uploads a file to a Dropbox folder - /// - /// - /// - /// - /// - public async Task Upload(string path, string filename, byte[] fileData) - { - var requestUrl = MakeRequestString(string.Format("1/files/{0}{1}", Root, path), ApiType.Content); - - var request = new HttpRequest(HttpMethod.Post, requestUrl); - - _oauthHandler.Authenticate(request); - - var content = new MultipartFormDataContent(_formBoundary); - - foreach (var parm in request.Parameters) - { - content.Add(new StringContent(parm.Value.ToString()), parm.Name); - } - - var fileContent = new ByteArrayContent(fileData); - fileContent.Headers.ContentDisposition = new ContentDispositionHeaderValue("file") - { - FileName = filename, - Name = "file" - }; - fileContent.Headers.Add("Content-Type", "application/octet-stream"); - content.Add(fileContent); - - HttpResponseMessage response; - try - { - response = await _httpClient.PostAsync(requestUrl, content); - } - catch (Exception ex) - { - throw new DropboxException(ex); - } - - //TODO - More Error Handling - if (response.StatusCode != HttpStatusCode.OK) - { - throw new DropboxException(response); - } - - string responseBody = await response.Content.ReadAsStringAsync(); - - return JsonConvert.DeserializeObject(responseBody); - } - - - /// - /// Uploads a file to a Dropbox folder - /// - /// - /// - /// - /// - public async Task Upload(string path, string filename, Stream fileStream) - { - var rawBytes = ReadFully(fileStream); - return await Upload(path, filename, rawBytes); - } - - private byte[] ReadFully(Stream input) - { - using (MemoryStream ms = new MemoryStream()) - { - input.CopyTo(ms); - return ms.ToArray(); - } - } - - - /// - /// 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) - { - var requestUrl = MakeRequestString("1/fileops/delete", ApiType.Base); - - var request = new HttpRequest(HttpMethod.Get, requestUrl); - request.AddParameter("path", path); - request.AddParameter("root", Root); - - var response = await SendAsync(request); - - return response; - } - - /// - /// Copies a file or folder on Dropbox - /// - /// - /// - /// - public async Task Copy(string fromPath, string toPath) - { - var requestUrl = MakeRequestString("1/fileops/copy", ApiType.Base); - - var request = new HttpRequest(HttpMethod.Get, requestUrl); - request.AddParameter("from_path", fromPath); - request.AddParameter("to_path", toPath); - request.AddParameter("root", Root); - - var response = await SendAsync(request); - - return response; - } - - /// - /// Moves a file or folder on Dropbox - /// - /// - /// - /// - public async Task Move(string fromPath, string toPath) - { - var requestUrl = MakeRequestString("1/fileops/move", ApiType.Base); - - var request = new HttpRequest(HttpMethod.Get, requestUrl); - request.AddParameter("from_path", fromPath); - request.AddParameter("to_path", toPath); - request.AddParameter("root", Root); - - var response = await SendAsync(request); - - return response; - } - - /// - /// Created a new folder with the given path - /// - /// - /// - public async Task CreateFolder(string path) - { - var requestUrl = MakeRequestString("1/fileops/create_folder", ApiType.Base); - - var request = new HttpRequest(HttpMethod.Get, requestUrl); - request.AddParameter("path", path); - request.AddParameter("root", Root); - - var response = await SendAsync(request); - - return response; - } - - /// - /// 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) - { - var requestUrl = MakeRequestString(string.Format("1/media/{0}{1}", Root, path), ApiType.Base); - - var request = new HttpRequest(HttpMethod.Get, requestUrl); - - var response = await SendAsync(request); - - return response; - } - - /// - /// Gets the thumbnail of an image given its MetaData - /// - /// - /// - public async Task GetThumbnail(MetaData file) - { - return await GetThumbnail(file.Path, ThumbnailSize.Small); - } - - /// - /// Gets the thumbnail of an image given its MetaData - /// - /// - /// - /// - public async Task GetThumbnail(MetaData file, ThumbnailSize size) - { - return await GetThumbnail(file.Path, size); - } - - /// - /// Gets the thumbnail of an image given its path - /// - /// - /// - public async Task GetThumbnail(string path) - { - return await GetThumbnail(path, ThumbnailSize.Small); - } - - /// - /// Gets the thumbnail of an image given its path - /// - /// - /// - /// - public async Task GetThumbnail(string path, ThumbnailSize size) - { - var requestUrl = MakeRequestString(string.Format("1/thumbnails/{0}{1}", Root, path), ApiType.Content); - - var request = new HttpRequest(HttpMethod.Get, requestUrl); - request.AddParameter("size", ThumbnailSizeString(size)); - - _oauthHandler.Authenticate(request); - - var response = await _httpClient.SendAsync(request); - - //TODO - Error Handling - - return await response.Content.ReadAsByteArrayAsync(); - } - - - /// - /// 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) - { - var requestUrl = MakeRequestString("1/delta", ApiType.Base); - - var request = new HttpRequest(HttpMethod.Post, requestUrl); - - 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 deltaPage = new DeltaPage - { - Cursor = deltaResponse.Cursor, - Has_More = deltaResponse.Has_More, - Reset = deltaResponse.Reset, - Entries = new List() - }; - - foreach (var stringList in deltaResponse.Entries) - { - deltaPage.Entries.Add(StringListToDeltaEntry(stringList)); - } - - return deltaPage; - } - - - } -} diff --git a/DropNet2/Client.Helpers.cs b/DropNet2/Client.Helpers.cs deleted file mode 100644 index aadd727..0000000 --- a/DropNet2/Client.Helpers.cs +++ /dev/null @@ -1,134 +0,0 @@ -using DropNet2.Models; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; - -namespace DropNet2 -{ - public partial class DropNetClient - { - /// - /// Converts the ThumbnailSize enum to the string equivalent for the API - /// - /// - /// - private string ThumbnailSizeString(ThumbnailSize size) - { - switch (size) - { - case ThumbnailSize.Small: - return "small"; - case ThumbnailSize.Medium: - return "medium"; - case ThumbnailSize.Large: - return "large"; - case ThumbnailSize.ExtraLarge: - return "l"; - case ThumbnailSize.ExtraLarge2: - return "xl"; - } - return "s"; - } - - /// - /// Sets a UserLogin (Token and Secret) for the current client - /// - /// - /// - public void SetUserToken(string userToken, string userSecret) - { - SetUserToken(new UserLogin { Token = userToken, Secret = userSecret }); - } - - /// - /// Sets a UserLogin (Token and Secret) for the current client - /// - /// - public void SetUserToken(UserLogin userLogin) - { - UserLogin = userLogin; - - if (_oauthHandler != null) //not sure when this would ever be null - { - _oauthHandler.UserToken = userLogin.Token; - _oauthHandler.UserSecret = userLogin.Secret; - } - } - - /// - /// Internal method to build the full request Url - /// - /// - /// - /// - private string MakeRequestString(string action, ApiType apiType) - { - //TODO - check for / - return string.Format("{0}/{1}", apiType == ApiType.Base ? ApiBaseUrl : ApiContentBaseUrl, action); - } - - - /// - /// Gets an authorize url for the current UserLogin (after getting a Request Token) - /// - /// - /// - /// - public string BuildAuthorizeUrl(UserLogin userLogin, string callback = null) - { - if (userLogin == null) - { - throw new ArgumentNullException("userLogin"); - } - - //Go 1-Liner! - return string.Format("https://www.dropbox.com/1/oauth/authorize?oauth_token={0}{1}", userLogin.Token, - (string.IsNullOrEmpty(callback) ? string.Empty : "&oauth_callback=" + callback)); - } - - /// - /// Reads the auth response parameters and creates a UserLogin object from it - /// - /// - /// - private UserLogin GetUserLoginFromParams(string urlParams) - { - var userLogin = new UserLogin(); - - var parameters = urlParams.Split('&'); - - foreach (var parameter in parameters) - { - if (parameter.Split('=')[0] == "oauth_token_secret") - { - userLogin.Secret = parameter.Split('=')[1]; - } - else if (parameter.Split('=')[0] == "oauth_token") - { - userLogin.Token = parameter.Split('=')[1]; - } - } - - return userLogin; - } - - /// - /// Builds a DeltaEntry object from a list of string responses - /// - /// - /// - private DeltaEntry StringListToDeltaEntry(List stringList) - { - var deltaEntry = new DeltaEntry - { - Path = stringList[0] - }; - if (!String.IsNullOrEmpty(stringList[1])) - { - deltaEntry.MetaData = JsonConvert.DeserializeObject(stringList[1]); - } - return deltaEntry; - } - - } -} diff --git a/DropNet2/DropNet2.csproj b/DropNet2/DropNet2.csproj deleted file mode 100644 index b8c0f88..0000000 --- a/DropNet2/DropNet2.csproj +++ /dev/null @@ -1,99 +0,0 @@ - - - - - 10.0 - Debug - AnyCPU - {CBD8709C-B82D-44ED-8F31-963B7EED2BA9} - Library - Properties - DropNet2 - DropNet2 - v4.0 - Profile104 - 512 - {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ..\packages\Microsoft.Bcl.Async.1.0.14-rc\lib\portable-net40+sl4+win8+wp71\Microsoft.Threading.Tasks.dll - - - ..\packages\Microsoft.Bcl.Async.1.0.14-rc\lib\portable-net40+sl4+win8+wp71\Microsoft.Threading.Tasks.Extensions.dll - - - ..\packages\Newtonsoft.Json.4.5.11\lib\portable-net40+sl4+wp7+win8\Newtonsoft.Json.dll - - - ..\packages\Microsoft.Net.Http.2.1.3-beta\lib\portable-net40+sl4+win8+wp71\System.Net.Http.dll - - - ..\packages\Microsoft.Net.Http.2.1.3-beta\lib\portable-net40+sl4+win8+wp71\System.Net.Http.Extensions.dll - - - ..\packages\Microsoft.Net.Http.2.1.3-beta\lib\portable-net40+sl4+win8+wp71\System.Net.Http.Primitives.dll - - - ..\packages\Microsoft.Bcl.1.0.16-rc\lib\portable-net40+sl4+win8+wp71\System.Runtime.dll - - - ..\packages\Microsoft.Bcl.1.0.16-rc\lib\portable-net40+sl4+win8+wp71\System.Threading.Tasks.dll - - - - - - - - - - \ No newline at end of file diff --git a/DropNet2/app.config b/DropNet2/app.config deleted file mode 100644 index f356f9b..0000000 --- a/DropNet2/app.config +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/DropNet2/packages.config b/DropNet2/packages.config deleted file mode 100644 index 818e413..0000000 --- a/DropNet2/packages.config +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/DropNet2Sample/App.xaml b/DropNet2Sample/App.xaml deleted file mode 100644 index db202de..0000000 --- a/DropNet2Sample/App.xaml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/DropNet2Sample/App.xaml.cs b/DropNet2Sample/App.xaml.cs deleted file mode 100644 index 67d7811..0000000 --- a/DropNet2Sample/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 DropNet2Sample.Resources; - -namespace DropNet2Sample -{ - public partial class App : Application - { - public static DropNet2.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 DropNet2.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/DropNet2Sample/Assets/AlignmentGrid.png b/DropNet2Sample/Assets/AlignmentGrid.png deleted file mode 100644 index f7d2e97..0000000 Binary files a/DropNet2Sample/Assets/AlignmentGrid.png and /dev/null differ diff --git a/DropNet2Sample/Assets/ApplicationIcon.png b/DropNet2Sample/Assets/ApplicationIcon.png deleted file mode 100644 index 7d95d4e..0000000 Binary files a/DropNet2Sample/Assets/ApplicationIcon.png and /dev/null differ diff --git a/DropNet2Sample/Assets/Tiles/FlipCycleTileLarge.png b/DropNet2Sample/Assets/Tiles/FlipCycleTileLarge.png deleted file mode 100644 index e0c59ac..0000000 Binary files a/DropNet2Sample/Assets/Tiles/FlipCycleTileLarge.png and /dev/null differ diff --git a/DropNet2Sample/Assets/Tiles/FlipCycleTileMedium.png b/DropNet2Sample/Assets/Tiles/FlipCycleTileMedium.png deleted file mode 100644 index e93b89d..0000000 Binary files a/DropNet2Sample/Assets/Tiles/FlipCycleTileMedium.png and /dev/null differ diff --git a/DropNet2Sample/Assets/Tiles/FlipCycleTileSmall.png b/DropNet2Sample/Assets/Tiles/FlipCycleTileSmall.png deleted file mode 100644 index 550b1b5..0000000 Binary files a/DropNet2Sample/Assets/Tiles/FlipCycleTileSmall.png and /dev/null differ diff --git a/DropNet2Sample/Assets/Tiles/IconicTileMediumLarge.png b/DropNet2Sample/Assets/Tiles/IconicTileMediumLarge.png deleted file mode 100644 index 686e6b5..0000000 Binary files a/DropNet2Sample/Assets/Tiles/IconicTileMediumLarge.png and /dev/null differ diff --git a/DropNet2Sample/Assets/Tiles/IconicTileSmall.png b/DropNet2Sample/Assets/Tiles/IconicTileSmall.png deleted file mode 100644 index d4b5ede..0000000 Binary files a/DropNet2Sample/Assets/Tiles/IconicTileSmall.png and /dev/null differ diff --git a/DropNet2Sample/ContentsPage.xaml b/DropNet2Sample/ContentsPage.xaml deleted file mode 100644 index 9bd967e..0000000 --- a/DropNet2Sample/ContentsPage.xaml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/DropNet2Sample/ContentsPage.xaml.cs b/DropNet2Sample/ContentsPage.xaml.cs deleted file mode 100644 index a9ffa9f..0000000 --- a/DropNet2Sample/ContentsPage.xaml.cs +++ /dev/null @@ -1,74 +0,0 @@ -using DropNet2.Models; -using DropNet2Sample.Extensions; -using DropNet2Sample.ViewModels; -using Microsoft.Phone.Controls; -using System.Windows.Navigation; - -namespace DropNet2Sample -{ - 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.Is_Dir) - { - //navigate to the new dir - _model.LoadPath(selected.Path); - } - else - { - //Do something here for files - } - } - } - - } -} \ No newline at end of file diff --git a/DropNet2Sample/Converters/BoolToNotVisConverter.cs b/DropNet2Sample/Converters/BoolToNotVisConverter.cs deleted file mode 100644 index b4a76e4..0000000 --- a/DropNet2Sample/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 DropNet2Sample.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/DropNet2Sample/Converters/BoolToVisConverter.cs b/DropNet2Sample/Converters/BoolToVisConverter.cs deleted file mode 100644 index dc9259c..0000000 --- a/DropNet2Sample/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 DropNet2Sample.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/DropNet2Sample/Converters/DropboxIconConverter.cs b/DropNet2Sample/Converters/DropboxIconConverter.cs deleted file mode 100644 index d956f2c..0000000 --- a/DropNet2Sample/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 DropNet2Sample.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/DropNet2Sample/DropNet2Sample.csproj b/DropNet2Sample/DropNet2Sample.csproj deleted file mode 100644 index 38d0651..0000000 --- a/DropNet2Sample/DropNet2Sample.csproj +++ /dev/null @@ -1,223 +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 - DropNet2Sample - DropNet2Sample - WindowsPhone - v8.0 - $(TargetFrameworkVersion) - true - - - true - true - DropNet2Sample_$(Configuration)_$(Platform).xap - Properties\AppManifest.xml - DropNet2Sample.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 - - - - - {CBD8709C-B82D-44ED-8F31-963B7EED2BA9} - DropNet2 - - - - - MSBuild:MarkupCompilePass1 - - - - - - - \ No newline at end of file diff --git a/DropNet2Sample/Extensions/CollectionExtensions.cs b/DropNet2Sample/Extensions/CollectionExtensions.cs deleted file mode 100644 index 73208f9..0000000 --- a/DropNet2Sample/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 DropNet2Sample.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/DropNet2Sample/Extensions/PageExtensions.cs b/DropNet2Sample/Extensions/PageExtensions.cs deleted file mode 100644 index 1f5e96e..0000000 --- a/DropNet2Sample/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 DropNet2Sample.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/DropNet2Sample/LocalizedStrings.cs b/DropNet2Sample/LocalizedStrings.cs deleted file mode 100644 index 4191574..0000000 --- a/DropNet2Sample/LocalizedStrings.cs +++ /dev/null @@ -1,14 +0,0 @@ -using DropNet2Sample.Resources; - -namespace DropNet2Sample -{ - /// - /// 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/DropNet2Sample/MainPage.xaml b/DropNet2Sample/MainPage.xaml deleted file mode 100644 index f94a73e..0000000 --- a/DropNet2Sample/MainPage.xaml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - -