Example #1
0
 /// <summary>
 /// Get bookmark list
 /// </summary>
 /// <param name="applicationId">Application ID</param>
 public void GetBookmarkList(string applicationId)
 {
     if (bookmarkList != null)
     {
         CompleteBookmarksEvent e = new CompleteBookmarksEvent() { BookmarkList = bookmarkList, ErrorMessage = string.Empty };
         OnLoaded(e);
     }
     else
     {
         bookmarkList = new List<BookmarkElement>();
         WebClient xmlClient = new WebClient();
         xmlClient.DownloadStringCompleted += DownloadListXMLCompleted;
         xmlClient.DownloadStringAsync(new Uri(String.Format("{0}\\Bookmarks.xml", applicationId), UriKind.RelativeOrAbsolute));
     }
 }
Example #2
0
 /// <summary>
 /// Callback of the xml transfer
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void DownloadListXMLCompleted(object sender, DownloadStringCompletedEventArgs e)
 {
     try
     {
         string xmlConfig = e.Result;
         bookmarkList = BookmarkConfig.Deserialize(xmlConfig).Bookmarks;
         CompleteBookmarksEvent completeEvent = new CompleteBookmarksEvent() { BookmarkList = bookmarkList, ErrorMessage = string.Empty };
         OnLoaded(completeEvent);
     }
     catch (Exception ex)
     {
         // Force error
         CompleteBookmarksEvent completeEvent = new CompleteBookmarksEvent() { BookmarkList = null, ErrorMessage = ex.Message };
         OnLoaded(completeEvent);
     }
 }
Example #3
0
 private void GetListBookmarksCompleted(object sender, CompleteBookmarksEvent e)
 {
     bookmarks.bookmarksListCompleted -= GetListBookmarksCompleted;
     if (e.BookmarkList != null)
     {
         if (e.BookmarkList.Count > 0)
         {
             // Show window with the possible layers
             bookmarkListView = new BookmarkListView();
             BookmarkListViewModel listViewModel = new BookmarkListViewModel(e.BookmarkList);
             modalDialogService.ShowDialog(bookmarkListView, listViewModel, EndOfBookmarkSelection);
         }
         else
         {
             ShowMessagebox.Raise(new Notification
             {
                 Content = Silverlight.UI.Esri.JTToolbarCommon.Resources.ToolbarCommon.NoBookmarksAvailable,
                 Title = Silverlight.UI.Esri.JTToolbarCommon.Resources.ToolbarCommon.Warning
             });
         }
     }
     else
     {
         // Error occurred
         ShowErrorMessagebox.Raise(new Notification
         {
             Content = String.Format("GetListBookmarksCompleted-{0}[{1}]", e.ErrorMessage, ""),
             Title = "System error"
         });
     }
 }
Example #4
0
 /// <summary>
 /// End processing of the retrieve
 /// </summary>
 /// <param name="e"></param>
 protected virtual void OnLoaded(CompleteBookmarksEvent e)
 {
     if (bookmarksListCompleted != null)
         bookmarksListCompleted(this, e);
 }