public void Add(MetricsType metric) { switch (metric) { case MetricsType.Purity: _bag.Add(metric, new Purity()); break; } }
public double?GetMetric(MetricsType metric) { if (_bag.ContainsKey(metric)) { return(_bag[metric].Get()); } else { return(null); } }
/// <summary> /// Get modified control size based on the multiplication factor. /// </summary> /// <param name="val">The original value.</param> /// <param name="type">Width / Height.</param> /// <returns>The modified value.</returns> private static int GetMetrics(int val, MetricsType type) { if (type == MetricsType.Width) { return((int)Math.Floor(val * MulFac.Width)); } else if (type == MetricsType.Height) { return((int)Math.Floor(val * MulFac.Height)); } return(0); }
public static IMetricsConverter GetConverter(MetricsType type) { switch (type) { case MetricsType.SecondLevelCache: return new SecondLevelCacheMetricsConverter(); case MetricsType.Transaction: return new TransactionMetricsConverter(); case MetricsType.Connection: return new ConnectionMetricsConverter(); case MetricsType.Command: return new CommandMetricsConverter(); default: throw new NotSupportedException(type.ToString()); } }
public async Task CreateNewWorkAsync(ConstructionWorksInputModel input) { ConstructionCategory category = this.context.ConstructionCategories.SingleOrDefault(x => x.Name == input.ConstructionCategory); MetricsType metric = this.context.MetricsTypes.SingleOrDefault(x => x.Name == input.Metric); ConstructionWork work = new ConstructionWork() { Title = input.Title, Metric = metric, Price = input.Price, ConstructionCategory = category, }; await this.context.ConstructionWorks.AddAsync(work); await this.context.SaveChangesAsync(); }
public static IMetricsConverter GetConverter(MetricsType type) { switch (type) { case MetricsType.SecondLevelCache: return(new SecondLevelCacheMetricsConverter()); case MetricsType.Transaction: return(new TransactionMetricsConverter()); case MetricsType.Connection: return(new ConnectionMetricsConverter()); case MetricsType.Command: return(new CommandMetricsConverter()); default: throw new NotSupportedException(type.ToString()); } }
internal static extern int GetSystemMetrics(MetricsType nIndex);
private static MetricsView GetMetricsView(string name, MetricsType type) { return(new MetricsView { Name = name, Type = type }); }
internal static extern int GetSystemMetrics(MetricsType nIndex);
private static MetricsView GetMetricsView(string name, MetricsType type) { return new MetricsView { Name = name, Type = type }; }