コード例 #1
0
ファイル: TrendsCategoryBase.cs プロジェクト: guozanhua/phmi
 internal override void ApplyRemapResult(RemapTrendsResult result)
 {
     if (result == null)
     {
         var empty = new Tuple<DateTime, double>[0];
         if (_currentSamplesCallabacks != null)
         {
             foreach (var action in _currentSamplesCallabacks.SelectMany(callaback => callaback))
             {
                 action(empty);
             }
         }
         if (_pageSamplesCallbacks != null)
         {
             foreach (var action in _pageSamplesCallbacks.SelectMany(callback => callback))
             {
                 action(empty);
             }
         }
         return;
     }
     for (var i = 0; i < result.Samples.Length; i++)
     {
         var s = result.Samples[i];
         var callbacks = _currentSamplesCallabacks[i];
         for (var j = 0; j < callbacks.Length; j++)
         {
             var samples = (from item in s
                            let v = item.Item2[j]
                            where v.HasValue
                            select new Tuple<DateTime, double>(item.Item1, v.Value)).ToArray();
             callbacks[j](samples);
         }
     }
     for (var i = 0; i < result.Pages.Length; i++)
     {
         var s = result.Pages[i];
         var callbacks = _pageSamplesCallbacks[i];
         for (var j = 0; j < callbacks.Length; j++)
         {
             var samples = (from item in s
                            let v = item.Item2[j]
                            where v.HasValue
                            select new Tuple<DateTime, double>(item.Item1, v.Value)).ToArray();
             callbacks[j](samples);
         }
     }
 }
コード例 #2
0
ファイル: Service.cs プロジェクト: guozanhua/phmi
 private static void ReadTrendsSamples(RemapTrendsParameter parameter, RemapTrendsResult result, ITrendsRunTarget runTarget)
 {
     var r = new Tuple<DateTime, double?[]>[parameter.SamplesParameters.Length][];
     for (var i = 0; i < parameter.SamplesParameters.Length; i++)
     {
         var samplesParameter = parameter.SamplesParameters[i];
         r[i] = runTarget.GetSamples(
             samplesParameter.Item1, samplesParameter.Item2, samplesParameter.Item3, samplesParameter.Item4);
     }
     result.Samples = r;
 }
コード例 #3
0
ファイル: Service.cs プロジェクト: guozanhua/phmi
 public RemapTrendsResult[] RemapTrends(RemapTrendsParameter[] parameters)
 {
     if (NotValid())
         return null;
     var result = new RemapTrendsResult[parameters.Length];
     for (var i = 0; i < parameters.Length; i++)
     {
         var parameter = parameters[i];
         var trendsRunTarget = _project.TrendsRunTargets[parameter.CategoryId];
         var r = new RemapTrendsResult();
         ReadTrendsSamples(parameter, r, trendsRunTarget);
         ReadTrendsPages(parameter, r, trendsRunTarget);
         r.Notifications = GetNotifications(trendsRunTarget.Reporter.Notifications);
         result[i] = r;
     }
     return result;
 }
コード例 #4
0
ファイル: TrendsService.cs プロジェクト: guozanhua/phmi
 private void ApplyResult(TrendsCategoryAbstract category, RemapTrendsResult result)
 {
     _reporter.Report(result.Notifications);
     category.ApplyRemapResult(result);
 }
コード例 #5
0
 internal abstract void ApplyRemapResult(RemapTrendsResult result);