private void textBox_TextChanged(object sender, EventArgs e) { string[] splitted = textBox.Text.Trim().Split(':'); int facility = System.Convert.ToInt32(splitted[0]); int priority = System.Convert.ToInt32(splitted[1]); if (facility > 23) { facility = 23; } if (facility < 0) { facility = 0; } if (priority > 7) { priority = 7; } if (priority < 0) { priority = 0; } SyslogFacilityPriorityPair pair = new SyslogFacilityPriorityPair(facility, priority); _config.SetLoggingFacilityPriority(_eventLog, _eventLogEntryType, pair); UpdateControls(); }
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 }
private void textBox_TextChanged(object sender, EventArgs e) { string[] splitted = textBox.Text.Trim().Split(':'); int facility = System.Convert.ToInt32(splitted[0]); int priority = System.Convert.ToInt32(splitted[1]); if (facility > 23) { facility = 23; } if (facility < 0) { facility = 0 ; } if (priority > 7) { priority = 7 ; } if (priority < 0) { priority = 0 ; } SyslogFacilityPriorityPair pair = new SyslogFacilityPriorityPair(facility, priority); _config.SetLoggingFacilityPriority(_eventLog, _eventLogEntryType, pair); UpdateControls(); }
public void SetLoggingFacilityPriority(EventLog eventLog, EventLogEntryType eventLogEntryType, SyslogFacilityPriorityPair sfpp) { _registry.Write(eventLog.Log, eventLogEntryType.ToString() + "FP", sfpp.AsInt()); }
private void BSelectionOnCheckedChanged(object o, EventArgs eventArgs) { _pair = new SyslogFacilityPriorityPair((int)(((RadioButton)o).Tag)); DialogResult = DialogResult.OK; }
private void BSelectionOnCheckedChanged(object o, EventArgs eventArgs) { _pair = new SyslogFacilityPriorityPair((int)(((RadioButton) o).Tag)); DialogResult = DialogResult.OK; }