コード例 #1
0
        /// <summary>
        /// The calendar group did select from date to date.
        /// </summary>
        /// <param name="calendarGroup">The calendar group.</param>
        /// <param name="fromDate">The from date.</param>
        /// <param name="toDate">The to date.</param>
        public void CalendarGroupDidSelectFromDateToDate(UPMCalendarGroup calendarGroup, DateTime?fromDate, DateTime?toDate)
        {
            if (!this.OutputDateRange)
            {
                this.CalendarGroupDidSelectDate(calendarGroup, fromDate);
                return;
            }

            this.CurrentDateString = $"{StringExtensions.CrmValueFromDate(fromDate)};{StringExtensions.CrmValueFromDate(toDate)}";
            this.Delegate.GroupModelControllerValueChanged(this, this.CurrentDateString);
        }
コード例 #2
0
        /// <summary>
        /// Calendars the group did select date.
        /// </summary>
        /// <param name="calendarGroup">The calendar group.</param>
        /// <param name="date">The date.</param>
        public void CalendarGroupDidSelectDate(UPMCalendarGroup calendarGroup, DateTime?date)
        {
            if (this.OutputDateRange)
            {
                this.CalendarGroupDidSelectFromDateToDate(calendarGroup, date, date);
                return;
            }

            string dateString = StringExtensions.CrmValueFromDate(date);

            this.CurrentDateString = dateString;

            // TODO: Very important
            // dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{

            if (!ServerSession.CurrentSession.IsEnterprise)
            {
                this.Delegate.GroupModelControllerValueChanged(this, this.CurrentDateString);
            }
            else
            {
                // [Enterprise only] The code bellow avoids requesting multiple time the database when fast changing dates on dashboard calendar

                DateTime currentDate = DateTime.Now;

                if (this.LastCalendarSelectionDate != null)
                {
                    var interval = this.LastCalendarSelectionDate - currentDate;
                    this.LastCalendarSelectionDate = currentDate;

                    if (interval.Value.Milliseconds < 50)
                    {
                        // [NSThread sleepForTimeInterval:0.5];
                    }
                }
                else
                {
                    this.LastCalendarSelectionDate = currentDate;
                }

                if (dateString == this.CurrentDateString)
                {
                    this.Delegate.GroupModelControllerValueChanged(this, this.CurrentDateString);
                }
            }
            // });
        }
コード例 #3
0
        /// <summary>
        /// Applies the context.
        /// </summary>
        /// <param name="contextDictionary">The context dictionary.</param>
        /// <returns></returns>
        public override UPMGroup ApplyContext(Dictionary <string, object> contextDictionary)
        {
            base.ApplyContext(contextDictionary);
            DateTime?currentDate = this.CurrentDateString.DateFromCrmValue();

            if (this.OutputDateRange)
            {
                var chunks = this.CurrentDateString.Split(';');
                currentDate = chunks[0].DateFromCrmValue();
            }

            UPMCalendarGroup calendarGroup = new UPMCalendarGroup(this.ExplicitTabIdentifier)
            {
                Date     = currentDate.Value,
                Delegate = this
            };

            this.Group           = calendarGroup;
            this.ControllerState = GroupModelControllerState.Finished;

            return(calendarGroup);
        }
コード例 #4
0
 public void CalendarGroupDidSelectFromDateToDate(UPMCalendarGroup calendarGroup, DateTime fromDate, DateTime toDate)
 {
 }
コード例 #5
0
 public void CalendarGroupDidSelectDate(UPMCalendarGroup calendarGroup, DateTime date)
 {
 }