public void AddLine([NotNull] IChatLine line) { if (line == null) { throw new ArgumentNullException("line"); } if ((line is SaidLine && Program.Conf.IgnoredUsers.Contains(((SaidLine)line).AuthorName)) || (line is SaidExLine && Program.Conf.IgnoredUsers.Contains(((SaidExLine)line).AuthorName))) { return; } ChatBox.AddLine(line); HistoryManager.LogLine(UserName, line); var saidLine = line as SaidLine; if (saidLine != null && WindowsApi.IdleTime.TotalMinutes > Program.Conf.IdleTime && (DateTime.Now - lastAnsweringMessageTime).TotalMinutes > Program.Conf.IdleTime) { if (saidLine.AuthorName != Program.TasClient.UserName) { Program.TasClient.Say(SayPlace.User, UserName, String.Format("Answering machine: I have been idle for {0} minutes.", (int)WindowsApi.IdleTime.TotalMinutes), false); lastAnsweringMessageTime = DateTime.Now; } } }
public ServerTab() { Font = Config.ChatFont; InitializeComponent(); if (Process.GetCurrentProcess().ProcessName == "devenv" && !Debugger.IsAttached) return; textBox = new ChatBox { Dock = DockStyle.Fill }; Controls.Add(textBox); filterBox = new SendBox { Dock = DockStyle.Bottom, Text = "Filter (press enter)" }; Controls.Add(filterBox); sendBox = new SendBox { Dock = DockStyle.Bottom, Text = "Raw Send" }; Controls.Add(sendBox); Program.TasClient.Input += TasClient_Input; Program.TasClient.Output += TasClient_Output; sendBox.LineEntered += (s, e) => Program.TasClient.SendRaw(e.Data); filterBox.LineEntered += (s, e) => { textBox.ClearTextWindow(); textBox.TextFilter = e.Data; var filtered = entries.Where(x => textBox.PassesFilter(x)).ToList(); foreach (var chatLine in filtered.Skip(Math.Max(filtered.Count - DisplayLines, 0)).Take(DisplayLines)) textBox.AddLine(chatLine); }; VisibleChanged += (sender, args) => { if (prevVis != Visible && Visible) { textBox.ClearTextWindow(); foreach (var chatLine in entries.Skip(Math.Max(entries.Count - DisplayLines, 0)).Take(DisplayLines)) textBox.AddLine(chatLine); } prevVis = Visible; }; textBox.ChatBackgroundColor = TextColor.background; //same as Program.Conf.BgColor but TextWindow.cs need this. textBox.IRCForeColor = 14; //mirc grey. Unknown use }
void ChatControl_VisibleChanged(object sender, EventArgs e) { if (Visible) { GoToSendBox(); } else { ChatBox.ResetUnread(); } }
public ServerTab() { InitializeComponent(); if (Process.GetCurrentProcess().ProcessName == "devenv" && !Debugger.IsAttached) { return; } textBox = new ChatBox { Dock = DockStyle.Fill }; Controls.Add(textBox); filterBox = new SendBox { Dock = DockStyle.Bottom, Text = "Filter (press enter)" }; Controls.Add(filterBox); sendBox = new SendBox { Dock = DockStyle.Bottom, Text = "Raw Send" }; Controls.Add(sendBox); Program.TasClient.Input += TasClient_Input; Program.TasClient.Output += TasClient_Output; sendBox.LineEntered += (s, e) => Program.TasClient.SendRaw(e.Data); filterBox.LineEntered += (s, e) => { textBox.ClearTextWindow(); textBox.TextFilter = e.Data; var filtered = entries.Where(x => textBox.PassesFilter(x)).ToList(); foreach (var chatLine in filtered.Skip(Math.Max(filtered.Count - DisplayLines, 0)).Take(DisplayLines)) { textBox.AddLine(chatLine); } }; VisibleChanged += (sender, args) => { if (prevVis != Visible && Visible) { textBox.ClearTextWindow(); foreach (var chatLine in entries.Skip(Math.Max(entries.Count - DisplayLines, 0)).Take(DisplayLines)) { textBox.AddLine(chatLine); } } prevVis = Visible; }; textBox.ChatBackgroundColor = TextColor.background; //same as Program.Conf.BgColor but TextWindow.cs need this. textBox.IRCForeColor = 14; //mirc grey. Unknown use }
public virtual void AddLine(IChatLine line) { if (ChannelName != "zkadmin" && ((line is SaidLine && Program.Conf.IgnoredUsers.Contains(((SaidLine)line).AuthorName)) || (line is SaidExLine && Program.Conf.IgnoredUsers.Contains(((SaidExLine)line).AuthorName)))) { return; } ChatBox.AddLine(line); ChannelLineAdded(this, new ChannelLineArgs() { Channel = ChannelName, Line = line }); HistoryManager.LogLine(ChannelName, line); }
public static void InsertLastLines(string channelName, ChatBox control) { try { var historyFileName = channelName + ".txt"; if (!File.Exists(Path.Combine(GetHistoryFolder(), historyFileName))) return; var lines = GetLines(historyFileName); for (var i = Math.Max(0, lines.Length - HistoryLines); i < lines.Length; i++) { control.AddLine(new HistoryLine(lines[i].StripAllCodes())); } } catch (Exception e) { Trace.WriteLine("History manager: " + e); } }
public static void InsertLastLines(string channelName, ChatBox control) { try { var historyFileName = channelName + ".txt"; if (!File.Exists(Path.Combine(GetHistoryFolder(), historyFileName))) { return; } var lines = GetLines(historyFileName); for (var i = Math.Max(0, lines.Length - HistoryLines); i < lines.Length; i++) { control.AddLine(new HistoryLine(lines[i].StripAllCodes())); } } catch (Exception e) { Trace.WriteLine("History manager: " + e); } }
private void InitializeComponent() { playerListMapSplitContainer = new SplitContainer(); playerBoxSearchBarContainer = new Panel(); playerBox = new PlayerListControl(); searchBarContainer = new TableLayoutPanel(); playerSearchBox = new ZklTextBox(); sendBox = new SendBox(); topicPanel = new Panel(); hideButton = new BitmapButton(); topicBox = new ChatBox(); ChatBox = new ChatBox(); splitContainer1 = new ZkSplitContainer(); ((ISupportInitialize)playerListMapSplitContainer).BeginInit(); playerListMapSplitContainer.Panel1.SuspendLayout(); playerListMapSplitContainer.SuspendLayout(); playerBoxSearchBarContainer.SuspendLayout(); searchBarContainer.SuspendLayout(); topicPanel.SuspendLayout(); ((ISupportInitialize)splitContainer1).BeginInit(); splitContainer1.Panel1.SuspendLayout(); splitContainer1.Panel2.SuspendLayout(); splitContainer1.SuspendLayout(); SuspendLayout(); // // playerListMapSplitContainer // playerListMapSplitContainer.BackColor = Color.DimGray; playerListMapSplitContainer.Dock = DockStyle.Fill; playerListMapSplitContainer.Location = new Point(0, 0); playerListMapSplitContainer.Margin = new Padding(2); playerListMapSplitContainer.Name = "playerListMapSplitContainer"; playerListMapSplitContainer.Orientation = Orientation.Horizontal; // // playerListMapSplitContainer.Panel1 // playerListMapSplitContainer.Panel1.Controls.Add(playerBoxSearchBarContainer); // // playerListMapSplitContainer.Panel2 // playerListMapSplitContainer.Panel2.AutoScroll = true; playerListMapSplitContainer.Size = new Size(326, 793); playerListMapSplitContainer.SplitterDistance = 565; playerListMapSplitContainer.SplitterWidth = 3; playerListMapSplitContainer.TabIndex = 0; playerListMapSplitContainer.SplitterMoved += new SplitterEventHandler(playerListMapSplitContainer_SplitterMoved); // // playerBoxSearchBarContainer // playerBoxSearchBarContainer.AutoSizeMode = AutoSizeMode.GrowAndShrink; playerBoxSearchBarContainer.Controls.Add(playerBox); playerBoxSearchBarContainer.Controls.Add(searchBarContainer); playerBoxSearchBarContainer.Dock = DockStyle.Fill; playerBoxSearchBarContainer.Location = new Point(0, 0); playerBoxSearchBarContainer.Name = "playerBoxSearchBarContainer"; playerBoxSearchBarContainer.Size = new Size(326, 565); playerBoxSearchBarContainer.TabIndex = 2; // // playerBox // playerBox.BackColor = Color.DimGray; playerBox.Dock = DockStyle.Fill; playerBox.ForeColor = Color.White; playerBox.HoverItem = null; playerBox.IsBattle = false; playerBox.IsSorted = false; playerBox.Location = new Point(0, 24); playerBox.Name = "playerBox"; playerBox.SelectedItem = null; playerBox.Size = new Size(326, 541); playerBox.TabIndex = 1; // // searchBarContainer // searchBarContainer.ColumnCount = 2; searchBarContainer.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize, 20F)); searchBarContainer.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 20F)); searchBarContainer.Controls.Add(playerSearchBox, 1, 0); searchBarContainer.Dock = DockStyle.Top; searchBarContainer.Location = new Point(0, 0); searchBarContainer.Name = "searchBarContainer"; searchBarContainer.RowCount = 1; searchBarContainer.RowStyles.Add(new RowStyle(SizeType.Absolute, 25F)); searchBarContainer.Size = new Size(326, 30); searchBarContainer.AutoSize = false; searchBarContainer.TabIndex = 0; // // playerSearchBox // playerSearchBox.Anchor = AnchorStyles.Left | AnchorStyles.Top; playerSearchBox.Location = new Point(23, 22); playerSearchBox.Name = "playerSearchBox"; playerSearchBox.Size = new Size(300, 20); playerSearchBox.Margin = new Padding(0); playerSearchBox.TabIndex = 0; playerSearchBox.Font = Config.GeneralFontSmall; playerSearchBox.TextChanged += new EventHandler(playerSearchBox_TextChanged); // // sendBox // sendBox.Dock = DockStyle.Bottom; sendBox.Font = Config.GeneralFont; sendBox.ForeColor = Color.White; sendBox.Location = new Point(0, 765); sendBox.Multiline = true; sendBox.Name = "sendBox"; sendBox.Size = new Size(800, 28); sendBox.TabIndex = 0; sendBox.WordWrap = false; // // topicPanel // topicPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink; topicPanel.Controls.Add(hideButton); topicPanel.Controls.Add(topicBox); topicPanel.Dock = DockStyle.Top; topicPanel.Location = new Point(0, 0); topicPanel.Margin = new Padding(0); topicPanel.Name = "topicPanel"; topicPanel.Size = new Size(800, 0); topicPanel.TabIndex = 3; // // hideButton // hideButton.Anchor = (AnchorStyles)(AnchorStyles.Bottom | AnchorStyles.Right); hideButton.BackColor = Color.Transparent; hideButton.ButtonStyle = FrameBorderRenderer.StyleType.DarkHive; hideButton.Cursor = Cursors.Hand; hideButton.FlatStyle = FlatStyle.Flat; hideButton.ForeColor = Color.White; hideButton.Location = new Point(711, -29); hideButton.Name = "hideButton"; hideButton.Size = new Size(75, 23); hideButton.SoundType = SoundPalette.SoundType.Click; hideButton.TabIndex = 3; hideButton.Text = "Hide"; hideButton.UseVisualStyleBackColor = true; hideButton.Click += new EventHandler(hideButton_Click); // // topicBox // topicBox.BackColor = Color.FromArgb((int)(byte)0, (int)(byte)30, (int)(byte)40); topicBox.ChatBackgroundColor = 0; topicBox.DefaultTooltip = null; topicBox.Dock = DockStyle.Fill; topicBox.Font = Config.GeneralFontBig; topicBox.HideScroll = false; topicBox.IRCForeColor = 0; topicBox.LineHighlight = null; topicBox.Location = new Point(0, 0); topicBox.Name = "topicBox"; topicBox.NoColorMode = false; topicBox.ShowHistory = true; topicBox.ShowJoinLeave = false; topicBox.ShowUnreadLine = true; topicBox.SingleLine = false; topicBox.Size = new Size(800, 0); topicBox.TabIndex = 2; topicBox.TextFilter = null; // // ChatBox // ChatBox.BackColor = Color.DimGray; ChatBox.ChatBackgroundColor = 0; ChatBox.DefaultTooltip = null; ChatBox.Dock = DockStyle.Fill; ChatBox.Font = Config.GeneralFont; ChatBox.ForeColor = Color.White; ChatBox.HideScroll = false; ChatBox.IRCForeColor = 0; ChatBox.LineHighlight = null; ChatBox.Location = new Point(0, 0); ChatBox.Name = "ChatBox"; ChatBox.NoColorMode = false; ChatBox.ShowHistory = true; ChatBox.ShowJoinLeave = false; ChatBox.ShowUnreadLine = true; ChatBox.SingleLine = false; ChatBox.Size = new Size(800, 765); ChatBox.TabIndex = 1; ChatBox.TextFilter = null; // // splitContainer1 // splitContainer1.BackColor = Color.Transparent; splitContainer1.Dock = DockStyle.Fill; splitContainer1.Location = new Point(0, 0); splitContainer1.Margin = new Padding(0); splitContainer1.Name = "splitContainer1"; // // splitContainer1.Panel1 // splitContainer1.Panel1.Controls.Add(ChatBox); splitContainer1.Panel1.Controls.Add(topicPanel); splitContainer1.Panel1.Controls.Add(sendBox); // // splitContainer1.Panel2 // splitContainer1.Panel2.Controls.Add(playerListMapSplitContainer); splitContainer1.Size = new Size(1130, 793); splitContainer1.SplitterDistance = 800; splitContainer1.TabIndex = 0; splitContainer1.SplitterMoved += splitContainer1_SplitterMoved; playerBox.BackColor = Config.BgColor; playerBox.ForeColor = Config.TextColor; playerBox_zklclick.AttachTo(playerBox); playerBox_zklclick.MouseClick += PlayerBox_MouseClick; playerSearchBox.BackColor = Config.BgColor; playerSearchBox.ForeColor = Config.TextColor; var searchLabel = new Label() { Text = "Search: ", AutoSize = true, Font = Config.GeneralFontSmall, Margin = new Padding(3) }; searchBarContainer.Controls.Add(searchLabel, 0, 0); // // ChatControl // Controls.Add(splitContainer1); Margin = new Padding(0); Name = "ChatControl"; Size = new Size(1130, 793); playerListMapSplitContainer.Panel1.ResumeLayout(false); ((ISupportInitialize)playerListMapSplitContainer).EndInit(); playerListMapSplitContainer.ResumeLayout(false); playerBoxSearchBarContainer.ResumeLayout(false); searchBarContainer.ResumeLayout(false); topicPanel.ResumeLayout(false); splitContainer1.Panel1.ResumeLayout(false); splitContainer1.Panel1.PerformLayout(); splitContainer1.Panel2.ResumeLayout(false); ((ISupportInitialize)splitContainer1).EndInit(); splitContainer1.ResumeLayout(false); ResumeLayout(false); }