void buttonNewSession_Click(object sender, EventArgs e) { uint fileSize = 0; bool ret = UInt32.TryParse(textLogFileSize.Text, out fileSize); if (!ret || fileSize > ETWWsatTraceSession.MaxLogFileSize || fileSize == 0) { textLogFileSize.Focus(); ShowErrorDialog(SR.GetString(SR.ErrorSessionLogFileSize)); return; } try { ETWWsatTraceSession.StartSession(fileSize); buttonNewSession.Enabled = false; buttonStopSession.Enabled = true; buttonFlushData.Enabled = true; textLogFileSize.Enabled = false; } catch (WsatAdminException ex) { ShowErrorDialog(ex); } }
void buttonFlushData_Click(object sender, EventArgs e) { try { ETWWsatTraceSession.FlushData(); } catch (WsatAdminException ex) { ShowErrorDialog(ex); } }
void buttonStopSession_Click(object sender, EventArgs e) { try { ETWWsatTraceSession.StopSession(); buttonNewSession.Enabled = true; buttonStopSession.Enabled = false; buttonFlushData.Enabled = false; textLogFileSize.Enabled = true; } catch (WsatAdminException ex) { ShowErrorDialog(ex); } }
void buttonOK_Click(object sender, EventArgs e) { if (config.IsLocalMachine) { uint fileSize = 0; bool ret = UInt32.TryParse(textLogFileSize.Text, out fileSize); if (!ret || fileSize > ETWWsatTraceSession.MaxLogFileSize || fileSize == 0) { textLogFileSize.Focus(); ShowErrorDialog(SR.GetString(SR.ErrorSessionLogFileSize)); return; } try { ETWWsatTraceSession.SaveMaxTraceFileSizeToReg(fileSize); } catch (WsatAdminException ex) { ShowErrorDialog(ex); return; } } if (comboBoxTraceLevel.SelectedItem != null) { string traceLevelString = comboBoxTraceLevel.SelectedItem.ToString(); SourceLevels traceLevel; if (!Utilities.ParseSourceLevel(traceLevelString, out traceLevel)) { traceLevel = WsatConfiguration.DefaultTraceLevel; } config.TraceLevel = traceLevel; config.ActivityTracing = checkBoxActivityTracing.Checked; config.ActivityPropagation = checkBoxActivityPropagation.Checked; config.TracePii = checkBoxTracePii.Checked; } DialogResult = DialogResult.OK; }
internal TraceOptionsForm(WsatConfiguration config) { if (config == null) { throw new ArgumentNullException("config"); } this.config = config; InitializeComponent(); if (config.IsLocalMachine) { bool isRegError = false; try { textLogFileSize.Text = ETWWsatTraceSession.GetMaxTraceFileSizeFromReg().ToString(System.Globalization.CultureInfo.InvariantCulture); } catch (WsatAdminException ex) { isRegError = true; ShowErrorDialog(ex); } bool isSessionExist = ETWWsatTraceSession.IsSessionExist(); buttonNewSession.Enabled = !isSessionExist && !isRegError; buttonStopSession.Enabled = isSessionExist && !isRegError; buttonFlushData.Enabled = isSessionExist && !isRegError; textLogFileSize.Enabled = !isSessionExist && !isRegError; } else { textLogFileSize.Text = ETWWsatTraceSession.DefaultLogFileSize.ToString(System.Globalization.CultureInfo.InvariantCulture); groupBoxLoggingSession.Enabled = false; } }