Example #1
0
        private void SecondaryTileNavigation(string args)
        {
            var unqiueId = args.Substring(args.IndexOf("=") + 1);
            var item     = NotesDataSource.Find(unqiueId.ToString());
            var frame    = Window.Current.Content as Frame;

            if (item == null)
            {
                frame.Navigate(typeof(GroupedItemsPage));
            }
            else if (item.GetType() == typeof(NoteBook))
            {
                frame.Navigate(typeof(GroupDetailPage), item.UniqueId);
            }
            else
            {
                frame.Navigate(typeof(ItemDetailPage), item.UniqueId);
            }
        }
Example #2
0
        /// <summary>
        /// Update Tile Information for Note, changing the default template of the tile to specific template based on the Note Type.
        /// </summary>
        /// <param name="UniqueId">Note Unique ID</param>
        public static void UpdateSecondaryTile(string UniqueId)
        {
            // Determine whether to pin or unpin.
            if (SecondaryTile.Exists(UniqueId))
            {
                var item = NotesDataSource.Find(UniqueId);
                if (item.Images.Count == 0)
                {
                    if (item.Type == NoteTypes.ToDo)
                    {
                        CreateTextToDoTile(item);
                    }
                    else
                    {
                        CreateTextOnlyTile(item);
                    }

                    return;
                }

                switch (item.Type)
                {
                case DataModel.NoteTypes.ToDo:
                    CreateSeconderyForToDo(item as ToDoDataItem);
                    break;

                case DataModel.NoteTypes.Notebook:
                    CreateSeconderyNoteBook(item as NoteBook);
                    break;

                default:
                    CreateSeconderyWithImage(item);
                    break;
                }
            }
        }
        /// <summary>
        /// After DataManager has finished loading the data, based on the application launch type we redirect the user to the proper page.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="ex"></param>
        async void Data_Completed(object sender, Exception ex)
        {
            if (ex != null)
            {
                Helpers.ShowErrorMessageAsync("Loading Notebooks", "Unexpected error while loading notebooks.");
            }
            else
            {
                var rootFrame = new Frame();
                SuspensionManager.RegisterFrame(rootFrame, "AppFrame");

                DataManager.Clean();

                if (NotesDataSource.GetGroups().Count == 0)
                {
                    rootFrame.Navigate(typeof(RestoreWorkingPage), "Getting Started");
                    Window.Current.Content = rootFrame;
                    return;
                }

                if (RestoreLastState)
                {
                    // Restore the saved session state only when appropriate
                    try
                    {
                        await SuspensionManager.RestoreAsync();
                    }
                    catch (SuspensionManagerException)
                    {
                        rootFrame.Navigate(typeof(GroupedItemsPage));
                        Window.Current.Content = rootFrame;
                    }
                }
                else if (ShareTargetOperation != null)
                {
                    ShareTarget share = new ShareTarget();
                    await share.ActivateAsync(ShareTargetOperation);
                }
                else if (SearchArgs != null)
                {
                    rootFrame.Navigate(typeof(GroupedItemsPage));
                    rootFrame.Navigate(typeof(SearchResults), SearchArgs.QueryText);
                    Window.Current.Content = rootFrame;
                }
                else if (!string.IsNullOrEmpty(DirectLink))
                {
                    var note = NotesDataSource.Find(DirectLink);

                    if (note == null)
                    {
                        rootFrame.Navigate(typeof(GroupedItemsPage));
                        Window.Current.Content = rootFrame;
                        return;
                    }

                    rootFrame.Navigate(typeof(GroupedItemsPage));
                    if (note.GetType() == typeof(NoteBook))
                    {
                        rootFrame.Navigate(typeof(GroupDetailPage), note.UniqueId);
                    }
                    else
                    {
                        rootFrame.Navigate(typeof(GroupDetailPage), note.NoteBookUniqueId);
                        rootFrame.Navigate(typeof(ItemDetailPage), note.UniqueId);
                    }

                    Window.Current.Content = rootFrame;
                }
                else
                {
                    rootFrame.Navigate(typeof(GroupedItemsPage));
                    Window.Current.Content = rootFrame;
                }
            }
        }