예제 #1
0
        /// <summary>
        /// Adds a new child to the list of children.
        /// </summary>
        /// <param name="entry">The new child entry.</param>
        /// <returns><c>true</c> if the entry was added successfully; otherwise <c>false</c>.</returns>
        public bool AddToGroupList(DialogEntry entry)
        {
            if (entry != null)
            {
                var entryStat = entry.Status;

                lock (SyncLock)
                {
                    try
                    {
                        if (ChildEntries.Contains(entry))
                        {
                            return(false);
                        }

                        ChildEntries.Add(entry);
                        registerToEvents(entry);
                        entry.ParentEntry  = this;
                        entry.ParentDialog = ParentDialog;
                    }
                    catch { }
                }

                // reset and set again to use the (entry)internal logic for the status.
                entry.Status = DialogEntryStatus.Normal;
                entry.Status = entryStat;
                fire_DialogEntryChanged("ChildEntries");
                return(true);
            }
            return(false);
        }
        public void FitChildEntries()
        {
            if (ChildEntries.Count == 0)
            {
                return;
            }

            // we've defined fitting only when overflow occurs towards the end
            Debug.Assert(ChildEntries.First().StartTimestamp >= StartTimestamp);

            DateTime childrenLastEndTimestamp = ChildEntries.Last().EndTimestamp;
            DateTime maxEndTimestamp          = childrenLastEndTimestamp > EndTimestamp ? childrenLastEndTimestamp : EndTimestamp;

            TimeSpan elapsedTimeWithOverflow = maxEndTimestamp - StartTimestamp;
            double   scale = elapsedTimeWithOverflow.Ticks > 0 ? (double)ElapsedTime.Ticks / elapsedTimeWithOverflow.Ticks : 1.0;

            Debug.Assert(scale <= 1.0);

            if (scale < 1.0)
            {
                ScaleTimestamps(scale);
            }

            foreach (TimelineEntry child in ChildEntries)
            {
                child.FitChildEntries();
            }
        }
 /// <summary>
 /// Exposes an enumerator, which supports a simple iteration over a non-generic collection.
 /// </summary>
 /// <returns>
 /// A <see cref="T:System.Collections.IEnumerator" />-object.
 /// </returns>
 virtual public System.Collections.IEnumerator GetEnumerator()
 {
     if (ChildEntries != null)
     {
         return(ChildEntries.GetEnumerator());
     }
     return(null);
 }
예제 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RadioButton_DialogEntry" /> class.
 /// </summary>
 /// <param name="ID">The unique identifier.</param>
 /// <param name="text">The text that is displayed.</param>
 /// <param name="help">The help text explaining the functionality behind this entry.</param>
 /// <param name="parentEntry">The parent entry (must be some kind of group type).</param>
 /// <param name="parentDialog">The parent dialog this entry is related to. Can be <c>null</c> - when added to a Dialog this Field will be set automatically.</param>
 /// <param name="children">The children to add to the group.</param>
 public Group_DialogEntry(
     string ID,
     string text,
     string help                      = "...",
     DialogEntry parentEntry          = null,
     Dialog parentDialog              = null,
     List <IDialogComponent> children = null
     )
     : base(ID, text, help, DialogEntryType.Group, DialogEntryStatus.Normal, parentEntry, parentDialog)
 {
     if (children != null)
     {
         ChildEntries.AddRange(children);
     }
 }
예제 #5
0
 public CatalogEntry Clone()
 {
     return(new CatalogEntry()
     {
         Mutation = Mutation,
         ImageFormat = ImageFormat,
         CatalogEntryMode = CatalogEntryMode,
         OriginName = UniqueName,
         UniqueName = GetUniqueName(),
         ImageInfo = ImageInfo,
         EntryType = EntryType,
         Active = Active,
         TransitionTimeInSeconds = TransitionTimeInSeconds,
         StartTimeRatio = StartTimeRatio,
         EndTimeRatio = EndTimeRatio,
         ChildEntries = ChildEntries.Select(childEntry => childEntry.Clone()).ToList()
     });
 }
예제 #6
0
 /// <summary>
 /// Removes an child from the list.
 /// </summary>
 /// <param name="entry">The entry to remove.</param>
 /// <returns><c>true</c> if the child entry could be removed; otherwise <c>false</c>.</returns>
 public bool RemoveFromGroupList(DialogEntry entry)
 {
     if (entry != null)
     {
         bool success;
         lock (SyncLock)
         {
             success = ChildEntries.Remove(entry);
             if (success)
             {
                 entry.ParentEntry = null;
                 fire_DialogEntryChanged("ChildEntries");
             }
         }
         return(success);
     }
     else
     {
         return(false);
     }
 }
예제 #7
0
 public void AddChild(BuildEntry entry)
 {
     ChildEntries.Add(entry);
     entry.Parent = this;
 }
 public void AddChild(TimelineEntry entry)
 {
     ChildEntries.Add(entry);
     entry.Parent = this;
 }