コード例 #1
0
        public string GetText(object element, TreeList.Column column)
        {
            ActivityTrail at   = ((ActivityTrailWrapper)element).ActivityTrail;
            string        name = at.Trail.Name;

            if (at.Trail.Parent != null)
            {
                //Remove parent part, colon/space is flexible
                name = name.Substring(at.Trail.Parent.Name.Length + 1).TrimStart(' ', ':');
            }
            if (at.Trail.IsReference && null != at.Trail.ReferenceActivity)
            {
                DateTime time = ActivityInfoCache.Instance.GetInfo(at.Trail.ReferenceActivity).ActualTrackStart;
                if (DateTime.MinValue == time)
                {
                    time = at.Trail.ReferenceActivity.StartTime;
                }
                name += " " + time.ToLocalTime().ToString();
            }

            if (at.Status == TrailOrderStatus.Match ||
                at.Status == TrailOrderStatus.MatchPartial)
            {
                int n = at.Results.Count;
                foreach (Trail t2 in at.Trail.AllChildren)
                {
                    n += Controller.TrailController.Instance.GetActivityTrail(t2).Results.Count;
                }
                name += " (" + n;
                if (at.Trail.IsURFilter && at.FilteredResults.Count > 0)
                {
                    name += " ," + at.FilteredResults.Count;
                }
                name += ")";
            }
            else if (at.Status == TrailOrderStatus.MatchNoCalc)
            {
                if (at.Trail.TrailType == Trail.CalcType.Splits ||
                    at.Trail.TrailType == Trail.CalcType.UniqueRoutes)
                {
                    name += " (" + Controller.TrailController.Instance.Activities.Count + ")";
                }
            }
            else if ((at.Status == TrailOrderStatus.InBoundMatchPartial) &&
                     at.m_noResCount.ContainsKey(at.Status))
            {
                name += " (" + at.m_noResCount[at.Status];
                if (at.m_noResCount.ContainsKey(TrailOrderStatus.InBound))
                {
                    name += ", " + at.m_noResCount[TrailOrderStatus.InBound];
                }
                name += ")";
            }
            //Other results
            else if (at.m_noResCount.ContainsKey(at.Status))
            {
                name += " (" + at.m_noResCount[at.Status] + ")";
            }
            return(name);
        }
コード例 #2
0
        public System.Drawing.Image GetImage(object element, TreeList.Column column)
        {
            ActivityTrail t = ((ActivityTrailWrapper)element).ActivityTrail;

            //if (t.ActivityCount == 0)
            //{
            //    return Properties.Resources.square_blue;
            //}
            switch (t.Status)
            {
            case TrailOrderStatus.Match:
                return(Properties.Resources.square_green);

            case TrailOrderStatus.MatchNoCalc:
                return(Properties.Resources.square_green_check);

            case TrailOrderStatus.MatchPartial:
                return(Properties.Resources.square_green_minus);

            case TrailOrderStatus.InBoundNoCalc:
                return(Properties.Resources.square_green_plus);

            case TrailOrderStatus.InBoundMatchPartial:
                return(Properties.Resources.square_red_plus);

            case TrailOrderStatus.InBound:
                return(Properties.Resources.square_red);

            case TrailOrderStatus.NotInBound:
                return(Properties.Resources.square_blue);

            default:     //NoConfiguration, NoInfo, NotInstalled
                return(null);
            }
        }
コード例 #3
0
        public void SetCurrentActivityTrail(IList <ActivityTrail> activityTrails, bool manuallySet, System.Windows.Forms.ProgressBar progressBar)
        {
            //Create a copy of the trails to set - could be that activityTrails is cleared in next step
            IList <ActivityTrail> activityTrails2 = new List <ActivityTrail>();

            foreach (ActivityTrail to in activityTrails)
            {
                if (!activityTrails2.Contains(to))
                {
                    activityTrails2.Add(to);
                }
                foreach (Trail t2 in to.Trail.AllChildren)
                {
                    ActivityTrail to2 = GetActivityTrail(t2);
                    if (!activityTrails2.Contains(to2))
                    {
                        activityTrails2.Add(to2);
                    }
                }
            }

            this.m_currentActivityTrails.Clear();
            this.m_prevActivityTrails.Clear();
            if (manuallySet)
            {
                this.m_prevSelectedTrails.Clear();
            }

            foreach (ActivityTrail to in activityTrails2)
            {
                this.m_currentActivityTrails.Add(to);
                if (!to.Trail.Generated)
                {
                    this.m_prevActivityTrails.Add(to);
                }
                if (manuallySet)
                {
                    this.m_prevSelectedTrails.Add(to);
                }

                //Trigger result calculation, a current trail is always calculated
                if (progressBar != null)
                {
                    progressBar.Maximum++;
                }
                to.CalcResults(progressBar);
            }

            //Reference may have been changed
            this.checkReferenceTrailResult(progressBar);
        }
コード例 #4
0
        /***********************************************************/

        public void NewTrail(Trail trail, bool select, System.Windows.Forms.ProgressBar progressBar)
        {
            ActivityTrail at = new ActivityTrail(trail);

            this.m_CurrentOrderedTrails.Add(at);

            this.m_currentActivityTrails.Clear();
            if (select)
            {
                //Select this trail
                this.m_currentActivityTrails.Add(at);
                this.SetCurrentActivityTrail(this.m_currentActivityTrails, true, progressBar);
            }
        }
コード例 #5
0
 public void ReReadTrails()
 {
     m_CurrentOrderedTrails  = new List <ActivityTrail>();
     m_currentActivityTrails = new List <ActivityTrail>();
     foreach (Trail trail in TrailData.AllTrails.Values)
     {
         ActivityTrail to = new ActivityTrail(trail);
         this.m_CurrentOrderedTrails.Add(to);
         if (trail.IsReference)
         {
             this.m_referenceActivityTrail = to;
         }
     }
 }
コード例 #6
0
        public ActivityTrail GetActivityTrail(Trail t)
        {
            ActivityTrail res = null;

            foreach (ActivityTrail at in m_CurrentOrderedTrails)
            {
                if (at.Trail == t)
                {
                    res = at;
                    break;
                }
            }
            return(res);
        }
コード例 #7
0
        private bool DeleteTrail(ActivityTrail at)
        {
            bool result = false;

            if (at != null)
            {
                //Only the primary trail deleted
                at.Init();
                if (TrailData.DeleteTrail(at.Trail))
                {
                    this.m_CurrentOrderedTrails.Remove(at);
                    this.m_currentActivityTrails.Remove(at);
                    this.m_prevSelectedTrails.Remove(at);
                    at     = null;
                    result = true;
                }
            }
            return(result);
        }
コード例 #8
0
ファイル: Integration.cs プロジェクト: tsofron/trails
        //CalculatedFields integration
        public static Dictionary <string, List <ITrailResult> > GetTrailsResultsForActivities(IList <IActivity> activities)
        {
            var results = new Dictionary <string, List <ITrailResult> >();

            Controller.TrailController.Instance.Activities = activities;
            foreach (Trail trail in Data.TrailData.AllTrails.Values)
            {
                var activityTrail = new ActivityTrail(trail);

                List <ITrailResult> trailResults = new List <ITrailResult>();
                foreach (TrailResult tr in TrailResultWrapper.TrailResults(activityTrail.Results))
                {
                    if (!(tr is Data.PausedChildTrailResult))
                    {
                        trailResults.Add(new CFTrailResult(tr));
                    }
                }

                results.Add(trail.Name, trailResults);
            }

            return(results);
        }
コード例 #9
0
 public ActivityTrailWrapper(ActivityTrail trail)
     : base(null, trail)
 {
 }
コード例 #10
0
 private void SetCurrentActivityTrail(ActivityTrail activityTrail, bool manuallySet, System.Windows.Forms.ProgressBar progressBar)
 {
     SetCurrentActivityTrail(new List <ActivityTrail> {
         activityTrail
     }, manuallySet, progressBar);
 }
コード例 #11
0
 protected ParentTrailResult(ActivityTrail activityTrail, int order, TrailResultInfo indexes, float distDiff) :
     base(activityTrail, order, indexes, distDiff)
 {
 }
コード例 #12
0
 public HighScoreParentTrailResult(ActivityTrail activityTrail, int order, TrailResultInfo indexes, string toolTip)
     : base(activityTrail, order, indexes, 0)
 {
     this.m_toolTip = toolTip;
     this.UpdateIndexes(indexes);
 }
コード例 #13
0
 public SplitsParentTrailResult(ActivityTrail activityTrail, int order, TrailResultInfo indexes) :
     base(activityTrail, order, indexes, 0)
 {
     this.UpdateIndexes(indexes);
 }
コード例 #14
0
 //Normal TrailResult
 public PositionParentTrailResult(ActivityTrail activityTrail, int order, TrailResultInfo indexes, float distDiff, bool reverse)
     : base(activityTrail, order, indexes, distDiff)
 {
     this.m_reverse = reverse;
     this.UpdateIndexes(indexes);
 }
コード例 #15
0
ファイル: EditTrail.cs プロジェクト: tsofron/trails
        private void RefreshResult(bool recalculate)
        {
            if (Controller.TrailController.Instance.ReferenceActivity != null)
            {
                if (recalculate || this.m_trailResult == null)
                {
                    ActivityTrail at = new ActivityTrail(this.m_TrailToEdit);
                    at.CalcResults(new List <IActivity> {
                        Controller.TrailController.Instance.ReferenceActivity
                    }, this.m_TrailToEdit.MaxRequiredMisses, true, null);
                    if (at.Results.Count > 0)
                    {
                        this.m_trailResult = at.Results[0].Result;
                    }
                    else
                    {
                        at.Init();
                        at.CalcResults(new List <IActivity> {
                            Controller.TrailController.Instance.ReferenceActivity
                        }, 99, true, null);
                        if (at.Results.Count > 0)
                        {
                            //The best result is the result with most matches
                            //forward may be better than reverse, but those should be sorted first anyway
                            int currMaxRes = -1;
                            foreach (TrailResultWrapper tr in at.Results)
                            {
                                int res = 0;
                                foreach (DateTime d in tr.Result.TrailPointDateTime)
                                {
                                    if (d > DateTime.MinValue)
                                    {
                                        res++;
                                    }
                                }
                                if (res > currMaxRes)
                                {
                                    currMaxRes         = res;
                                    this.m_trailResult = tr.Result;
                                }
                            }
                        }
                        else
                        {
                            if (at.IncompleteResults.Count > 0)
                            {
                                //Result is already sorted after no of matches
                                this.m_trailResult = at.IncompleteResults[0];
                            }
                            else
                            {
                                this.m_trailResult = null;
                            }
                        }
                    }
                    at.Init();
                }
            }
            IList <EditTrailRow> l = EditTrailRow.getEditTrailRows(this.m_TrailToEdit, this.m_trailResult);
            int sel = EList_SelectedRow(); //Get one of the selected, if any

            this.EList.RowData = l;
            if (sel >= 0)
            {
                //This is incorrect if the trail was reversed
                this.EList.SelectedItems = new object[] { l[sel] };
            }

            foreach (EditTrailRow t in (IList <EditTrailRow>) this.EList.RowData)
            {
                //Note: For reverse results, this is incorrect (but reverse results are only for incomplete, so no impact)
                this.EList.SetChecked(t, t.TrailGPS.Required);
            }
        }