Beispiel #1
0
        /// <summary>
        /// Method for editor open
        /// </summary>
        /// <param name="appointment">appointment value</param>
        /// <param name="date">date value</param>
        public void OpenEditor(Meeting appointment, DateTime date, object resource)
        {
            this.editorScrollView.ScrollToAsync(0, 0, false);
            this.cancelButton.BackgroundColor = Color.FromHex("#E5E5E5");
            this.saveButton.BackgroundColor   = Color.FromHex("#2196F3");
            this.eventNameText.Placeholder    = "Event name";
            this.organizerText.Placeholder    = "Organizer";
            this.selectedAppointment          = null;
            if (appointment != null)
            {
                this.selectedAppointment = appointment;
                this.selectedDate        = date;
            }
            else
            {
                this.selectedDate = date;
            }

            if (resource != null)
            {
                MeetingRoomInfo _resource = (MeetingRoomInfo)resource;
                this.selectedResourceIndex = 0;
                while (_resource.Name != AppointmentEditorHelper.Resources[this.selectedResourceIndex].Name)
                {
                    this.selectedResourceIndex++;
                }
            }

            this.UpdateEditor();
        }
Beispiel #2
0
        /// <summary>
        /// Creates meetings and stores in a collection.
        /// </summary>
        private void CreateAppointments()
        {
            Random       randomTime           = new Random();
            List <Point> randomTimeCollection = this.GettingTimeRanges();

            DateTime date;
            DateTime dateFrom       = DateTime.Now.AddDays(-80);
            DateTime dateTo         = DateTime.Now.AddDays(80);
            DateTime dateRangeStart = DateTime.Now.AddDays(-70);
            DateTime dateRangeEnd   = DateTime.Now.AddDays(70);

            var timeRanges = this.GettingTimeRanges();

            for (date = dateFrom; date < dateTo; date = date.AddDays(1))
            {
                for (int i = 0; i < MeetingRooms.Count; i++)
                {
                    var   meeting   = new Meeting();
                    Point timeRange = timeRanges[randomTime.Next(3)];
                    var   x         = (int)timeRange.X;
                    var   y         = (int)timeRange.Y;
                    var   subject   = this.eventNameCollection[randomTime.Next(11)];
                    var   startTime = new DateTime(date.Year, date.Month, date.Day, randomTime.Next(x, y), 0, 0);
                    meeting.From      = startTime;
                    meeting.To        = meeting.From.AddHours(1);
                    meeting.EventName = subject;

                    meeting.IsAllDay = false;
                    var             resources = new ObservableCollection <object>();
                    MeetingRoomInfo room      = (MeetingRooms[i] as MeetingRoomInfo);
                    resources.Add(room.Id);
                    meeting.Color = room.Color;
                    meeting.ResourceIdCollection = resources;

                    this.Meetings.Add(meeting);
                }
            }
        }