private void Update_Room(object sender, RoutedEventArgs e) { // IniFileEdit iniFileEdit = new IniFileEdit(Window1._UserPath); // string strPrice = System.Text.RegularExpressions.Regex.Replace(roomPrice.Text, @"[0-9]", ""); // string strMaxUser = System.Text.RegularExpressions.Regex.Replace(maxUser.Text, @"[0-9]", ""); //if (strPrice.Length > 0 && strMaxUser.Length > 0) // MessageBoxCommon.Show(iniFileEdit.GetIniValue("StringMessageBox", "Invalid_Number"), MessageBoxType.Ok); //else //{ if (roomPass.Password == veriPass.Password) { Window1._RoomInfo.Name = roomBox.Text; //방이름 Window1._RoomInfo.Id = selectRoomId; Window1._RoomInfo.Kind = 0; //if (roomPrice.Text == "") Window1._RoomInfo.Cash = 0; //else // Window1._RoomInfo.Cash = Convert.ToInt32(roomPrice.Text); //if (maxUser.Text == "") Window1._RoomInfo.MaxUsers = 0; //else // Window1._RoomInfo.MaxUsers = Convert.ToInt32(maxUser.Text); Window1._RoomInfo.Owner = roomUpowner; Window1._RoomInfo.RoomPass = roomPass.Password; Window1._ClientEngine.Send(NotifyType.Request_UpdateRoom, Window1._RoomInfo); this.Close(); //} } else { MessageBoxCommon.Show("암호가 일치하지 않습니다.", MessageBoxType.Ok); } }
private void delBt_Click(object sender, RoutedEventArgs e) { //if (letterDataGrid.SelectedIndex < 0) // return; SendData sendData = (SendData)letterDataGrid.SelectedItem; if (sendData == null) { MessageBoxCommon.Show("请选择需要删除的题目", MessageBoxType.Ok); return; } if (MessageBoxCommon.Show("您确定要删除吗?", MessageBoxType.YesNo) == MessageBoxReply.No) { return; } Window1._BoardInfo.Id = sendData.id; if (Main.notice_board == true) { Window1._ClientEngine.Send(NotifyType.Request_DelNotice, Window1._BoardInfo); } else { Window1._ClientEngine.Send(NotifyType.Request_DelLetter, Window1._BoardInfo); } }
private void open_MouseDown(object sender, MouseButtonEventArgs e) { _LoadWorker = new BackgroundWorker(); _LoadWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(this.LoadWorker_DoWork); _LoadWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(_LoadWorker_RunWorkerCompleted); Microsoft.Win32.OpenFileDialog ofd = new Microsoft.Win32.OpenFileDialog(); ofd.Filter = "mp3 (*.mp3)|*.mp3|wma (*.wma)|*.wma"; Nullable <bool> result = ofd.ShowDialog(); if (result == true) { System.IO.FileInfo fileSize = new System.IO.FileInfo(ofd.FileName); if (fileSize.Length > 5000000) { MessageBoxCommon.Show("Overflow mp3 Size.", MessageBoxType.Ok); return; } char[] delimiterChars = { ':', '\\' }; string[] words = ofd.FileName.Split(delimiterChars); int count = words.Length; musicname = words[count - 1].ToString(); string filename = ofd.FileName; lstMediaItems.Items.Add(musicname); musicList.Add(filename); _LoadWorker.RunWorkerAsync(); } }
void item2_Click(object sender, RoutedEventArgs e) { if (MessageBoxCommon.Show("您确定要删除吗?", MessageBoxType.YesNo) == MessageBoxReply.No) { return; } var selectMenu = sender as MenuItem; string imgIcon = selectMenu.DataContext.ToString(); if (imgIcon == Window1._UserInfo.Icon) { MessageBoxCommon.Show("已设定在头像的图片不能删除.", MessageBoxType.Ok); } else { for (int i = 0; i < Window1.myhome.iconInfoList.Count; i++) { if (imgIcon == Window1.myhome.iconInfoList[i].Icon) { Window1._ClientEngine.Send(NotifyType.Request_IconRemove, Window1.myhome.iconInfoList[i]); break; } } } }
private void Button_Click(object sender, RoutedEventArgs e) { if (userNicname.Text == "") { MessageBoxCommon.Show("请输入您的称号.", MessageBoxType.Ok); } else { Window1._UserInfo.Id = userId.Content.ToString(); Window1._UserInfo.Nickname = userNicname.Text; Window1._UserInfo.Address = userAddress.Text; Window1._UserInfo.Sign = signBox.Text; try { Window1._UserInfo.Year = Convert.ToInt32(userYear.SelectedItem.ToString()); Window1._UserInfo.Month = Convert.ToInt32(userMonth.SelectedItem.ToString()); Window1._UserInfo.Day = Convert.ToInt32(userDay.SelectedItem.ToString()); } catch { } Window1._UserInfo.Password = rePass.Password; Window1._ClientEngine.Send(NotifyType.Request_UpdateUser, Window1._UserInfo); } }
private void okBt_Click(object sender, RoutedEventArgs e) { if (_veriPass == passwordRoom.Password) { Window1._ClientEngine.Send(NotifyType.Request_EnterRoom, verifyRoomInfo); this.Close(); } else { MessageBoxCommon.Show("암호가 틀립니다.", MessageBoxType.Ok); } }
private void openFile_Click(object sender, RoutedEventArgs e) { // Create OpenFileDialog Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); // Set filter for file extension and default file extension dlg.Filter = "JPEG Files (*.jpeg)|*.jpeg|PNG Files (*.png)|*.png|JPG Files (*.jpg)|*.jpg|GIF Files (*.gif)|*.gif"; Nullable <bool> result = dlg.ShowDialog(); // Get the selected file name and display in a TextBox if (result == true) { Image myImg = new Image(); BitmapImage myBit = new BitmapImage(); myBit.BeginInit(); myBit.UriSource = new Uri(dlg.FileName, UriKind.Absolute); myBit.EndInit(); /*********************************/ char[] delimiterChars = { ':', '\\' }; string[] words = dlg.FileName.Split(delimiterChars); int count = words.Length; JpegBitmapEncoder encoder = new JpegBitmapEncoder(); encoder.Frames.Add(BitmapFrame.Create(myBit)); byte[] bit = new byte[0]; using (MemoryStream stream = new MemoryStream()) { encoder.Save(stream); bit = stream.ToArray(); stream.Close(); if (bit.Length >= 120000) { MessageBoxCommon.Show("文件过大上传失败.请上传100KB以下的文件.", MessageBoxType.Ok); } else { VideoInfo videoInfo = new VideoInfo(); videoInfo.Data = bit; videoInfo.UserId = words[count - 1].ToString(); videoInfo.ImgData = bit; videoInfo.ImgName = words[count - 1].ToString(); Window1._ClientEngine.Send(NotifyType.Request_IconUpload, videoInfo); } } /*************************************/ } }
private void roomDelete_MouseUp(object sender, MouseButtonEventArgs e) { if (_roomGrid == true) { _roomGrid = true; if (MessageBoxCommon.Show("Are you sure?", MessageBoxType.YesNo) == MessageBoxReply.No) { return; } _roomInfo.Id = _roomId; Window1._ClientEngine.Send(NotifyType.Request_DelRoom, _roomInfo); } }
static public void ShowError(ErrorType errorType) { IniFileEdit iniFileEdit = new IniFileEdit(_UserPath); string errorString = iniFileEdit.GetIniValue("MessageString", errorType.ToString()); if (errorString == "") { return; } else { MessageBoxCommon.Show(errorString, MessageBoxType.Ok); } }
private void viewBt_Click(object sender, RoutedEventArgs e) { if (letterDataGrid.SelectedIndex < 0) { MessageBoxCommon.Show("请选择需要删除的题目", MessageBoxType.Ok); return; } SendData selectedFile = (SendData)letterDataGrid.Items[letterDataGrid.SelectedIndex]; nSelectId = selectedFile.id; if (Main.notice_board == true) { for (int i = 0; i < Window1._HomeInfo.Notices.Count; i++) { if (Window1._HomeInfo.Notices[i].Id == nSelectId) { Main.writeSend = new WriteSend(); Main.writeSend.title.Text = Window1._HomeInfo.Notices[i].Title; Main.writeSend.contents.Text = Window1._HomeInfo.Notices[i].Content; Main.writeSend.title.IsReadOnly = true; Main.writeSend.contents.IsReadOnly = true; Main.writeSend.btFlag = false; Main.writeSend.Show(); } } Window1._BoardInfo.Id = nSelectId; Window1._ClientEngine.Send(NotifyType.Request_ReadNotice, Window1._BoardInfo); } else { for (int i = 0; i < Window1.noticeList.Count; i++) { if (Window1.noticeList[i].Id == nSelectId) { Main.writeSend = new WriteSend(); Main.writeSend.title.Text = Window1.noticeList[i].Title; Main.writeSend.contents.Text = Window1.noticeList[i].Content; Main.writeSend.title.IsReadOnly = true; Main.writeSend.contents.IsReadOnly = true; Main.writeSend.btFlag = false; Main.writeSend.Show(); } } } }
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (MessageBoxCommon.Show("Do you want to exit a game?", MessageBoxType.YesNo) == MessageBoxReply.No) { e.Cancel = true; return; } _GameView.CloseView(); Main._GameRoom = null; Main.activeGame = null; Main.u_gamrId = null; Window1._ClientEngine.Send(NotifyType.Request_OutGame, Window1._UserInfo); Window1._ClientEngine.DetachHandler(_GameView.NotifyOccured); }
private void Button_Click(object sender, RoutedEventArgs e) { if (btFlag == true) { if (title.Text != string.Empty) { string sendNameStr = sendName.Text; char[] delimiterChars = { ',' }; string[] words = sendNameStr.Split(delimiterChars); int count = words.Length; if (words[0].ToString() == "管理人") { Window1._BoardInfo.Title = title.Text; Window1._BoardInfo.Content = contents.Text; Window1._BoardInfo.UserId = Window1._UserInfo.Id; Window1._BoardInfo.UserKind = Window1._UserInfo.Kind; Window1._BoardInfo.SendId = "admin"; Window1._ClientEngine.Send(NotifyType.Request_SendLetter, Window1._BoardInfo); } else { for (int i = 0; i < count; i++) { if (words[i].ToString() != "") { Window1._BoardInfo.Title = title.Text; Window1._BoardInfo.Content = contents.Text; Window1._BoardInfo.UserId = Window1._UserInfo.Id; Window1._BoardInfo.UserKind = Window1._UserInfo.Kind; Window1._BoardInfo.SendId = words[i].ToString(); Window1._ClientEngine.Send(NotifyType.Request_SendLetter, Window1._BoardInfo); } } } } else { MessageBoxCommon.Show("请输入标题", MessageBoxType.Ok); } } this.Close(); }
private void goRegistor_Click(object sender, RoutedEventArgs e) { //IniFileEdit iniFileEdit = new IniFileEdit(Window1._UserPath); //string strPrice = System.Text.RegularExpressions.Regex.Replace(roomPass.Password, @"[0-9]", ""); //string strMaxUser = System.Text.RegularExpressions.Regex.Replace(veriPass.Password, @"[0-9]", ""); //if (strPrice.Length > 0 || strMaxUser.Length > 0) //{ // MessageBoxCommon.Show(iniFileEdit.GetIniValue("StringMessageBox", "Invalid_Number"), MessageBoxType.Ok); // return; //} //else //{ if (roomPass.Password == veriPass.Password) { RoomInfo roomInfo = new RoomInfo(); roomInfo.Name = roomBox.Text; //방이름 Random userId = new Random(); roomInfo.Id = userId.Next(11111111, 99999999).ToString(); //방아이디 roomInfo.Kind = 0; //방종류 //if (price.Text == "") roomInfo.Cash = 0; //else // roomInfo.Cash = Convert.ToInt32(price.Text); //if (maxUser.Text == "") roomInfo.MaxUsers = 0; //else // roomInfo.MaxUsers = Convert.ToInt32(maxUser.Text); roomInfo.Owner = roomOwner; roomInfo.RoomPass = roomPass.Password; roomInfo.Icon = "Images\\Room\\default.gif"; Window1._ClientEngine.Send(NotifyType.Request_MakeRoom, roomInfo); this.Close(); } else { MessageBoxCommon.Show("암호가 일치하지 않습니다.", MessageBoxType.Ok); } //} }
private void roomGrid_MouseDown(object sender, MouseButtonEventArgs e) { if (_isFirstmousclick == true) { return; } _roomInfo.Id = _roomId; if (Main._DiceGame != null) { MessageBoxCommon.Show("请稍候......", MessageBoxType.Ok); } else { if (Window1._UserInfo.Kind == (int)UserKind.ServiceWoman) { if (Main.multyChatRoom == null && Main.chatRoom == null && _ownerId == Window1._UserInfo.Id && _roomGrid == false || _roomId == "1000000") { Window1._ClientEngine.Send(NotifyType.Request_EnterRoom, _roomInfo); } } else { //if (MessageBoxCommon.Show("您确定要进入此房间吗? 방값:" + Window1._RoomInfo.Cash, MessageBoxType.YesNo) == MessageBoxReply.Yes) //{ if (_roomPass == null || _roomPass == "") { Window1._ClientEngine.Send(NotifyType.Request_EnterRoom, _roomInfo); } else { RoomPassVerify roomPassVerify = new RoomPassVerify(); roomPassVerify.VerifyRoomInfo(_roomInfo); roomPassVerify.Show(); } //} } } }
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; } }