예제 #1
0
 private void ListsUser_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
 {
     if (!_selectionChangeFired)
     {
         TwitterList list = null;
         if (e.AddedItems.Count > 0)
         {
             list = e.AddedItems[0] as TwitterList;
         }
         if (list != null)
         {
             Dispatcher.BeginInvoke(() => pBar.IsVisible = true);
             _srv.AddListMember(new AddListMemberOptions {
                 ScreenName = _userName, Slug = list.Slug, OwnerScreenName = list.User.ScreenName
             }, (user, response) =>
             {
                 LoadListsIn();
                 if (response.StatusCode == HttpStatusCode.OK)
                 {
                     Dispatcher.BeginInvoke(() => MessageBox.Show(String.Format(Localization.Resources.AddedToList, _userName, list.FullName)));
                 }
                 else
                 {
                     Dispatcher.BeginInvoke(() => MessageBox.Show(Localization.Resources.ErrorMessage));
                 }
                 Dispatcher.BeginInvoke(() => pBar.IsVisible = false);
             });
         }
         _selectionChangeFired = true;
         Dispatcher.BeginInvoke(() => ListsUser.SelectedIndex = -1);
     }
     else
     {
         _selectionChangeFired = false;
     }
 }