Ejemplo n.º 1
0
        public FormJT2SL(El2SlConfig config, EventLog eventLog, EventLogEntryType eventLogEntryType)
        {
            InitializeComponent();
            _eventLog          = eventLog;
            _eventLogEntryType = eventLogEntryType;

            lInfo.Text = string.Format("{0}:{1}", _eventLog.LogDisplayName, eventLogEntryType.ToString());

            cbEnabled.Checked = config.LoggingEnabled(eventLog, eventLogEntryType);
            cbEnabled_CheckedChanged(cbEnabled, new EventArgs());

            #region Grid fill

            #region Preparing Columns headers

            for (int fh = 0; fh < SFacilityes.Length; fh++)   // columns
            {
                tlpFacilityPriority.ColumnCount++;
                VerticalLabel lColumn = new VerticalLabel();
                lColumn.Text = SFacilityes[fh];
                //lColumn.TextAlign = ContentAlignment.BottomCenter;
                tlpFacilityPriority.Controls.Add(lColumn, tlpFacilityPriority.ColumnCount - 1, 0);
            }

            #endregion

            for (int pt = 0; pt < SPriorityes.Length; pt++)  // rows
            {
                #region Preparing row labels

                Label lRow = new Label();
                lRow.Text     = SPriorityes[pt];
                lRow.AutoSize = true;
                tlpFacilityPriority.Controls.Add(lRow, 0, tlpFacilityPriority.RowCount);

                #endregion

                int currentColumn = 1;
                tlpFacilityPriority.RowCount++;
                for (int ft = 0; ft < SFacilityes.Length; ft++) // columns
                {
                    int         fpNum      = SyslogFacilityPriorityPair.ConvertPairToInt(ft, pt);
                    RadioButton bSelection = new RadioButton();
                    bSelection.Width   = 16;
                    bSelection.Tag     = fpNum;
                    bSelection.Checked = config.LoggingFacilityPriority(eventLog, eventLogEntryType).AsInt() ==
                                         fpNum;
                    bSelection.CheckedChanged += BSelectionOnCheckedChanged;
                    tlpFacilityPriority.Controls.Add(bSelection, currentColumn, tlpFacilityPriority.RowCount - 1);
                    currentColumn++;
                }
            }

            #endregion
        }
Ejemplo n.º 2
0
 void eventLog_EntryWritten(object sender, EntryWrittenEventArgs e)
 {
     //<165>Aug 24 05:34:00 CST 1987 mymachine myproc[10]: %% It's
     //time to make the do-nuts.  %%  Ingredients: Mix=OK, Jelly=OK #
     //Devices: Mixer=OK, Jelly_Injector=OK, Frier=OK # Transport:
     //Conveyer1=OK, Conveyer2=OK # %%
     if (_config.LoggingEnabled(_eventLog, e.Entry.EntryType))
     {
         string logString = _config.LoggingFacilityPriority(_eventLog, e.Entry.EntryType).AsSyslogHead();
         logString += e.Entry.TimeGenerated.ToString("MMM dd HH:mm:ss ", _enUS);
         logString += e.Entry.MachineName.Trim().Replace(' ', '_');
         logString += " " + e.Entry.Source.Trim().Replace(' ', '_') + ": ";
         logString += e.Entry.Message.Trim();
         byte[] data = _encoding.GetBytes(logString);
         _udpClient.Send(data, data.Length);
     }
 }
Ejemplo n.º 3
0
 public void UpdateControls()
 {
     checkBox.Checked = _config.LoggingEnabled(_eventLog, _eventLogEntryType);
     textBox.Enabled  = checkBox.Checked;
     textBox.Text     = _config.LoggingFacilityPriority(_eventLog, _eventLogEntryType).AsString();
 }