public MessageEntry(ChatInterface controller, string usersname, CachedPictureBox picture, string initialMessage, DateTime timeStamp, Font message, Font timeStampFont) { this.controller = controller; OwnerUsername = usersname; InitializeComponent(); messageFont = message; this.timeStampFont = timeStampFont; userName.Text = usersname; userName.Font = new Font(CustomFonts.Fonts.Families[1], 11, FontStyle.Bold); userName.Size = userName.PreferredSize; userName.TextAlign = ContentAlignment.MiddleLeft; userName.Anchor = AnchorStyles.Top | AnchorStyles.Left; userPicture = picture; userPicture.Location = new Point(0, 9); userPicture.Name = "UserPicture"; userPicture.Size = new Size(48, 48); userPicture.TabIndex = 0; userPicture.TabStop = false; Controls.Add(userPicture); ts.Font = timeStampFont; ts.TextAlign = ContentAlignment.MiddleLeft; ts.ForeColor = Color.FromArgb(0xba, 0xbb, 0xbf); ts.Text = timeStamp.ToString(controller.connected.Client.MySelf.prefs.time24 ? "HH:mm" : "hh:mm tt"); ts.Size = ts.PreferredSize; ts.Location = new Point(userName.Right, userName.Bottom - ts.PreferredHeight); ts.Anchor = AnchorStyles.Top | AnchorStyles.Left; baseText.Text = Regex.Replace(initialMessage, "\r\n|\r|\n", "\r\n"); baseText.BorderStyle = System.Windows.Forms.BorderStyle.None; baseText.Font = message; baseText.Size = new Size(Width - 70, 10); baseText.Multiline = true; baseText.WordWrap = true; baseText.ReadOnly = true; baseText.Location = new Point(userName.Location.X, userName.Bottom + 5); baseText.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; baseText.GotFocus += baseText_GotFocus; baseText.MouseWheel += baseText_MouseWheel; lastMessage = new Tuple<Label,ChainLabel>(ts, baseText); lastTimeStamp = timeStamp; appended = new List<Tuple<Label, ChainLabel>>(); this.ClientSize = this.PreferredSize; oldY = this.Location.Y; oldHeight = this.Height; this.SizeChanged += UpdateSize; }
public MessageEntry(ChatInterface controller, string usersname, CachedPictureBox picture, string initialMessage, DateTime timeStamp, Font message, Font timeStampFont) { this.controller = controller; OwnerUsername = usersname; InitializeComponent(); messageFont = message; this.timeStampFont = timeStampFont; userName.Text = usersname; userName.Font = new Font(CustomFonts.Fonts.Families[1], 11, FontStyle.Bold); userName.Size = userName.PreferredSize; userName.TextAlign = ContentAlignment.MiddleLeft; userName.Anchor = AnchorStyles.Top | AnchorStyles.Left; userPicture = picture; userPicture.Location = new Point(0, 9); userPicture.Name = "UserPicture"; userPicture.Size = new Size(48, 48); userPicture.TabIndex = 0; userPicture.TabStop = false; Controls.Add(userPicture); ts.Font = timeStampFont; ts.TextAlign = ContentAlignment.MiddleLeft; ts.ForeColor = Color.FromArgb(0xba, 0xbb, 0xbf); ts.Text = timeStamp.ToString(controller.connected.Client.MySelf.prefs.time24 ? "HH:mm" : "hh:mm tt"); ts.Size = ts.PreferredSize; ts.Location = new Point(userName.Right, userName.Bottom - ts.PreferredHeight); ts.Anchor = AnchorStyles.Top | AnchorStyles.Left; baseText.Text = Regex.Replace(initialMessage, "\r\n|\r|\n", "\r\n"); baseText.BorderStyle = System.Windows.Forms.BorderStyle.None; baseText.Font = message; baseText.Size = new Size(Width - 70, 10); baseText.Multiline = true; baseText.WordWrap = true; baseText.ReadOnly = true; baseText.Location = new Point(userName.Location.X, userName.Bottom + 5); baseText.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; baseText.GotFocus += baseText_GotFocus; baseText.MouseWheel += baseText_MouseWheel; lastMessage = new Tuple <Label, ChainLabel>(ts, baseText); lastTimeStamp = timeStamp; appended = new List <Tuple <Label, ChainLabel> >(); this.ClientSize = this.PreferredSize; oldY = this.Location.Y; oldHeight = this.Height; this.SizeChanged += UpdateSize; }
public void ChangeChannel(string channelId) { if (activeChat != null) { if (activeChat.Id.Equals(channelId)) { return; } activeChat.Hide(); } if (chats.ContainsKey(channelId)) { chats[channelId].Show(); activeChat = chats[channelId]; } else { MessagesAdapter adapter = null; switch (channelId[0]) { case 'D': adapter = new DirectMessageAdapter(Client.DirectMessages.Find((c) => c.id == channelId), this, Client); break; case 'C': adapter = new ChannelAdapter(Client.ChannelLookup[channelId], this, Client); break; case 'G': adapter = new GroupAdapter(Client.GroupLookup[channelId], this, Client); break; } if (adapter != null) { activeChat = new ChatInterface(adapter, this); activeChat.Location = new Point(220, 0); activeChat.Width = Width - 220; activeChat.Height = Height; activeChat.Anchor = AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right | AnchorStyles.Top; chats.Add(channelId, activeChat); Controls.Add(activeChat); } else if (activeChat != null) { activeChat.Show(); } } }
/// <summary> /// Will likely handle all auto completes. Names, channels, and emojis. /// </summary> public static void AutoComplete(ChatInterface chat, int keyValue, Keys modifiers) { }
public static void EditLastMessage(ChatInterface chat, int keyValue, Keys modifiers) { }
public static void PreviousChannel(ChatInterface chat, int keyValue, Keys modifiers) { }
public static void QuickSwitcher(ChatInterface chat, int keyValue, Keys modifiers) { }
public static void ToggleFlexpane(ChatInterface chat, int keyValue, Keys modifiers) { }
public static void PreviousChannelUnread(ChatInterface chat, int keyValue, Keys modifiers) { }
public static void NextChannel(ChatInterface chat, int keyValue, Keys modifiers) { }
/// <summary> /// Will handle both forms of creating new snippets from pastes. /// </summary> public static void NewSnippet(ChatInterface chat, int keyValue, Keys modifiers) { }
public static void MarkRead(ChatInterface chat, int keyValue, Keys modifiers) { }
public static void KeyboardShortcutsOverlay(ChatInterface chat, int keyValue, Keys modifiers) { }
public static void HighlightToEndOfLine(ChatInterface chat, int keyValue, Keys modifiers) { }
public static void ReprintLastCommand(ChatInterface chat, int keyValue, Keys modifiers) { }
public static void ScrollThroughMessages(ChatInterface chat, int keyValue, Keys modifiers) { }
public static void NextChannelUnread(ChatInterface chat, int keyValue, Keys modifiers) { }
public static void MarkAllRead(ChatInterface chat, int keyValue, Keys modifiers) { }
public void ChangeChannel(string channelId) { if (activeChat != null) { if (activeChat.Id.Equals(channelId)) return; activeChat.Hide(); } if(chats.ContainsKey(channelId)) { chats[channelId].Show(); activeChat = chats[channelId]; } else { MessagesAdapter adapter = null; switch (channelId[0]) { case 'D': adapter = new DirectMessageAdapter(Client.DirectMessages.Find((c) => c.id == channelId), this, Client); break; case 'C': adapter = new ChannelAdapter(Client.ChannelLookup[channelId], this, Client); break; case 'G': adapter = new GroupAdapter(Client.GroupLookup[channelId], this, Client); break; } if (adapter != null) { activeChat = new ChatInterface(adapter, this); activeChat.Location = new Point(220, 0); activeChat.Width = Width - 220; activeChat.Height = Height; activeChat.Anchor = AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right | AnchorStyles.Top; chats.Add(channelId, activeChat); Controls.Add(activeChat); } else if (activeChat != null) activeChat.Show(); } }