Example #1
0
        /// <summary>
        /// Handles the Click event of the createMetricButton control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void createMetricButton_Click(object sender, EventArgs e)
        {
            var f = new CreateMetricForm();
            if (f.ShowDialog(this) == DialogResult.OK)
            {
                var metric = new PerformanceCounterMetric()
                {
                    Name = f.MetricName,
                    ReportInterval = f.ReportInterval,
                    Unit = f.Unit,
                    PerformanceCounter = performanceCounterSelector.SelectedItem
                };

                try
                {
                    var client = ManagementServiceClient.Create();
                    client.AddMetric(metric);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                refeshToolStripMenuItem_Click(this, new EventArgs());
            }
        }
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = PerformanceCounterMetric.GetHashCode();
         hashCode = (hashCode * 397) ^ (int)AssertionType;
         hashCode = (hashCode * 397) ^ Assertion.GetHashCode();
         return(hashCode);
     }
 }
 public bool Equals(PerformanceCounterBenchmarkSetting other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(PerformanceCounterMetric.Equals(other.PerformanceCounterMetric) &&
            AssertionType == other.AssertionType &&
            Assertion.Equals(other.Assertion));
 }