Beispiel #1
0
 /// <summary>
 /// Delete friend
 /// </summary>
 void client_DeleteFriendCompleted(object sender, DeleteFriendCompletedEventArgs e)
 {
     MessageBox.Show(e.Result);
 }
Beispiel #2
0
        void Client_DeleteFriendCompleted(object sender, DeleteFriendCompletedEventArgs e)
        {
            try
            {
                if (e.Error != null)
                {
                    throw e.Error;
                }

                if (e.Result.Status == MessageStatus.Failed)
                {
                    MessageBox.Show("删除好友失败");
                }
                else if (e.Result.Status == MessageStatus.OK)
                {

                    Member member = this.baseRole as Member;
                    ///删除好友图标。并将后面的好友前移
                    MyGrid myGrid = this.Parent as MyGrid;

                    myGrid.RemoveButton(MyType.User,this);

                    #region comment
                   
                    //int currentIndex = myGrid.Children.IndexOf(this);

                    /////删掉分组
                    //myGrid.Children.Remove(this);

                    /////删除全局的分组记录
                    //DataUtil.DeleteFriend(member.id, this.baseRoleId);

                    /////将后面的分组移除
                    //List<MyButton> temp = new List<MyButton>();
                    //for (; currentIndex < myGrid.Children.Count; )
                    //{
                    //    temp.Add(myGrid.Children[currentIndex] as MyButton);
                    //    myGrid.Children.RemoveAt(currentIndex);

                    //}
                    /////将后面的分组前移后加上
                    //foreach (MyButton button in temp)
                    //{
                    //    Grid.SetRow(button, currentIndex / 3);
                    //    Grid.SetColumn(button, currentIndex % 3);
                    //    myGrid.Children.Add(button);
                    //    currentIndex++;
                    //}


                    /////将message windows 删掉
                    //DataUtil.MessageTabControl.Items.Remove(DataUtil.FriendMessageTabItems[member.id]);
                    //DataUtil.FriendMessageTabItems.Remove(member.id);

                    #endregion

                }

            }
            catch (Exception ex)
            {
                MessageBox.Show("删除好友操作超时");
                MyLogger.Logger.Error("删除好友出错", ex);
            }
            finally
            {
                DataUtil.Client.DeleteFriendCompleted -= Client_DeleteFriendCompleted;
            }
        }