public chatmesg(string message, msgtype messagetype) { InitializeComponent(); if (message.Contains("/")) { // Image img = Image.FromFile(message); //pictureBox1.Image = img; //pictureBox1.ImageLocation = message; // pictureBox1.Visible = true; // pictureBox1.Refresh(); //does the work here //storing and retreiving values from datadase //pictureBox1.Visible = false; } else { Iblmessage.Text = message; Ibltime.Text = DateTime.Now.ToShortTimeString(); if (messagetype.ToString() == "In") { //incoming message this.BackColor = Color.FromArgb(0, 164, 147); } else { //outgoing message this.BackColor = Color.Gray; } //lets add the function which adjust the bubble height } Setheight(); }
public bubble(string fileName, string filePath, string timee, msgtype messagetype, chatbox2 parent) { InitializeComponent(); this.parent = parent; saveFileDialog1.FileName = fileName; this.path = filePath; time.Text = timee; msg.Text = "Filenadsssssssssssssssssssssssssssssssmesssssssssssssssssssssssssssssssssssssssssssme:"; nameOfFile.Text = fileName; if (messagetype.ToString() == "In") { this.BackColor = Color.Gray; this.bunifuFlatButton1.Normalcolor = Color.FromArgb(26, 177, 136); this.bunifuFlatButton1.OnHovercolor = Color.FromArgb(20, 155, 118); } else { this.BackColor = Color.FromArgb(26, 177, 136); this.bunifuFlatButton1.Normalcolor = Color.Gray; this.bunifuFlatButton1.OnHovercolor = Color.DimGray; } msg.Visible = false; bunifuFlatButton1.Top = 25; bunifuFlatButton1.Left = 250; bunifuFlatButton1.Visible = true; labelFilename.Visible = true; nameOfFile.Visible = true; }
public chatmesg(string message, string time, msgtype messagetype) { InitializeComponent(); Iblmessage.Text = message; Ibltime.Text = time; if (messagetype.ToString() == "In") { //incoming message this.BackColor = Color.FromArgb(0, 164, 147); } else { //outgoing message this.BackColor = Color.Gray; } //lets add the function which adjust the bubble height Setheight(); }
public bubble(string message, string timee, msgtype messagetype, chatbox2 parent) { InitializeComponent(); msg.Text = message; time.Text = timee; this.parent = parent; if (messagetype.ToString() == "In") { this.BackColor = Color.Gray; } else { this.BackColor = Color.FromArgb(26, 177, 136); } Setheight(); }
public bubble(string message, string time, msgtype messagetype) { InitializeComponent(); lblmessgae.Text = message; lbltime.Text = time; if (messagetype.ToString() == "In") { BackColor = Color.FromArgb(0, 164, 147); } else { BackColor = Color.Gray; } Setheight(); }
public chat(string message, string auteur, msgtype m) { InitializeComponent(); label1.Text = auteur; label2.Text = message; if (m == msgtype.In) { this.BackColor = Color.WhiteSmoke; label2.ForeColor = Color.FromArgb(64, 64, 64); label1.ForeColor = Color.SteelBlue; } else { this.BackColor = Color.FromArgb(71, 137, 182); label2.ForeColor = Color.Silver; label1.ForeColor = Color.White; } SetHeight(); }
public bubble(string message, msgtype messagetype) { InitializeComponent(); // Set the text in the bubble from the message in the parameter. lblmessage.Text = message; // Change Color based on Message type. if (messagetype.ToString() == "In") { // incoming User message this.BackColor = Color.Gray; } else { // Outgoing Bot Message this.BackColor = Color.FromArgb(0, 164, 147); } Setheight(); }
private static void WriteLine(string msg, msgtype ms) { lock (sync) { if (ms == msgtype.warning) { Console.ForegroundColor = ConsoleColor.Yellow; } if (ms == msgtype.error) { Console.ForegroundColor = ConsoleColor.Red; } if (ms == msgtype.pass) { Console.ForegroundColor = ConsoleColor.Green; } Console.WriteLine(msg); Console.ResetColor(); } }
public bubble(Image img, String timee, msgtype messagetype, chatbox2 parent) { InitializeComponent(); this.parent = parent; this.img = img; msg.Text = "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffsdfffffffffffffffffffffffffsdffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffsdfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffsdfffffffffffffffffffffffffsdffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffsdffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffsdfffffffffffffffffffffffffsdffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffsdffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffsdfffffffffffffffffffffffffsdffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffsdfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffsdfffffffffffffffffffffffffsdffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffsdffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"; time.Text = timee; if (messagetype.ToString() == "In") { this.BackColor = Color.Gray; } else { this.BackColor = Color.FromArgb(26, 177, 136); } this.Height = 360; this.Width = 458; pictureBox1.Visible = true; pictureBox1.Image = ResizeImage(img, 350, 350); pictureBox1.Top = 25; pictureBox1.Left = 30; msg.Visible = false; }
private void recvThreadFunc() { bool is_mid_msg = false; try { UInt16 wireProtoVersion = streamreader.ReadUInt16(); if (wireProtoVersion != 0x0000) { state = CONNSTATE.Unsupported; form.updateConnectionListEntry(this); return; } UInt16 J2534ProtoVersion = streamreader.ReadUInt16(); switch (J2534ProtoVersion) { case 0x0404: interpreter = new J2534ProtocolInterpreter_0404(); break; default: state = CONNSTATE.Unsupported; form.updateConnectionListEntry(this); return; } state = CONNSTATE.Connected; form.updateConnectionListEntry(this); //Setup complete, Loop forever processing messages. while (state == CONNSTATE.Connected) { msgtype mtype = (msgtype)streamreader.ReadByte(); checkEnum(typeof(msgtype), mtype); is_mid_msg = true; switch (mtype) { case msgtype.reportParam: StringBuilder logentry = new StringBuilder(); param p = (param)streamreader.ReadByte(); checkEnum(typeof(param), p); switch (p) { case param.client: Client = streamreader.ReadString(); form.updateConnectionListEntry(this); logentry.Append("Client: " + Client); //logWriter.WriteLine("Client: " + Client); break; case param.driver: Driver = streamreader.ReadString(); logentry.Append("Driver: " + Driver); //logWriter.WriteLine("Driver: " + Driver); int driverstatus = streamreader.ReadInt32(); if (driverstatus != 0) { close(); state = CONNSTATE.Error; if (driverstatus > 0) { state = CONNSTATE.BadDriver; } else if (driverstatus == -1) { state = CONNSTATE.MissingDriver; } } form.updateConnectionListEntry(this); break; } saveLogEntry(logentry.ToString()); break; case msgtype.J2534Msg: saveLogEntry(interpreter.interpret(streamreader)); EventCount++; form.updateConnectionListEntry(this); break; } is_mid_msg = false; } } catch (System.ObjectDisposedException) { Console.WriteLine("Connectionclosed, unable to do stuff."); state = CONNSTATE.Disconnected; form.updateConnectionListEntry(this); } catch (System.Net.Sockets.SocketException e) { catchSocketException(e); } catch (System.IO.IOException e) { if (e.InnerException is System.Net.Sockets.SocketException) { catchSocketException((System.Net.Sockets.SocketException)e.InnerException); } else if (!is_mid_msg) { state = CONNSTATE.Disconnected; form.updateConnectionListEntry(this); socket.Close(); } else { die(); } } catch (InvalidEnumException e) { Console.WriteLine(e.ToString()); die(); } }