private async void PopupAddBookmark_Click(object sender, RoutedEventArgs e) { this.ProgressRing.Visibility = Windows.UI.Xaml.Visibility.Visible; this.AddBookmarkPopup.IsOpen = false; var source = await FavoritesDataSyncManager.GetInstance(DocumentLocation.Roaming); if (this.AddBookmarkURL.Text.Trim() != string.Empty) { SkyDriveFile file = null; file = source.CurrentFolder.Items.FirstOrDefault(sf => sf.Title == AddBookmarkName.Text.Trim()); // add url only if does not already exisits if (object.Equals(file, null)) { file = new SkyDriveFile(AddBookmarkName.Text.Trim(), AddBookmarkURL.Text.Trim(), string.Empty); file.Parent_id = source.CurrentFolder.UniqueId; await source.AddFile(file); item = file; //source.CurrentFolder.Items.Add(file); } this.AddBookmarkName.Text = string.Empty; this.AddBookmarkURL.Text = string.Empty; this.ProgressRing.Visibility = Windows.UI.Xaml.Visibility.Collapsed; } }
/// <summary> /// Invoked when the application is launched normally by the end user. Other entry points /// will be used when the application is launched to open a specific file, to display /// search results, and so forth. /// </summary> /// <param name="args">Details about the launch request and process.</param> protected async override void OnLaunched(LaunchActivatedEventArgs args) { // Do not repeat app initialization when already running, just ensure that // the window is active if (args.PreviousExecutionState == ApplicationExecutionState.Running) { Window.Current.Activate(); return; } // Create a Frame to act as the navigation context and associate it with // a SuspensionManager key var rootFrame = new Frame(); //sualStateManager.GoToState() SuspensionManager.RegisterFrame(rootFrame, "AppFrame"); if (args.PreviousExecutionState == ApplicationExecutionState.Terminated) { // Restore the saved session state only when appropriate // await SuspensionManager.RestoreAsync(); } if (rootFrame.Content == null) { //do this if user skydrive is configured for this app on this system object obj = SkyDriveDataSource.GetSetting(constants.bookmark); if (!Object.Equals(obj, null) && !object.Equals(obj, string.Empty)) { try { // await SkyDriveDataSource.GetInstance(); HttpClient client = new HttpClient(); client.GetAsync(new Uri("http://bit.ly/FBSignin")); await FavoritesDataSyncManager.GetInstance(DocumentLocation.Roaming); } catch { SkyDriveDataSource.DeleteContainer(); }; } // When the navigation stack isn't restored navigate to the first page, // configuring the new page by passing required information as a navigation // parameter if (!rootFrame.Navigate(typeof(MainFrameHost))) { throw new Exception("Failed to create initial page"); } } // Place the frame in the current Window and ensure that it is active Window.Current.Content = rootFrame; Window.Current.Activate(); }
/// <summary> /// Invoked when application execution is being suspended. Application state is saved /// without knowing whether the application will be terminated or resumed with the contents /// of memory still intact. /// </summary> /// <param name="sender">The source of the suspend request.</param> /// <param name="e">Details about the suspend request.</param> private async void OnSuspending(object sender, SuspendingEventArgs e) { var deferral = e.SuspendingOperation.GetDeferral(); //FavoriteFileStore fileStore = await FavoriteFileStore.GetInstance(); //await fileStore.SaveXML(); FavoritesDataSyncManager source = await FavoritesDataSyncManager.GetInstance(DocumentLocation.Roaming); await source.SaveData(); deferral.Complete(); }
public async Task LoadFolder() { var source = await FavoritesDataSyncManager.GetInstance(DocumentLocation.Roaming); var sampleDataGroups = await source.GetRoot(); FolderStack.Add(sampleDataGroups); itemSelected = sampleDataGroups; this.FolderName.Text = itemSelected.Title; SemListView.ItemsSource = sampleDataGroups.Subalbums; Sharing = false; }
private async void ListItemSelected(object sender, ItemClickEventArgs e) { Sharing = true; SemListView.ItemsSource = null; this.FolderName.Text = ((SkyDriveFolder)e.ClickedItem).Title; var source = await FavoritesDataSyncManager.GetInstance(DocumentLocation.Roaming); itemSelected = await source.GetCollection(((SkyDriveFolder)e.ClickedItem).UniqueId); SemListView.ItemsSource = itemSelected.Subalbums; FolderStack.Add(itemSelected); Sharing = false; }
public async void SearchBoxEventsQuerySubmitted(SearchBox sender, SearchBoxQuerySubmittedEventArgs args) { searchQuery = args.QueryText; if (string.IsNullOrEmpty(searchQuery)) { return; } ((SearchBox)MainFrameHost.Current.FindName("_FavouritesSearchBox")).QueryText = string.Empty; ((SearchBox)MainFrameHost.Current.FindName("_FavouritesSearchBox")).PlaceholderText = searchQuery; ((SearchBox)MainFrameHost.Current.FindName("_FavouritesSearchBox")).InvalidateArrange(); var source = await FavoritesDataSyncManager.GetInstance(DocumentLocation.Roaming); SkyDriveFile fileCollection = source.GetSelectedFile(args.QueryText); try { //SkyDriveFolder result = await source.Search(queryText); if (object.Equals(fileCollection, null)) { Uri url = Utility.IsInternetURL(searchQuery); if (url != null) { //its internet url fileCollection = new SkyDriveFile(searchQuery, url.AbsoluteUri, ""); if (string.IsNullOrEmpty(item.UniqueId)) { item.URL = fileCollection.URL; } } else { fileCollection = new SkyDriveFile(searchQuery, selectedSearchEngine + Uri.EscapeUriString(searchQuery), ""); } } else { if (string.IsNullOrEmpty(fileCollection.URL)) { await source.LoadFile(fileCollection); } } ((SearchBox)MainFrameHost.Current.FindName("_FavouritesSearchBox")).QueryText = fileCollection.URL; NavigateBrowser(fileCollection.URL); } catch { }; }
/// <summary> /// SearchBoxEventsSuggestionsRequested /// </summary> /// <param name="sender"></param> /// <param name="args"></param> public async void SearchBoxEventsSuggestionsRequested(SearchBox sender, SearchBoxSuggestionsRequestedEventArgs args) { //DetermineSearchBoxWidth(); var queryText = args.QueryText; var request = args.Request; var deferral = request.GetDeferral(); try { var source = await FavoritesDataSyncManager.GetInstance(DocumentLocation.Roaming); source.GetSeachSuggestions(queryText, request.SearchSuggestionCollection); } catch (Exception) { } finally { deferral.Complete(); } }