Пример #1
0
        public async Task AddRemoveBookmark(Thread thread)
        {
            string error = "";

            try
            {
                var    threadManager = new BookmarkManager(WebManager);
                string bookmarkstring;
                if (thread.IsBookmark)
                {
                    await threadManager.RemoveBookmarkAsync(thread.ThreadId);

                    thread.IsBookmark = !thread.IsBookmark;
                    bookmarkstring    = string.Format("'{0}' has been removed from your bookmarks.", thread.Name);
                }
                else
                {
                    bookmarkstring = string.Format("'{0}' has been added to your bookmarks.",
                                                   thread.Name);
                    thread.IsBookmark = !thread.IsBookmark;
                    await threadManager.AddBookmarkAsync(thread.ThreadId);
                }
                var msgDlg2 =
                    new MessageDialog(bookmarkstring)
                {
                    DefaultCommandIndex = 1
                };
                await msgDlg2.ShowAsync();
            }
            catch (Exception ex)
            {
                error = ex.Message;
            }
        }