void item2_MouseUp(object sender, MouseButtonEventArgs e) { selectGrid.Children.Clear(); if (Login._UserInfo.Kind == (int)UserKind.ServiceWoman) { AlbermControl albermControl = new AlbermControl(); albermControl.pictureList(iconInfoList); selectGrid.Children.Add(albermControl); } else { UserIconControl userIconControl = new UserIconControl(); //userIconControl.IconList(); selectGrid.Children.Add(userIconControl); } }
public void NotifyOccured(NotifyType notifyType, Socket socket, BaseInfo baseInfo) { switch (notifyType) { case NotifyType.Reply_UpdateUser: { UserInfo userName = (UserInfo)baseInfo; Login.main.nickName.Content = userName.Nickname; ToolTip tt = new ToolTip(); tt.Content = userName.Nickname; Login.main.nickName.ToolTip = tt; IniFileEdit _IniFileEdit = new IniFileEdit(Login._UserPath); ImageBrush updateImg = new ImageBrush(); updateImg.Stretch = Stretch.Fill; _IniFileEdit.SetIniValue("UserInfo", "userImage", userName.Icon); BitmapImage bi = new BitmapImage(); bi.BeginInit(); bi.UriSource = new Uri(userName.Icon, UriKind.RelativeOrAbsolute); bi.EndInit(); //updateImg.ImageSource = bi; updateImg.ImageSource = ImageDownloader.GetInstance().GetImage(userName.Icon); myPicture.Fill = updateImg; Login.main.memberImg.Fill = updateImg; ToolTip sign = new ToolTip(); sign.Content = Login._UserInfo.Sign; Login.main.singBox.ToolTip = sign; //Login.main.singBox.Text = Login._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); TempWindowForm tempWindowForm = new TempWindowForm(); QQMessageBox.Show(tempWindowForm, "更新成功", "提示", QQMessageBoxIcon.OK, QQMessageBoxButtons.OK); } break; case NotifyType.Request_VideoUpload: { // 2014-02-09: GreenRose if (Main.loadWnd != null) { Main.loadWnd.Close(); Main.loadWnd = null; } //List<IconInfo> listVideoInfo = new List<IconInfo>(); IconInfo newIcon = (IconInfo)baseInfo; //iconInfoList.Add(newIcon); if (iconInfoList != null) { iconInfoList.Add(newIcon); } else { iconInfoList = new List <IconInfo>(); iconInfoList.Add(newIcon); } selectGrid.Children.Clear(); PictureControl pictureControl = new PictureControl(); pictureControl.InitVideoList(iconInfoList); selectGrid.Children.Add(pictureControl); TempWindowForm tempWindowForm = new TempWindowForm(); QQMessageBox.Show(tempWindowForm, "更新成功", "提示", QQMessageBoxIcon.OK, QQMessageBoxButtons.OK); } break; //case NotifyType.Reply_NewID: // { // UserInfo newUserInfo = (UserInfo)baseInfo; // TempWindowForm tempWindowForm = new TempWindowForm(); // QQMessageBox.Show(tempWindowForm, "帐号申请通过." + newUserInfo.Id + "(首次登陆没有密码 登陆后请完善资料)", "提示", QQMessageBoxIcon.OK, QQMessageBoxButtons.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; IconInfo iconInfo = iconInfoList.Find(item => item.Id == newIcon.Id); if (iconInfo == null) { 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 == Login._UserInfo.Id) { selectGrid.Children.Clear(); MyInfoControl myInfoControl = new MyInfoControl(); myInfoControl.InitMyInfo(Login._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; //Login.ShowError(errorType); } break; } }
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; } }