Пример #1
0
        async virtual protected Task Initialize(DateTimeOffset referenceNow, DateTimeOffset StartOfDay, TilerElements.Location requestLocation, HashSet <string> calendarIds = null)
        {
            if (!myAccount.Status)
            {
                throw new Exception("Using non verified tiler Account, try logging into account first.");
            }

            _Now = new ReferenceNow(referenceNow, StartOfDay, myAccount.getTilerUser().TimeZoneDifference);
            this.RangeOfLookup = this.RangeOfLookup ?? new TimeLine(_Now.constNow.AddDays(Schedule.TimeLookUpDayStart), _Now.constNow.AddDays(Schedule.TimeLookUpDayEnd));
            Tuple <Dictionary <string, CalendarEvent>, DateTimeOffset, Dictionary <string, Location>, Analysis> profileData = await myAccount.ScheduleData.getProfileInfo(RangeOfLookup, _Now, this.retrievalOptions, requestLocation, calendarIds : calendarIds).ConfigureAwait(false);

            myAccount.Now = _Now;
            TravelCache travelCache = await myAccount.ScheduleData.getTravelCache(myAccount.UserID).ConfigureAwait(false);

            updateTravelCache(travelCache);
            if (profileData != null)
            {
                this.setAnalysis(profileData.Item4);
                DateTimeOffset referenceDayTimeNow = new DateTimeOffset(Now.calculationNow.Year, Now.calculationNow.Month, Now.calculationNow.Day, profileData.Item2.Hour, profileData.Item2.Minute, profileData.Item2.Second, new TimeSpan());// profileData.Item2;
                ReferenceDayTIime = Now.calculationNow < referenceDayTimeNow?referenceDayTimeNow.AddDays(-1) : referenceDayTimeNow;

                initializeAllEventDictionary(profileData.Item1.Values);
                if (getAllEventDictionary != null)
                {
                    EventID.Initialize((uint)(myAccount.LastEventTopNodeID));
                    initializeThirdPartyCalendars();
                    updateThirdPartyCalendars(ThirdPartyControl.CalendarTool.outlook, new List <CalendarEvent>()
                    {
                    });
                    CompleteSchedule = getTimeLine();
                }
                Locations = profileData.Item3;
            }
            TilerUser = myAccount.getTilerUser();
        }