public static void PerformancePredictorPopup(IList <TrailsItemTrackSelectionInfo> selections, IDailyActivityView view, System.Windows.Forms.ProgressBar progressBar) { try { if (GetPerformancePredictor != null) { IList <IItemTrackSelectionInfo> sels = TrailsItemTrackSelectionInfo.SetAndAdjustFromSelectionToST(selections); IList <IActivity> activities = new List <IActivity>(); foreach (TrailsItemTrackSelectionInfo t in selections) { //Should not matter if activities are added in order, //but activity is "lost" as string in IItemTrackSelectionInfo, supply possible activities activities.Add(t.Activity); } MethodInfo methodInfo = GetPerformancePredictor.GetMethod(_PerformancePredictorPopup); object resultFromPlugIn = methodInfo.Invoke(null, new object[] { activities, sels, view, progressBar }); } } catch (Exception e) { // Log error? throw new Exception(string.Format(IntegrationUtility.OtherPluginExceptionText, PerformancePredictorPlugin + ".dll", PerformancePredictorPluginName) + Environment.NewLine, e); } if (GetPerformancePredictor == null) { throw new Exception(string.Format(IntegrationUtility.OtherPluginExceptionText, PerformancePredictorPlugin + ".dll", PerformancePredictorPluginName) + Environment.NewLine); } }
//relatve fast call for 2150 activities, 0.03s called individually, 0.0016s called for all //369 8(7)ms no ideal, 402 16 (9) ms w ideal public static IList <PerformancePredictorResult> PerformancePredictorFields(IList <IActivity> activities, IList <double> times, IList <double> distances, IList <double> predictDistances, IList <double> times2, System.Windows.Forms.ProgressBar progressBar) { IList <PerformancePredictorResult> results = null; try { if (GetPerformancePredictor != null) { MethodInfo methodInfo = GetPerformancePredictor.GetMethod(_PerformancePredictorFields); object resultFromPlugIn = methodInfo.Invoke(null, new object[] { activities, times, distances, predictDistances, times2, progressBar }); results = new List <PerformancePredictorResult>(); foreach (IList <Object> o in (IList <IList <Object> >)resultFromPlugIn) { //Ignore null results //could be used to sync results for the same HighScore Goal, separate activities if (o != null) { results.Add(new PerformancePredictorResult(o)); } } } } catch (Exception e) { // Log error? throw new Exception(string.Format(IntegrationUtility.OtherPluginExceptionText, PerformancePredictorPlugin + ".dll", PerformancePredictorPluginName) + Environment.NewLine, e); } if (GetPerformancePredictor == null) { throw new Exception(string.Format(IntegrationUtility.OtherPluginExceptionText, PerformancePredictorPlugin + ".dll", PerformancePredictorPluginName) + Environment.NewLine); } return(results); }