public override HashSet <IPeriod> Evaluate(IDateTime referenceDate, DateTime periodStart, DateTime periodEnd, bool includeReferenceDateInResults)
        {
            // Create a recurrence pattern suitable for use during evaluation.
            IRecurrencePattern pattern = ProcessRecurrencePattern(referenceDate);

            // Enforce evaluation restrictions on the pattern.
            EnforceEvaluationRestrictions(pattern);

            HashSet <IPeriod> periods = new HashSet <IPeriod>();

            foreach (DateTime dt in GetDates(referenceDate, periodStart, periodEnd, -1, pattern, includeReferenceDateInResults))
            {
                // Create a period from the date/time.
                IPeriod p = CreatePeriod(dt, referenceDate);

                if (!periods.Contains(p))
                {
                    periods.Add(p);
                }
            }


            Periods.Clear();

            Periods.UnionWith(periods);

            return(Periods);
        }
Exemple #2
0
        async Task ExecuteLoadPeriodCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Periods.Clear();
                var periods = await DataStoreP.GetPeriodsAsync(true);

                foreach (var period in periods)
                {
                    Periods.Add(period);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
        public async void LoadGpnAsync()
        {
            if (string.IsNullOrEmpty(GpnFile))
            {
                return;
            }

            try
            {
                GpnLoadDateTime = null;
                IsBusy          = true;
                Periods.Clear();

                BusyText = "Untis Datei laden...";
                Result   = await UntisExporter.ParseFileAsync(GpnFile);

                foreach (var period in Result.Periods)
                {
                    Periods.Add(period);
                }

                GpnLoadDateTime = DateTime.Now;
            }
            catch (Exception e)
            {
                await dialogCoordinator.ShowMessageAsync(this, "Fehler beim Laden der Untis-Datei", e.Message, MessageDialogStyle.Affirmative);

                Result = null;
            }
            finally
            {
                IsBusy   = false;
                BusyText = "";
            }
        }
Exemple #4
0
        public override IList <IPeriod> Evaluate(IDateTime referenceDate, DateTime periodStart, DateTime periodEnd, bool includeReferenceDateInResults)
        {
            // Create a recurrence pattern suitable for use during evaluation.
            IRecurrencePattern pattern = ProcessRecurrencePattern(referenceDate);

            // Enforce evaluation restrictions on the pattern.
            EnforceEvaluationRestrictions(pattern);

            Periods.Clear();
            foreach (DateTime dt in GetDates(referenceDate, periodStart, periodEnd, -1, pattern, includeReferenceDateInResults))
            {
                // Turn each resulting date/time into an IDateTime and associate it
                // with the reference date.
                IDateTime newDt = new iCalDateTime(dt, referenceDate.TZID);

                // NOTE: fixes bug #2938007 - hasTime missing
                newDt.HasTime = referenceDate.HasTime;

                newDt.AssociateWith(referenceDate);

                // Create a period from the new date/time.
                IPeriod p = new Period(newDt);

                if (!Periods.Contains(p))
                {
                    Periods.Add(p);
                }
            }

            return(Periods);
        }
Exemple #5
0
        /// <summary>
        /// Refresh cached data.
        /// </summary>
        /// <param name="userContext">User context.</param>
        protected override void RefreshCache(IUserContext userContext)
        {
            lock (FactorOrigins)
            {
                FactorOrigins.Clear();
            }

            lock (FactorUpdateModes)
            {
                FactorUpdateModes.Clear();
            }

            lock (FactorFieldTypes)
            {
                FactorFieldTypes.Clear();
            }

            lock (PeriodTypes)
            {
                PeriodTypes.Clear();
            }

            lock (Periods)
            {
                Periods.Clear();
            }
            lock (IndividualCategories)
            {
                IndividualCategories.Clear();
            }
            lock (FactorFieldEnums)
            {
                FactorFieldEnums.Clear();
            }

            lock (FactorDataTypes)
            {
                FactorDataTypes.Clear();
            }
            lock (Factors)
            {
                Factors.Clear();
            }

            lock (FactorTrees)
            {
                FactorTrees.Clear();
            }

            lock (FactorTreeNodes)
            {
                FactorTreeNodes.Clear();
            }

            lock (OrganismGroups)
            {
                OrganismGroups.Clear();
            }
        }
Exemple #6
0
 private void Initialize()
 {
     Periods.Clear();
     foreach (QuotePeriod period in Enum.GetValues(typeof(QuotePeriod)))
     {
         Periods.Add(CalculateChartData(period));
     }
 }
Exemple #7
0
 /// <summary>
 /// Frees all the project's resources helping the GC
 /// </summary>
 public void Clear()
 {
     timeline.Clear();
     Categories.Clear();
     VisitorTeamTemplate.Clear();
     LocalTeamTemplate.Clear();
     Periods.Clear();
     Timers.Clear();
 }
Exemple #8
0
 private void Periods_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     Periods.Clear();
     foreach (PeriodViewModel period in MainViewModel.Instance.Parameters.Periods)
     {
         Periods.Add(period);
     }
     SelectedPeriod = Periods.FirstOrDefault();
 }
Exemple #9
0
 /// <summary>
 /// Frees all the project's resources helping the GC
 /// </summary>
 public void Clear()
 {
     Timeline.Clear();
     Dashboard.List.Clear();
     VisitorTeamTemplate.List.Clear();
     LocalTeamTemplate.List.Clear();
     Periods.Clear();
     Timers.Clear();
 }
        /// <summary>
        /// Clears a previous evaluation, usually because one of the
        /// key elements used for evaluation has changed
        /// (Start, End, Duration, recurrence rules, exceptions, etc.).
        /// </summary>
        virtual public void ClearEvaluation()
        {
            EvalStart = null;
            EvalEnd   = null;
            Periods.Clear();

            foreach (Alarm alarm in Alarms)
            {
                alarm.Occurrences.Clear();
            }
        }
 /// <summary>
 /// Refresh cached data.
 /// </summary>
 /// <param name="userContext">User context.</param>
 protected virtual void RefreshCache(IUserContext userContext)
 {
     FactorOrigins.Clear();
     FactorUpdateModes.Clear();
     FactorFieldTypes.Clear();
     PeriodTypes.Clear();
     Periods.Clear();
     IndividualCategories.Clear();
     FactorFieldEnums.Clear();
     FactorDataTypes.Clear();
     Factors.Clear();
     FactorTrees.Clear();
     FactorTreeNodes.Clear();
     OrganismGroups.Clear();
 }
        public override HashSet <Period> Evaluate(IDateTime referenceDate, DateTime periodStart, DateTime periodEnd, bool includeReferenceDateInResults)
        {
            // Create a recurrence pattern suitable for use during evaluation.
            var pattern = ProcessRecurrencePattern(referenceDate);

            // Enforce evaluation restrictions on the pattern.
            EnforceEvaluationRestrictions(pattern);
            Periods.Clear();

            var periodQuery = GetDates(referenceDate, periodStart, periodEnd, -1, pattern, includeReferenceDateInResults)
                              .Select(dt => CreatePeriod(dt, referenceDate));

            Periods.UnionWith(periodQuery);

            return(Periods);
        }
Exemple #13
0
 protected override void DisposeManagedResources()
 {
     base.DisposeManagedResources();
     Dashboard?.Dispose();
     FileSet.Dispose();
     if (Timeline != null)
     {
         foreach (TimelineEvent evt in Timeline)
         {
             evt.Dispose();
         }
     }
     if (EventTypes != null)
     {
         foreach (var eventType in EventTypes)
         {
             eventType.Dispose();
         }
         EventTypes.Clear();
     }
     if (Timers != null)
     {
         foreach (var element in Timers)
         {
             element.Dispose();
         }
         Timers.Clear();
     }
     if (Periods != null)
     {
         foreach (var element in Periods)
         {
             element.Dispose();
         }
         Periods.Clear();
     }
     if (Playlists != null)
     {
         foreach (var element in Playlists)
         {
             element.Dispose();
         }
         Playlists.Clear();
     }
 }
        public void LoadData()
        {
            Periods.Clear();
            SemiTrimesters.Clear();
            Trimesters.Clear();

            foreach (PeriodViewModel period in MainViewModel.Instance.Parameters.Periods.OrderBy(p => p.Trimester).ThenBy(p => p.Number))
            {
                Periods.Add(period);
            }
            foreach (SemiTrimesterViewModel semiTrimester in MainViewModel.Instance.Parameters.SemiTrimesters)
            {
                SemiTrimesters.Add(semiTrimester);
            }
            foreach (int trimester in Periods.Select(p => p.Trimester).Distinct())
            {
                Trimesters.Add(trimester);
            }
        }
        public override HashSet <Period> Evaluate(IDateTime referenceDate, DateTime periodStart, DateTime periodEnd, bool includeReferenceDateInResults)
        {
            Periods.Clear();

            var rruleOccurrences = EvaluateRRule(referenceDate, periodStart, periodEnd, includeReferenceDateInResults);

            //Only add referenceDate if there are no RecurrenceRules defined
            if (includeReferenceDateInResults && (Recurrable.RecurrenceRules == null || !Recurrable.RecurrenceRules.Any()))
            {
                rruleOccurrences.UnionWith(new[] { new Period(referenceDate), });
            }

            var rdateOccurrences = EvaluateRDate(referenceDate, periodStart, periodEnd);

            var exRuleExclusions = EvaluateExRule(referenceDate, periodStart, periodEnd);
            var exDateExclusions = EvaluateExDate(referenceDate, periodStart, periodEnd);

            //Exclusions trump inclusions
            Periods.UnionWith(rruleOccurrences);
            Periods.UnionWith(rdateOccurrences);
            Periods.ExceptWith(exRuleExclusions);
            Periods.ExceptWith(exDateExclusions);

            var dateOverlaps = FindDateOverlaps(exDateExclusions);

            Periods.ExceptWith(dateOverlaps);

            if (EvaluationStartBounds == DateTime.MaxValue || EvaluationStartBounds > periodStart)
            {
                EvaluationStartBounds = periodStart;
            }
            if (EvaluationEndBounds == DateTime.MinValue || EvaluationEndBounds < periodEnd)
            {
                EvaluationEndBounds = periodEnd;
            }

            return(Periods);
        }
 void Clear()
 {
     Periods?.Clear();
 }
Exemple #17
0
 /// <summary>
 /// Clears a previous evaluation, usually because one of the
 /// key elements used for evaluation has changed
 /// (Start, End, Duration, recurrence rules, exceptions, etc.).
 /// </summary>
 virtual public void ClearEvaluation()
 {
     EvalStart = null;
     EvalEnd   = null;
     Periods.Clear();
 }