示例#1
0
        private void dataGridViewExportSettings_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            if (!this.CanFocus || e.RowIndex >= dataGridViewExportSettings.Rows.Count || e.RowIndex < 0)
            {
                return;
            }

            string reportName        = (string)dataGridViewExportSettings.Rows[e.RowIndex].Cells[1].Value;
            string reportFileName    = "";
            string reportDisplayName = "";

            switch (e.ColumnIndex)
            {
            case 2:     // Report filename changed
                reportFileName = (string)dataGridViewExportSettings.Rows[e.RowIndex].Cells[2].Value;
                _telemetryWriter.EnableReportExport(reportName, reportFileName);
                break;

            case 3:     // Report enabled status changed
                bool reportEnabled = (bool)dataGridViewExportSettings.Rows[e.RowIndex].Cells[3].Value;
                if (reportEnabled)
                {
                    reportFileName = $"{_filePrefix}{reportName}.txt";
                    dataGridViewExportSettings.Rows[e.RowIndex].Cells[2].Value = reportFileName;
                }
                else
                {
                    dataGridViewExportSettings.Rows[e.RowIndex].Cells[2].Value = "";
                }
                _telemetryWriter.EnableReportExport(reportName, reportFileName);
                break;

            case 4:     // Report display name changed
                reportDisplayName = (string)dataGridViewExportSettings.Rows[e.RowIndex].Cells[4].Value;
                _telemetryWriter.EnableReportDisplay(reportName, reportDisplayName);
                break;

            case 5:     // Report display enabled changed
                bool reportDisplayEnabled = (bool)dataGridViewExportSettings.Rows[e.RowIndex].Cells[5].Value;
                if (reportDisplayEnabled)
                {
                    reportDisplayName = reportName;
                    dataGridViewExportSettings.Rows[e.RowIndex].Cells[4].Value = reportDisplayName;
                }
                else
                {
                    dataGridViewExportSettings.Rows[e.RowIndex].Cells[4].Value = "";
                }
                _telemetryWriter.EnableReportDisplay(reportName, reportDisplayName);
                break;
            }
            SelectedReportsChanged?.Invoke(this, null);
        }
示例#2
0
        private void DisplayAllReports()
        {
            List <string> allReports = TelemetryDescriptions.Keys.ToList();

            foreach (string report in allReports)
            {
                _srvTelemetryWriter.EnableReportDisplay(report, report);
            }
        }