Example #1
0
        public static void HighScorePopup(IList <IActivity> activities, IList <IValueRangeSeries <DateTime> > pauses, IDailyActivityView view, System.Windows.Forms.ProgressBar progressBar)
        {
            try
            {
                if (GetHighScore != null)
                {
                    MethodInfo methodInfo       = GetHighScore.GetMethod(_HighScorePopup);
                    object     resultFromPlugIn = methodInfo.Invoke(null, new object[] { activities, pauses, view, progressBar });
                }
            }
            catch (Exception e)
            {
                // Log error?
                throw new Exception(string.Format(IntegrationUtility.OtherPluginExceptionText,
                                                  HighScorePlugin + ".dll", HighScorePluginName) + Environment.NewLine, e);
            }

            if (GetHighScore == null)
            {
                throw new Exception(string.Format(IntegrationUtility.OtherPluginExceptionText,
                                                  HighScorePlugin + ".dll", HighScorePluginName) + Environment.NewLine);
            }
        }
Example #2
0
        public static IList <HighScoreResult> GetHighScoreForActivity(IList <IActivity> activities, int noOfResults, System.Windows.Forms.ProgressBar progressBar)
        {
            IList <HighScoreResult> results = null;

            try
            {
                if (GetHighScore != null)
                {
                    MethodInfo methodInfo       = GetHighScore.GetMethod(getHighScore);
                    object     resultFromPlugIn = methodInfo.Invoke(null, new object[] { activities, noOfResults, progressBar });
                    results = new List <HighScoreResult>();
                    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 HighScoreResult(o));
                        }
                    }
                }
            }
            catch (Exception e)
            {
                // Log error?
                throw new Exception(string.Format(IntegrationUtility.OtherPluginExceptionText,
                                                  HighScorePlugin + ".dll", HighScorePluginName) + Environment.NewLine, e);
            }

            if (GetHighScore == null)
            {
                throw new Exception(string.Format(IntegrationUtility.OtherPluginExceptionText,
                                                  HighScorePlugin + ".dll", HighScorePluginName) + Environment.NewLine);
            }

            return(results);
        }