Server/MainForm.cs
changeset 206 33be8cb90c57
parent 204 6345461600d7
child 207 ca469451f8e6
     1.1 --- a/Server/MainForm.cs	Mon Jul 18 15:56:25 2016 +0200
     1.2 +++ b/Server/MainForm.cs	Tue Jul 19 15:43:04 2016 +0200
     1.3 @@ -38,6 +38,7 @@
     1.4  using NAudio.CoreAudioApi;
     1.5  using NAudio.CoreAudioApi.Interfaces;
     1.6  using System.Runtime.InteropServices;
     1.7 +using CecSharp;
     1.8  //Network
     1.9  using NETWORKLIST;
    1.10  //
    1.11 @@ -913,6 +914,9 @@
    1.12          //This is our timer tick responsible to perform our render
    1.13          private void timer_Tick(object sender, EventArgs e)
    1.14          {
    1.15 +            //Not ideal cause this has nothing to do with display render
    1.16 +            LogsUpdate();
    1.17 +
    1.18              //Update our animations
    1.19              DateTime NewTickTime = DateTime.Now;
    1.20  
    1.21 @@ -2480,16 +2484,26 @@
    1.22              Properties.Settings.Default.Save();
    1.23          }
    1.24  
    1.25 +
    1.26 +        /// <summary>
    1.27 +        /// 
    1.28 +        /// </summary>
    1.29 +        private void LogsUpdate()
    1.30 +        {
    1.31 +            if (iWriter != null)
    1.32 +            {
    1.33 +                iWriter.Flush();
    1.34 +            }
    1.35 +
    1.36 +        }
    1.37 +
    1.38          /// <summary>
    1.39          /// Broadcast messages to subscribers.
    1.40          /// </summary>
    1.41          /// <param name="message"></param>
    1.42          protected override void WndProc(ref Message aMessage)
    1.43          {
    1.44 -            if (iWriter != null)
    1.45 -            {
    1.46 -                iWriter.FlushAccumulator();
    1.47 -            }
    1.48 +            LogsUpdate();
    1.49  
    1.50              if (OnWndProc!=null)
    1.51              {
    1.52 @@ -2562,6 +2576,27 @@
    1.53                  Properties.Settings.Default.CecMonitorOn,
    1.54                  Properties.Settings.Default.CecMonitorOff,
    1.55                  Properties.Settings.Default.CecReconnectToPowerTv);
    1.56 +
    1.57 +                //Setup log level
    1.58 +                iCecManager.Client.LogLevel = 0;
    1.59 +
    1.60 +                if (checkBoxCecLogError.Checked)
    1.61 +                    iCecManager.Client.LogLevel &= (int)CecLogLevel.Error;
    1.62 +
    1.63 +                if (checkBoxCecLogWarning.Checked)
    1.64 +                    iCecManager.Client.LogLevel &= (int)CecLogLevel.Warning;
    1.65 +
    1.66 +                if (checkBoxCecLogNotice.Checked)
    1.67 +                    iCecManager.Client.LogLevel &= (int)CecLogLevel.Notice;
    1.68 +
    1.69 +                if (checkBoxCecLogTraffic.Checked)
    1.70 +                    iCecManager.Client.LogLevel &= (int)CecLogLevel.Traffic;
    1.71 +
    1.72 +                if (checkBoxCecLogDebug.Checked)
    1.73 +                    iCecManager.Client.LogLevel &= (int)CecLogLevel.Debug;
    1.74 +
    1.75 +                iCecManager.Client.FilterOutPollLogs = checkBoxCecLogNoPoll.Checked;
    1.76 +
    1.77              }
    1.78          }
    1.79  
    1.80 @@ -2570,6 +2605,14 @@
    1.81              StartIdleClient();
    1.82          }
    1.83  
    1.84 +        private void buttonClearLogs_Click(object sender, EventArgs e)
    1.85 +        {
    1.86 +            richTextBoxLogs.Clear();
    1.87 +        }
    1.88  
    1.89 +        private void checkBoxCecLogs_CheckedChanged(object sender, EventArgs e)
    1.90 +        {
    1.91 +            ResetCec();
    1.92 +        }
    1.93      }
    1.94  }