Пример #1
0
        public DateTime?GetDateTime(TRB_KIND kind, TRB_PART part, TRB_PART where, TRB_STATE whereState)
        {
            DateTime?dt = null;

            switch (kind)
            {
            case TRB_KIND.MINIMUM:
                dt = TimeBoxCollection.Where(trb => trb.GetDateTime(where, whereState) != null).Min(trb => trb.GetDateTime(part));
                break;

            case TRB_KIND.MAXIMUM:
                dt = TimeBoxCollection.Where(trb => trb.GetDateTime(where, whereState) != null).Max(trb => trb.GetDateTime(part));
                break;

            case TRB_KIND.FIRST:
            {
                var atrb =
                    TimeBoxCollection.Where(trb => trb.GetDateTime(where, whereState) != null).FirstOrDefault(trb => null != trb.GetDateTime(part));
                dt = atrb != null?atrb.GetDateTime(part) : null;
            }
            break;

            case TRB_KIND.LAST:
            {
                var atrb =
                    TimeBoxCollection.Where(trb => trb.GetDateTime(where, whereState) != null).LastOrDefault(trb => null != trb.GetDateTime(part));
                dt = atrb != null?atrb.GetDateTime(part) : null;
            }
            break;
            }
            return(dt);
        }
Пример #2
0
        public DateTime?GetDateTime(TRB_KIND kind, TRB_PART part, TRB_PART where, TRB_STATE whereState)
        {
            DateTime?dt = null;

            switch (kind)
            {
            case TRB_KIND.MINIMUM:
                dt = ProjectCollection.Min(proj => proj.GetDateTime(kind, part, where, whereState));
                break;

            case TRB_KIND.MAXIMUM:
                dt = ProjectCollection.Max(proj => proj.GetDateTime(kind, part, where, whereState));
                break;

            case TRB_KIND.FIRST:
                break;

            case TRB_KIND.LAST:
                break;

            default:
                break;
            }

            return(dt);
        }
Пример #3
0
        internal static TimeBox FromSetting(string txt)
        {
            try
            {
                var part = txt.Split(" ".ToCharArray(), StringSplitOptions.None);

                DateTime  dt0        = _deserialize(part[0]);
                DateTime  dt1        = _deserialize(part[1]);
                TRB_STATE startState = (TRB_STATE)Enum.Parse(typeof(TRB_STATE), part[2]);
                TRB_STATE endState   = (TRB_STATE)Enum.Parse(typeof(TRB_STATE), part[3]);
                TRB_STATE wholeState = (TRB_STATE)Enum.Parse(typeof(TRB_STATE), part[4]);

                TimeBox tbox = new TimeBox(dt0, dt1);
                tbox.StartState = startState;
                tbox.EndState   = endState;
                tbox.WholeState = wholeState;
                return(tbox);
            }
            catch
            {
                // ignored
            }

            return(null);
        }
Пример #4
0
 public static void writeOut(TRB_STATE state, bool withHeader = true)
 {
     if (withHeader)
     {
         Console.WriteLine("a  sWAS : aNY,   sNAPPED, WARNING, ARMED, SELECTED");
     }
     Console.WriteLine(Convert.ToString((int)state, 2).PadLeft(32, '0').Substring(25));
 }
Пример #5
0
 internal void TimeBoxClearContainedEdits(TRB_PART part, TRB_STATE state)
 {
     // edits within time boxes
     TimeBoxCollection.ForEach(trb =>
     {
         if (trb.HasState(part, state))
         {
             trb.ClearContainedEdits();
         }
     });
 }
Пример #6
0
 internal void TimeBoxDelete(TRB_PART part, TRB_STATE state, bool visibleOnly = true)
 {
     ProjectCollection.ForEach(proj =>
     {
         if (proj.Visible || !visibleOnly)
         {
             proj.DeleteTimeBoxes(part, state);
         }
     }
                               );
     ActivityTraceBuilder.Buildv2(this);
 }
Пример #7
0
        internal List <DateTime> GetDateTimes(TRB_PART part, TRB_STATE partState)
        {
            List <DateTime> ret = new List <DateTime>();

            foreach (var trb in TimeBoxCollection)
            {
                var tmp = trb.GetDateTimes(part, partState);
                if (tmp.Count > 0)
                {
                    ret.AddRange(tmp);
                }
            }

            return(ret);
        }
Пример #8
0
 internal void TimeBoxClearContainedEdits(TRB_PART part, TRB_STATE state, bool visibleOnly = true)
 {
     lock (tableLock)
     {
         ProjectCollection.ForEach(proj =>
         {
             if (proj.Visible || !visibleOnly)
             {
                 proj.TimeBoxClearContainedEdits(part, state);
             }
         }
                                   );
         _sortAndSanitize();
         _setTimeExtents();
         _organizeIntoProjects();
         ActivityTraceBuilder.Buildv2(this);
     }
 }
Пример #9
0
 internal void UnsetState(TRB_PART part, TRB_PART where, TRB_STATE whereState, TRB_STATE state)
 {
     ProjectCollection.ForEach(proj => proj.UnsetState(part, where, whereState, state));
 }
Пример #10
0
 internal void SetState(TRB_PART part, TRB_STATE state)
 {
     ProjectCollection.ForEach(proj => proj.SetState(part, state));
 }
Пример #11
0
 internal void DeleteTimeBoxes(TRB_PART part, TRB_STATE state)
 {
     TimeBoxCollection.RemoveAll(trb => trb.HasState(part, state));
 }
Пример #12
0
 internal void ToggleState(TRB_PART part, TRB_PART where, TRB_STATE state)
 {
     TimeBoxCollection.ForEach(trb => trb.ToggleState(part, where, state));
 }
Пример #13
0
 internal void UnsetState(TRB_PART part, TRB_PART where, TRB_STATE whereState, TRB_STATE state)
 {
     TimeBoxCollection.ForEach(trb => trb.UnsetState(part, where, whereState, state));
 }
Пример #14
0
 internal void SetState(TRB_PART part, TRB_STATE state)
 {
     TimeBoxCollection.ForEach(trb => trb.SetState(part, state));
 }
Пример #15
0
 internal void SetDateTime(TRB_PART part, TRB_STATE partState, DateTime dt)
 {
     TimeBoxCollection.ForEach(trb => trb.SetDateTime(part, partState, dt));
 }
Пример #16
0
 internal void ToggleState(TRB_PART part, TRB_PART where, TRB_STATE state)
 {
     ProjectCollection.ForEach(proj => proj.ToggleState(part, where, state));
 }
Пример #17
0
 internal bool HasState(TRB_PART part, TRB_STATE state)
 {
     return(ProjectCollection.FirstOrDefault(proj => proj.HasState(part, state)) != null);
 }
Пример #18
0
 internal bool HasState(TRB_PART part, TRB_STATE state)
 {
     return(TimeBoxCollection.FirstOrDefault(trb => trb.HasState(part, state)) != null);
 }