/* * Sends a message to all those connected to the same topic */ private void SendMessage(object sender, EventArgs e) { string message = MessageBox.Text; if (message != "" && currTopic != null) { Net.sendMsg(comm, new ChatMessage((int)MTypes.CHATMESSAGE, ClientValues.UName, message)); MessageBox.Clear(); } }
private void MessageBox_Enter(object sender, EventArgs e) { if (MessageBox.Text == "Type something here...") { MessageBox.ForeColor = Color.Black; MessageBox.Clear(); MessageBox.Update(); } else { MessageBox.Select(MessageBox.Text.Length, 0); } }
} //EndOfClearButton_Click // Send it button Click private void SenditButton_Click(object sender, EventArgs e) { MessageBox.Clear(); // Clear Messagebox everytime user press button Message = ""; if (BoardStationbox.Text.Equals(DestStationbox.Text)) // Validation for Same Station { MessageBox.Text = string.Format("You selected the same Station!"); } else if (BoardStationbox.Text.Equals("") || DestStationbox.Text.Equals("")) // Validation for Empty String { MessageBox.Text = string.Format("Please select a station!"); } else { string newLine = "\r\n\r\n"; int count = 0; result = g.SearchForPath(BoardStationbox.Text, DestStationbox.Text, 2); // Returns List of Stations foreach (Path <Station> pt in result) // Print Results { if (count.Equals(0)) { Message += "Full Route: " + newLine; Message += g.PrintFullResult(pt) + newLine; Message += "Number of Stops: " + (pt.Weight - 1) + newLine + newLine; count++; } else { Message += "Alternative Route: " + newLine; Message += g.PrintFullResult(pt) + newLine; Message += "Number of Stops: " + (pt.Weight - 1) + newLine; } }//end foreach Fare[] totalfare = db.GetFare(g.getStnCode(BoardStationbox.Text), g.getStnCode(DestStationbox.Text)); if (totalfare[0] == null) // If data not found in database, will return null { Message += "Fare cannot be generated due to lack of data."; } else { Message += "Child Fare: " + totalfare[0].getChildFare() + "\r\n"; Message += "Adult Fare: " + totalfare[0].getStandardFare() + newLine; Message += "Estimated Time Needed to your destination: " + totalfare[0].getTotalTime() + "mins"; } Result r1 = new Result(Message); r1.ShowDialog(); //Open Result WinForm } }
} //EndOfGuideDisplay // Clear private void ClearButton_Click(object sender, EventArgs e) { // Clear Everything BoardStationbox.Items.Clear(); DestStationbox.Items.Clear(); MessageBox.Clear(); // Re-add Stations to combo foreach (string station in g.DisplayAllArray().Distinct().OrderBy(s => s)) { BoardStationbox.Items.Add(station); DestStationbox.Items.Add(station); }//end foreach } //EndOfClearButton_Click
protected void UpdateGui() { if (_configchanged) { MessageBox.Clear(); MessageBox.AppendText(@"--- Received configuration changed event."); InitializeGui(); } else { TextBoxBadEndpointCount.Text = _proxycontroller.BadEndpointList.Count.ToString(); TextBoxCurrentSelectedEndpoint.Text = _proxycontroller.EndpointInfo(_proxycontroller.CurrentAssignedIndex).address; } }
//Button "Send" clicked private void Send_Click(object sender, RoutedEventArgs e) { if (MessageBox.Text == null || Selected == null || Selected.Participants.Where(x => x.Id == Client.Local.Id).Count() == 0) { return; } /*DateTime t = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); * long unixTime = (long)(DateTime.Now - t).TotalSeconds;*/ TextMessage msg = new TextMessage(MessageBox.Text, Client.Local, Tools.GetUnixTime(), Selected.Id, true); Client.SendMessage(msg); MessageBox.Clear(); }
private void SendButton_Click(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(MessageBox.Text)) { string userMessage = MessageBox.Text; Packet packetToSend = new Packet(); packetToSend.Type = (int)Packet.pType.SendChat; packetToSend.Username = Globals.playerInfo.username; packetToSend.Message = userMessage; MessageBox.Clear(); client.Send(packetToSend); unpack(client.Recieve()); } }
private void SubmitBtn_Click(object sender, EventArgs e) { TcpClient client = new TcpClient(ipadd, 8080); int byteCount = Encoding.ASCII.GetByteCount(MessageBox.Text + 1); byte[] sendBuffer = new byte[byteCount]; sendBuffer = Encoding.ASCII.GetBytes(MessageBox.Text + ""); NetworkStream stream = client.GetStream(); stream.Write(sendBuffer, 0, sendBuffer.Length); outputBox.AppendText(name + ": " + Encoding.ASCII.GetString(sendBuffer, 0, sendBuffer.Length) + "\n"); MessageBox.Clear(); stream.Close(); client.Close(); }
private void MessageBox_KeyUp(object sender, KeyEventArgs e) { if (string.IsNullOrWhiteSpace(MessageBox.Text)) { return; } if (e.KeyData == Keys.Enter) { var message = new PrivateMessage() { To = User, Message = MessageBox.Text }; ByteBuffer buffer = new ByteBuffer(); buffer.WriteByte((byte)Protocol.PrivateMessage) .WriteByteArray(serializer.Serialize(message)); Socket.Send(buffer.ToArray()); PrintMessage(MessageBox.Text); MessageBox.Clear(); } }
private void Button_Click2(object sent, EventArgs error) { try { //putting text in message box System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding(); byte[] msg = new byte[2400]; msg = encoding.GetBytes(MessageBox.Text); //send message to client sock.Send(msg); //put message into chat Viewbox.Items.Add("You: " + MessageBox.Text); MessageBox.Clear(); } catch (Exception ex) { System.Windows.MessageBox.Show(ex.ToString()); } }
//public ChatSessionForm() //{ // InitializeComponent(); // //CurrentSession = (Owner as ChatClientForm).CurrentSession; // //CurrentSession.sessionForm = this; //} // Далее - обработчики событий, работающие с клиентской моделью ChatSession (Control) private void MessageBox_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != (char)Keys.Enter) { return; } e.Handled = true; if (string.IsNullOrWhiteSpace(MessageBox.Text) || MessageBox.Text == "\0") { return; } var message = new TextMessage() { Text = MessageBox.Text }; CurrentSession?.SendMessage(message); MessageBox.Clear(); //MessageBox.Update(); }
private void SendMessage(object sender, RoutedEventArgs e) { ChatManager.Sender.Send($"MSG {ChatManager.LocalUser.Username} {ChatManager.Room.Name} {MessageBox.Text}"); MessageBox.Clear(); }
private void WriteStartMessage() { MessageBox.Clear(); MessageBox.AppendText("Ожидайте 2 секунды"); }
private void StartButton_Click(object sender, EventArgs e) { try { if (StartButton.Text == "Start")//If we are starting the McCain File Deleter Perform This. //Turn off controls and change button text. { #region Controls StatusDirectoryTextBox.Enabled = false; TimingDirectoryTextBox.Enabled = false; StartButton.Text = "Stop"; MessageBox.Clear(); #endregion //Provide warnings!! #region Warnings int bStatusCount = 0; int bTimingCount = 0; string[] filesStatus = new string[0]; string[] filesTiming = new string[0]; RegistryKey keybefore = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\McCainDeleter"); try { filesStatus = Directory.GetFiles(keybefore.GetValue("StatusDirectory").ToString()); } catch { filesStatus = new string[0]; } try { filesTiming = Directory.GetFiles(keybefore.GetValue("TimingDirectory").ToString()); } catch { filesTiming = new string[0]; } keybefore.Close(); foreach (string file in filesStatus) { FileInfo fi = new FileInfo(file); if (fi.LastAccessTime < DateTime.Today.AddDays(-1)) { bStatusCount++; } } foreach (string file in filesTiming) { FileInfo fi = new FileInfo(file); if (fi.LastAccessTime < DateTime.Today.AddDays(-1)) { bTimingCount++; } } System.Windows.Forms.MessageBox.Show( "Your are about to start deleting from the following two directiries:\r\n-" + StatusDirectoryTextBox.Text + "\r\nWhich will delete " + bStatusCount.ToString() + " files.\r\n-" + TimingDirectoryTextBox.Text + "\r\nWhich will delete " + bTimingCount.ToString() + " files.\r\nARE YOUR SURE YOU WISH TO CONTINUE?!?!"); #endregion RegistryKey key = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\McCainDeleter"); if (key.ValueCount >= 2) { key.SetValue("StatusDirectory", StatusDirectoryTextBox.Text); key.SetValue("TimingDirectory", TimingDirectoryTextBox.Text); myDirectorys[0] = StatusDirectoryTextBox.Text; myDirectorys[1] = TimingDirectoryTextBox.Text; } if (key.ValueCount == 0 | key.ValueCount == 1) { System.Windows.Forms.MessageBox.Show("One or both of your input directories are blank.\r\nYour must have both directories to continue."); } key.Close(); MessageBox.Text = "Starting McCain File Deleter...\r\n" + MessageBox.Text; System.Timers.Timer myScheduler = new System.Timers.Timer(); myScheduler.Elapsed += new ElapsedEventHandler(OnTimedEvent); myScheduler.Interval = 1000; myScheduler.Enabled = true; System.Threading.Thread.Sleep(2000); myScheduler.Interval = 21600000; //6 hours in milliseconds MessageBox.Text = "Timing Intervol updated to 6 hours.\r\n" + MessageBox.Text; while (StartButton.Text != "Stop") { ; } } else//If we are stopping the McCain File Deleter Perform This. //Turn on controls and change button text back. { StatusDirectoryTextBox.Enabled = true; TimingDirectoryTextBox.Enabled = true; StartButton.Text = "Start"; MessageBox.Text = "Stopping McCain File Deleter...\r\n" + MessageBox.Text; } }//end try catch (Exception ex) { MessageBox.Text = "\r\nThere was a problem with the start button operations that was caught.\r\n" + ex.ToString() + "\r\n" + MessageBox.Text; StatusDirectoryTextBox.Enabled = true; TimingDirectoryTextBox.Enabled = true; StartButton.Text = "Start"; } }
private void clearStatus_Click(object sender, EventArgs e) { MessageBox.Clear(); }