| 1 | using System;
|
|---|
| 2 | using System.Drawing;
|
|---|
| 3 | using System.Collections;
|
|---|
| 4 | using System.ComponentModel;
|
|---|
| 5 | using System.Windows.Forms;
|
|---|
| 6 | using System.Data;
|
|---|
| 7 |
|
|---|
| 8 | namespace IrcSend
|
|---|
| 9 | {
|
|---|
| 10 | /// <summary>
|
|---|
| 11 | /// Form1 �̊T�v�̐��ł��B
|
|---|
| 12 | /// </summary>
|
|---|
| 13 | public class IrcSendAppForm : System.Windows.Forms.Form, IRCListener
|
|---|
| 14 | {
|
|---|
| 15 | public static string AppTitle = "IrcSend";
|
|---|
| 16 |
|
|---|
| 17 | private System.Windows.Forms.TextBox textBox1;
|
|---|
| 18 | private System.Windows.Forms.ComboBox comboBox1;
|
|---|
| 19 | private System.Windows.Forms.Button buttonSendOk;
|
|---|
| 20 | private System.ComponentModel.IContainer components;
|
|---|
| 21 |
|
|---|
| 22 | private IRCClient mIRC;
|
|---|
| 23 |
|
|---|
| 24 | private System.Windows.Forms.Button buttonToggle;
|
|---|
| 25 | private System.Windows.Forms.TextBox textBoxLog;
|
|---|
| 26 | private bool mExpanded;
|
|---|
| 27 | private bool mLogExpanded;
|
|---|
| 28 | private int mExpHeight;
|
|---|
| 29 | private int mOriginalWidth;
|
|---|
| 30 | private bool mPauseLog;
|
|---|
| 31 | private bool mWidthShrunk;
|
|---|
| 32 | private int mPreviousX;
|
|---|
| 33 | private int mBeforeShrunkX;
|
|---|
| 34 |
|
|---|
| 35 | private System.Windows.Forms.ImageList imageListToggleBtns;
|
|---|
| 36 | private System.Windows.Forms.Button buttonClear;
|
|---|
| 37 | private System.Windows.Forms.CheckBox checkBoxPause;
|
|---|
| 38 | private System.Windows.Forms.Timer timerLogFlush;
|
|---|
| 39 | private System.Windows.Forms.Label labelPrevMessage;
|
|---|
| 40 |
|
|---|
| 41 | private ChatLogger mLogger;
|
|---|
| 42 | private System.Windows.Forms.Timer timerResumeCaption;
|
|---|
| 43 |
|
|---|
| 44 | private Hashtable mPreviousMessages;
|
|---|
| 45 | private int mResumeCaptionCount = 0;
|
|---|
| 46 |
|
|---|
| 47 | private GyuqueBot mBot;
|
|---|
| 48 |
|
|---|
| 49 | public IrcSendAppForm()
|
|---|
| 50 | {
|
|---|
| 51 | InitializeComponent();
|
|---|
| 52 |
|
|---|
| 53 | mPreviousX = -1;
|
|---|
| 54 | mPreviousMessages = new Hashtable();
|
|---|
| 55 | }
|
|---|
| 56 |
|
|---|
| 57 | private void IrcSendAppForm_Load(object sender, System.EventArgs e)
|
|---|
| 58 | {
|
|---|
| 59 | this.Activated += new EventHandler(IrcSendAppForm_Activated);
|
|---|
| 60 | this.Deactivate += new EventHandler(IrcSendAppForm_Deactivate);
|
|---|
| 61 | mLogger = new ChatLogger("chatlog.html");
|
|---|
| 62 |
|
|---|
| 63 | comboBox1.Enabled = false;
|
|---|
| 64 | textBox1.Enabled = false;
|
|---|
| 65 |
|
|---|
| 66 | mExpHeight = 296;
|
|---|
| 67 | mOriginalWidth = 400;
|
|---|
| 68 | mPauseLog = false;
|
|---|
| 69 |
|
|---|
| 70 | // TODO: InitializeComponent �Ăяo���̌��A�R���X�g���N�^ �R�[�h�����Ă��������B
|
|---|
| 71 | mIRC = new IRCClient(this);
|
|---|
| 72 | mIRC.loadConfigFromFile("ircsend.config.json");
|
|---|
| 73 | mIRC.start();
|
|---|
| 74 | mBot = new GyuqueBot(mIRC);
|
|---|
| 75 |
|
|---|
| 76 | try
|
|---|
| 77 | {
|
|---|
| 78 | mBot.load("gyuque-schedules.json");
|
|---|
| 79 | }
|
|---|
| 80 | catch(System.IO.IOException ex){}
|
|---|
| 81 |
|
|---|
| 82 | mExpanded = true;
|
|---|
| 83 | mLogExpanded = true;
|
|---|
| 84 | expandLogForm();
|
|---|
| 85 | expandForm();
|
|---|
| 86 | shrinkWidth();
|
|---|
| 87 |
|
|---|
| 88 | timerLogFlush.Start();
|
|---|
| 89 | timerResumeCaption.Start();
|
|---|
| 90 |
|
|---|
| 91 | }
|
|---|
| 92 |
|
|---|
| 93 |
|
|---|
| 94 | /// <summary>
|
|---|
| 95 | /// �g�p�������郊�\�[�X�Ɍ㏈����s���܂��B
|
|---|
| 96 | /// </summary>
|
|---|
| 97 | protected override void Dispose( bool disposing )
|
|---|
| 98 | {
|
|---|
| 99 | if( disposing )
|
|---|
| 100 | {
|
|---|
| 101 | if (mBot != null)
|
|---|
| 102 | mBot.Dispose();
|
|---|
| 103 |
|
|---|
| 104 | if (mIRC != null)
|
|---|
| 105 | mIRC.stop();
|
|---|
| 106 |
|
|---|
| 107 | if (mLogger != null)
|
|---|
| 108 | {
|
|---|
| 109 | mLogger.Dispose();
|
|---|
| 110 | mLogger = null;
|
|---|
| 111 | }
|
|---|
| 112 |
|
|---|
| 113 | if (components != null)
|
|---|
| 114 | components.Dispose();
|
|---|
| 115 | }
|
|---|
| 116 | base.Dispose( disposing );
|
|---|
| 117 | }
|
|---|
| 118 |
|
|---|
| 119 | public void afterIJoined(string aChannel)
|
|---|
| 120 | {
|
|---|
| 121 | lock(this)
|
|---|
| 122 | {
|
|---|
| 123 | comboBox1.Enabled = true;
|
|---|
| 124 | textBox1.Enabled = true;
|
|---|
| 125 |
|
|---|
| 126 | comboBox1.Items.Add(aChannel);
|
|---|
| 127 | if (comboBox1.Items.Count == 1)
|
|---|
| 128 | comboBox1.SelectedIndex = 0;
|
|---|
| 129 | }
|
|---|
| 130 | }
|
|---|
| 131 |
|
|---|
| 132 | public void myMessageSent(string aChannel, string aNick, string aMessage)
|
|---|
| 133 | {
|
|---|
| 134 | channelMessageArrived(aChannel, aNick, aMessage);
|
|---|
| 135 | }
|
|---|
| 136 |
|
|---|
| 137 | public void anyMessageArrived(string aMessage)
|
|---|
| 138 | {
|
|---|
| 139 | if (mPauseLog)
|
|---|
| 140 | return;
|
|---|
| 141 |
|
|---|
| 142 | lock(this.textBoxLog)
|
|---|
| 143 | {
|
|---|
| 144 | textBoxLog.Text += aMessage+"\r\n";
|
|---|
| 145 |
|
|---|
| 146 | textBoxLog.SelectionStart = textBoxLog.Text.Length-1;
|
|---|
| 147 | textBoxLog.ScrollToCaret();
|
|---|
| 148 | }
|
|---|
| 149 | }
|
|---|
| 150 |
|
|---|
| 151 | public void channelMessageArrived(string aChannel, string aNick, string aMessage)
|
|---|
| 152 | {
|
|---|
| 153 | lock(mLogger)
|
|---|
| 154 | {
|
|---|
| 155 | mLogger.addChannelMessage(aChannel, aNick, aMessage);
|
|---|
| 156 | }
|
|---|
| 157 |
|
|---|
| 158 | lock(Text)
|
|---|
| 159 | {
|
|---|
| 160 | Text = aChannel+" "+aNick+"> "+aMessage;
|
|---|
| 161 | }
|
|---|
| 162 |
|
|---|
| 163 | lock(this)
|
|---|
| 164 | {
|
|---|
| 165 | mResumeCaptionCount = 8;
|
|---|
| 166 |
|
|---|
| 167 | updatePreviousMessage(aChannel, aNick+"> "+aMessage);
|
|---|
| 168 | showPreviousMessage();
|
|---|
| 169 | expandWidth();
|
|---|
| 170 | }
|
|---|
| 171 | }
|
|---|
| 172 |
|
|---|
| 173 | #region Windows �t�H�[�� �f�U�C�i�Ő������ꂽ�R�[�h
|
|---|
| 174 | /// <summary>
|
|---|
| 175 | /// �f�U�C�i �T�|�[�g�ɕK�v�ȃ��\�b�h�ł��B���̃��\�b�h�̓��� /// �R�[�h �G�f�B�^�ŕύX���Ȃ��ł��������B
|
|---|
| 176 | /// </summary>
|
|---|
| 177 | private void InitializeComponent()
|
|---|
| 178 | {
|
|---|
| 179 | this.components = new System.ComponentModel.Container();
|
|---|
| 180 | System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(IrcSendAppForm));
|
|---|
| 181 | this.textBox1 = new System.Windows.Forms.TextBox();
|
|---|
| 182 | this.comboBox1 = new System.Windows.Forms.ComboBox();
|
|---|
| 183 | this.buttonSendOk = new System.Windows.Forms.Button();
|
|---|
| 184 | this.buttonToggle = new System.Windows.Forms.Button();
|
|---|
| 185 | this.textBoxLog = new System.Windows.Forms.TextBox();
|
|---|
| 186 | this.imageListToggleBtns = new System.Windows.Forms.ImageList(this.components);
|
|---|
| 187 | this.buttonClear = new System.Windows.Forms.Button();
|
|---|
| 188 | this.checkBoxPause = new System.Windows.Forms.CheckBox();
|
|---|
| 189 | this.timerLogFlush = new System.Windows.Forms.Timer(this.components);
|
|---|
| 190 | this.labelPrevMessage = new System.Windows.Forms.Label();
|
|---|
| 191 | this.timerResumeCaption = new System.Windows.Forms.Timer(this.components);
|
|---|
| 192 | this.SuspendLayout();
|
|---|
| 193 | //
|
|---|
| 194 | // textBox1
|
|---|
| 195 | //
|
|---|
| 196 | this.textBox1.Location = new System.Drawing.Point(145, 1);
|
|---|
| 197 | this.textBox1.Name = "textBox1";
|
|---|
| 198 | this.textBox1.Size = new System.Drawing.Size(216, 19);
|
|---|
| 199 | this.textBox1.TabIndex = 0;
|
|---|
| 200 | this.textBox1.Text = "";
|
|---|
| 201 | //
|
|---|
| 202 | // comboBox1
|
|---|
| 203 | //
|
|---|
| 204 | this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
|---|
| 205 | this.comboBox1.Location = new System.Drawing.Point(1, 1);
|
|---|
| 206 | this.comboBox1.Name = "comboBox1";
|
|---|
| 207 | this.comboBox1.Size = new System.Drawing.Size(143, 20);
|
|---|
| 208 | this.comboBox1.TabIndex = 1;
|
|---|
| 209 | this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
|
|---|
| 210 | //
|
|---|
| 211 | // buttonSendOk
|
|---|
| 212 | //
|
|---|
| 213 | this.buttonSendOk.Font = new System.Drawing.Font("MS UI Gothic", 8F);
|
|---|
| 214 | this.buttonSendOk.Location = new System.Drawing.Point(361, 1);
|
|---|
| 215 | this.buttonSendOk.Name = "buttonSendOk";
|
|---|
| 216 | this.buttonSendOk.Size = new System.Drawing.Size(30, 20);
|
|---|
| 217 | this.buttonSendOk.TabIndex = 2;
|
|---|
| 218 | this.buttonSendOk.Text = "OK";
|
|---|
| 219 | this.buttonSendOk.Click += new System.EventHandler(this.buttonSendOk_Click);
|
|---|
| 220 | //
|
|---|
| 221 | // buttonToggle
|
|---|
| 222 | //
|
|---|
| 223 | this.buttonToggle.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
|
|---|
| 224 | this.buttonToggle.Image = ((System.Drawing.Image)(resources.GetObject("buttonToggle.Image")));
|
|---|
| 225 | this.buttonToggle.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
|
|---|
| 226 | this.buttonToggle.Location = new System.Drawing.Point(2, 22);
|
|---|
| 227 | this.buttonToggle.Name = "buttonToggle";
|
|---|
| 228 | this.buttonToggle.Size = new System.Drawing.Size(16, 20);
|
|---|
| 229 | this.buttonToggle.TabIndex = 3;
|
|---|
| 230 | this.buttonToggle.Click += new System.EventHandler(this.buttonToggle_Click);
|
|---|
| 231 | this.buttonToggle.Paint += new System.Windows.Forms.PaintEventHandler(this.buttonToggle_Paint);
|
|---|
| 232 | //
|
|---|
| 233 | // textBoxLog
|
|---|
| 234 | //
|
|---|
| 235 | this.textBoxLog.Location = new System.Drawing.Point(1, 48);
|
|---|
| 236 | this.textBoxLog.Multiline = true;
|
|---|
| 237 | this.textBoxLog.Name = "textBoxLog";
|
|---|
| 238 | this.textBoxLog.ReadOnly = true;
|
|---|
| 239 | this.textBoxLog.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
|---|
| 240 | this.textBoxLog.Size = new System.Drawing.Size(392, 200);
|
|---|
| 241 | this.textBoxLog.TabIndex = 4;
|
|---|
| 242 | this.textBoxLog.Text = "";
|
|---|
| 243 | //
|
|---|
| 244 | // imageListToggleBtns
|
|---|
| 245 | //
|
|---|
| 246 | this.imageListToggleBtns.ImageSize = new System.Drawing.Size(16, 16);
|
|---|
| 247 | this.imageListToggleBtns.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageListToggleBtns.ImageStream")));
|
|---|
| 248 | this.imageListToggleBtns.TransparentColor = System.Drawing.Color.Transparent;
|
|---|
| 249 | //
|
|---|
| 250 | // buttonClear
|
|---|
| 251 | //
|
|---|
| 252 | this.buttonClear.Location = new System.Drawing.Point(3, 249);
|
|---|
| 253 | this.buttonClear.Name = "buttonClear";
|
|---|
| 254 | this.buttonClear.Size = new System.Drawing.Size(192, 20);
|
|---|
| 255 | this.buttonClear.TabIndex = 5;
|
|---|
| 256 | this.buttonClear.Text = "Clear";
|
|---|
| 257 | this.buttonClear.Click += new System.EventHandler(this.buttonClear_Click);
|
|---|
| 258 | //
|
|---|
| 259 | // checkBoxPause
|
|---|
| 260 | //
|
|---|
| 261 | this.checkBoxPause.Appearance = System.Windows.Forms.Appearance.Button;
|
|---|
| 262 | this.checkBoxPause.Location = new System.Drawing.Point(199, 249);
|
|---|
| 263 | this.checkBoxPause.Name = "checkBoxPause";
|
|---|
| 264 | this.checkBoxPause.Size = new System.Drawing.Size(192, 20);
|
|---|
| 265 | this.checkBoxPause.TabIndex = 6;
|
|---|
| 266 | this.checkBoxPause.Text = "Stop";
|
|---|
| 267 | this.checkBoxPause.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
|---|
| 268 | this.checkBoxPause.CheckedChanged += new System.EventHandler(this.checkBoxPause_CheckedChanged);
|
|---|
| 269 | //
|
|---|
| 270 | // timerLogFlush
|
|---|
| 271 | //
|
|---|
| 272 | this.timerLogFlush.Interval = 5000;
|
|---|
| 273 | this.timerLogFlush.Tick += new System.EventHandler(this.timerLogFlush_Tick);
|
|---|
| 274 | //
|
|---|
| 275 | // labelPrevMessage
|
|---|
| 276 | //
|
|---|
| 277 | this.labelPrevMessage.Location = new System.Drawing.Point(22, 27);
|
|---|
| 278 | this.labelPrevMessage.Name = "labelPrevMessage";
|
|---|
| 279 | this.labelPrevMessage.Size = new System.Drawing.Size(368, 16);
|
|---|
| 280 | this.labelPrevMessage.TabIndex = 7;
|
|---|
| 281 | //
|
|---|
| 282 | // timerResumeCaption
|
|---|
| 283 | //
|
|---|
| 284 | this.timerResumeCaption.Interval = 500;
|
|---|
| 285 | this.timerResumeCaption.Tick += new System.EventHandler(this.timerResumeCaption_Tick);
|
|---|
| 286 | //
|
|---|
| 287 | // IrcSendAppForm
|
|---|
| 288 | //
|
|---|
| 289 | this.AutoScaleBaseSize = new System.Drawing.Size(5, 12);
|
|---|
| 290 | this.ClientSize = new System.Drawing.Size(394, 270);
|
|---|
| 291 | this.ControlBox = false;
|
|---|
| 292 | this.Controls.Add(this.labelPrevMessage);
|
|---|
| 293 | this.Controls.Add(this.checkBoxPause);
|
|---|
| 294 | this.Controls.Add(this.buttonClear);
|
|---|
| 295 | this.Controls.Add(this.textBoxLog);
|
|---|
| 296 | this.Controls.Add(this.buttonToggle);
|
|---|
| 297 | this.Controls.Add(this.buttonSendOk);
|
|---|
| 298 | this.Controls.Add(this.comboBox1);
|
|---|
| 299 | this.Controls.Add(this.textBox1);
|
|---|
| 300 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
|---|
| 301 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
|---|
| 302 | this.Name = "IrcSendAppForm";
|
|---|
| 303 | this.ShowInTaskbar = false;
|
|---|
| 304 | this.Text = "IrcSend";
|
|---|
| 305 | this.TopMost = true;
|
|---|
| 306 | this.Load += new System.EventHandler(this.IrcSendAppForm_Load);
|
|---|
| 307 | this.ResumeLayout(false);
|
|---|
| 308 |
|
|---|
| 309 | }
|
|---|
| 310 | #endregion
|
|---|
| 311 |
|
|---|
| 312 | /// <summary>
|
|---|
| 313 | /// �A�v���P�[�V�����̃��C�� �G���g�� �|�C���g�ł��B
|
|---|
| 314 | /// </summary>
|
|---|
| 315 | [STAThread]
|
|---|
| 316 | static void Main()
|
|---|
| 317 | {
|
|---|
| 318 | Application.Run(new IrcSendAppForm());
|
|---|
| 319 | }
|
|---|
| 320 |
|
|---|
| 321 | private void shrinkForm()
|
|---|
| 322 | {
|
|---|
| 323 | if (!mExpanded)
|
|---|
| 324 | return;
|
|---|
| 325 |
|
|---|
| 326 | this.Height = SystemInformation.CaptionHeight;
|
|---|
| 327 | this.Width = mOriginalWidth;
|
|---|
| 328 | mExpanded = false;
|
|---|
| 329 | adjustWidth();
|
|---|
| 330 | }
|
|---|
| 331 |
|
|---|
| 332 | private void expandForm()
|
|---|
| 333 | {
|
|---|
| 334 | if (mExpanded)
|
|---|
| 335 | return;
|
|---|
| 336 |
|
|---|
| 337 | this.Height = mExpHeight;
|
|---|
| 338 | this.Width = mOriginalWidth;
|
|---|
| 339 | mExpanded = true;
|
|---|
| 340 | adjustWidth();
|
|---|
| 341 | }
|
|---|
| 342 |
|
|---|
| 343 | private void expandLogForm()
|
|---|
| 344 | {
|
|---|
| 345 | if (mExpanded)
|
|---|
| 346 | {
|
|---|
| 347 | mExpHeight = 296;
|
|---|
| 348 | this.Height = mExpHeight;
|
|---|
| 349 | buttonToggle.Image = imageListToggleBtns.Images[1];
|
|---|
| 350 | mLogExpanded = true;
|
|---|
| 351 | }
|
|---|
| 352 | }
|
|---|
| 353 |
|
|---|
| 354 | private void hideLogForm()
|
|---|
| 355 | {
|
|---|
| 356 | if (mExpanded)
|
|---|
| 357 | {
|
|---|
| 358 | mExpHeight = SystemInformation.CaptionHeight + SystemInformation.BorderSize.Height*2 + textBox1.Height + 30;
|
|---|
| 359 | this.Height = mExpHeight;
|
|---|
| 360 | buttonToggle.Image = imageListToggleBtns.Images[0];
|
|---|
| 361 | mLogExpanded = false;
|
|---|
| 362 | }
|
|---|
| 363 | }
|
|---|
| 364 |
|
|---|
| 365 | private void buttonSendOk_Click(object sender, System.EventArgs e)
|
|---|
| 366 | {
|
|---|
| 367 | string chname = comboBox1.Text;
|
|---|
| 368 | if (!chname.StartsWith("#"))
|
|---|
| 369 | return;
|
|---|
| 370 |
|
|---|
| 371 | mIRC.privmsg(chname, textBox1.Text);
|
|---|
| 372 | textBox1.Text = "";
|
|---|
| 373 | }
|
|---|
| 374 |
|
|---|
| 375 | private void shrinkWidth()
|
|---|
| 376 | {
|
|---|
| 377 | mWidthShrunk = true;
|
|---|
| 378 | adjustWidth();
|
|---|
| 379 |
|
|---|
| 380 | if (!mExpanded && mPreviousX >= 0 && mPreviousX == Left)
|
|---|
| 381 | Left = mBeforeShrunkX;
|
|---|
| 382 | }
|
|---|
| 383 |
|
|---|
| 384 | private void expandWidth()
|
|---|
| 385 | {
|
|---|
| 386 | mWidthShrunk = false;
|
|---|
| 387 | adjustWidth();
|
|---|
| 388 | truncateRight();
|
|---|
| 389 | }
|
|---|
| 390 |
|
|---|
| 391 | private void adjustWidth()
|
|---|
| 392 | {
|
|---|
| 393 | if (mExpanded)
|
|---|
| 394 | Width = mOriginalWidth;
|
|---|
| 395 | else
|
|---|
| 396 | Width = mWidthShrunk ? 56 : mOriginalWidth;
|
|---|
| 397 | }
|
|---|
| 398 |
|
|---|
| 399 | private void truncateRight()
|
|---|
| 400 | {
|
|---|
| 401 | int R = Screen.PrimaryScreen.Bounds.Right;
|
|---|
| 402 | int r = Left + Width;
|
|---|
| 403 | if (r > R)
|
|---|
| 404 | {
|
|---|
| 405 | mBeforeShrunkX = Left;
|
|---|
| 406 | mPreviousX = Left - (r-R);
|
|---|
| 407 | Left = mPreviousX;
|
|---|
| 408 | }
|
|---|
| 409 | }
|
|---|
| 410 |
|
|---|
| 411 | private void IrcSendAppForm_Activated(object sender, EventArgs e)
|
|---|
| 412 | {
|
|---|
| 413 | expandForm();
|
|---|
| 414 | }
|
|---|
| 415 |
|
|---|
| 416 | private void IrcSendAppForm_Deactivate(object sender, EventArgs e)
|
|---|
| 417 | {
|
|---|
| 418 | shrinkForm();
|
|---|
| 419 | }
|
|---|
| 420 |
|
|---|
| 421 | private void buttonToggle_Click(object sender, System.EventArgs e)
|
|---|
| 422 | {
|
|---|
| 423 | if (mLogExpanded)
|
|---|
| 424 | hideLogForm();
|
|---|
| 425 | else
|
|---|
| 426 | expandLogForm();
|
|---|
| 427 | }
|
|---|
| 428 |
|
|---|
| 429 | private void buttonToggle_Paint(object sender, PaintEventArgs e)
|
|---|
| 430 | {
|
|---|
| 431 | e.Graphics.FillRectangle(System.Drawing.SystemBrushes.Control, 0, 0, buttonToggle.Width, buttonToggle.Height);
|
|---|
| 432 | e.Graphics.DrawImage(buttonToggle.Image, 6, 6);
|
|---|
| 433 | }
|
|---|
| 434 |
|
|---|
| 435 | private void buttonClear_Click(object sender, System.EventArgs e)
|
|---|
| 436 | {
|
|---|
| 437 | lock(this.textBoxLog)
|
|---|
| 438 | {
|
|---|
| 439 | this.textBoxLog.Text="";
|
|---|
| 440 | }
|
|---|
| 441 | }
|
|---|
| 442 |
|
|---|
| 443 | private void checkBoxPause_CheckedChanged(object sender, System.EventArgs e)
|
|---|
| 444 | {
|
|---|
| 445 | mPauseLog = checkBoxPause.Checked;
|
|---|
| 446 | }
|
|---|
| 447 |
|
|---|
| 448 | private void timerLogFlush_Tick(object sender, System.EventArgs e)
|
|---|
| 449 | {
|
|---|
| 450 |
|
|---|
| 451 | if (mLogger != null)
|
|---|
| 452 | lock(mLogger){mLogger.flush();}
|
|---|
| 453 | }
|
|---|
| 454 |
|
|---|
| 455 | private void updatePreviousMessage(string channel, string message)
|
|---|
| 456 | {
|
|---|
| 457 | mPreviousMessages[channel] = message;
|
|---|
| 458 | }
|
|---|
| 459 |
|
|---|
| 460 | private string getPreviousMessage(string channel)
|
|---|
| 461 | {
|
|---|
| 462 | if (!mPreviousMessages.ContainsKey(channel))
|
|---|
| 463 | return "";
|
|---|
| 464 |
|
|---|
| 465 | return mPreviousMessages[channel].ToString();
|
|---|
| 466 | }
|
|---|
| 467 |
|
|---|
| 468 | private void comboBox1_SelectedIndexChanged(object sender, System.EventArgs e)
|
|---|
| 469 | {
|
|---|
| 470 | showPreviousMessage();
|
|---|
| 471 | }
|
|---|
| 472 |
|
|---|
| 473 | private void showPreviousMessage()
|
|---|
| 474 | {
|
|---|
| 475 | lock(this)
|
|---|
| 476 | {
|
|---|
| 477 | labelPrevMessage.Text = getPreviousMessage(comboBox1.Text);
|
|---|
| 478 | }
|
|---|
| 479 | }
|
|---|
| 480 |
|
|---|
| 481 | private void timerResumeCaption_Tick(object sender, System.EventArgs e)
|
|---|
| 482 | {
|
|---|
| 483 | if (mResumeCaptionCount > 0)
|
|---|
| 484 | {
|
|---|
| 485 | if (--mResumeCaptionCount == 0)
|
|---|
| 486 | {
|
|---|
| 487 | lock(this)
|
|---|
| 488 | {
|
|---|
| 489 | Text = AppTitle;
|
|---|
| 490 | shrinkWidth();
|
|---|
| 491 | }
|
|---|
| 492 | }
|
|---|
| 493 | }
|
|---|
| 494 | }
|
|---|
| 495 | }
|
|---|
| 496 | }
|
|---|