Пример #1
0
        public void NotifyOccured(NotifyType notifyType, Socket socket, BaseInfo baseInfo)
        {
            switch (notifyType)
            {
            case NotifyType.Reply_UpdateUser:
            {
                UserInfo userName = (UserInfo)baseInfo;
                Window1.main.nickName.Content = userName.Nickname;

                ToolTip tt = new ToolTip();
                tt.Content = userName.Nickname;
                Window1.main.nickName.ToolTip = tt;

                IniFileEdit _IniFileEdit = new IniFileEdit(Window1._UserPath);

                ImageBrush updateImg = new ImageBrush();
                updateImg.Stretch = Stretch.Fill;
                _IniFileEdit.SetIniValue("UserInfo", "userImage", userName.Icon);
                updateImg.ImageSource       = ImageDownloader.GetInstance().GetImage(userName.Icon);
                myPicture.Fill              = updateImg;
                Window1.main.memberImg.Fill = updateImg;

                ToolTip sign = new ToolTip();
                sign.Content = Window1._UserInfo.Sign;
                Window1.main.singBox.ToolTip = sign;
                Window1.main.singBox.Text    = Window1._UserInfo.Sign;

                if (selectGrid.Children.Count > 0 && selectGrid.Children[0] is MyInfoControl)
                {
                    MyInfoControl myInfoControl = (MyInfoControl)selectGrid.Children[0];

                    myInfoControl.buttonSave.IsEnabled = false;
                }

                MessageBoxCommon.Show("更新成功", MessageBoxType.Ok);
            }
            break;

            case NotifyType.Reply_VideoUpload:
            {
                MessageBoxCommon.Show("更改成功.", MessageBoxType.Ok);
            }
            break;

            case NotifyType.Reply_NewID:
            {
                UserInfo newUserInfo = (UserInfo)baseInfo;
                MessageBoxCommon.Show("帐号申请通过." + newUserInfo.Id, MessageBoxType.Ok);
                userInfoList.Add(newUserInfo);

                selectGrid.Children.Clear();
                NoticeMemberControl noticeMemberControl = new NoticeMemberControl();
                noticeMemberControl.listMember(userInfoList);
                selectGrid.Children.Add(noticeMemberControl);
            }
            break;

            case NotifyType.Reply_IconUpload:
            {
                IconInfo newIcon = (IconInfo)baseInfo;
                iconInfoList.Add(newIcon);

                selectGrid.Children.Clear();
                AlbermControl albermControl = new AlbermControl();
                albermControl.pictureList(iconInfoList);
                selectGrid.Children.Add(albermControl);
            }
            break;

            case NotifyType.Reply_Give:
            {
                PresentHistoryInfo presentHistoryInfo = (PresentHistoryInfo)baseInfo;

                presentHistoryList.Add(presentHistoryInfo);
                selectGrid.Children.Clear();
                InnerControl innerControl = new InnerControl();
                innerControl.InnerChatting(chatHistoryList);
                selectGrid.Children.Add(innerControl);



                for (int i = 0; i < userInfoList.Count; i++)
                {
                    if (userInfoList[i].Id == presentHistoryInfo.ReceiveId)
                    {
                        userInfoList[i].Cash = userInfoList[i].Cash + presentHistoryInfo.Cash;

                        selectGrid.Children.Clear();
                        NoticeMemberControl noticeMemberControl = new NoticeMemberControl();
                        noticeMemberControl.listMember(userInfoList);
                        selectGrid.Children.Add(noticeMemberControl);

                        break;
                    }
                }
            }
            break;

            case NotifyType.Reply_UpdatePercent:
            {
                UserInfo userPercent = (UserInfo)baseInfo;
                if (userPercent.Id == Window1._UserInfo.Id)
                {
                    selectGrid.Children.Clear();
                    MyInfoControl myInfoControl = new MyInfoControl();
                    myInfoControl.InitMyInfo(Window1._UserInfo);
                    selectGrid.Children.Add(myInfoControl);
                }
            }
            break;

            case NotifyType.Reply_IconRemove:
            {
                IconInfo newIcon = (IconInfo)baseInfo;
                for (int i = 0; i < iconInfoList.Count; i++)
                {
                    if (iconInfoList[i].Icon == newIcon.Icon)
                    {
                        iconInfoList.Remove(iconInfoList[i]);
                    }
                }

                selectGrid.Children.Clear();
                AlbermControl albermControl = new AlbermControl();
                albermControl.pictureList(iconInfoList);
                selectGrid.Children.Add(albermControl);
            }
            break;

            case NotifyType.Reply_Error:
            {
                ResultInfo errorInfo = (ResultInfo)baseInfo;
                ErrorType  errorType = errorInfo.ErrorType;

                //Window1.ShowError(errorType);
            }
            break;
            }
        }