public NotificationWindow(NotificationWindow parent)
 {
     this.parent = parent;
     InitializeComponent();
     if (this.parent == null)
     {
         hideTimer.Tick   += HideTimerOnTick;
         updateTimer.Tick += UpdateTimerOnTick;
         new PositionPersister().Persist(this);
     }
 }
        public void Show(AppointmentGroup appointments)
        {
            Trace.WriteLine("Show " + appointments);

            if (appointments == null || !appointments.Next.Any())
            {
                return;
            }

            var distinctTimes = 1;
            var prev          = appointments.Next.First();
            var first         = prev;
            var prevWindow    = this;

            Show(prev);

            foreach (var appointment in appointments.Next.Skip(1))
            {
                if (appointment.Start > prev.Start)
                {
                    if (distinctTimes++ > 2 && appointment.Start.Subtract(first.Start).TotalMinutes > 15)
                    {
                        break;
                    }
                }

                var child = new NotificationWindow(this);
                children.Add(child);
                child.Top  = prevWindow.Top + prevWindow.Height + 5;
                child.Left = Left;
                child.Show(appointment);
                prevWindow = child;
            }

            EnsureChildrenOnScreen();
        }