Example #1
0
        protected override void Dispose(bool disposing)
        {
            if (schedule != null)
            {
                schedule.Dispose();
            }

            if (appointmentCollection != null)
            {
                appointmentCollection.Clear();
            }

            if (startTimeCollection != null)
            {
                startTimeCollection.Clear();
            }

            if (endTimeCollection != null)
            {
                endTimeCollection.Clear();
            }

            if (subjectCollection != null)
            {
                subjectCollection.Clear();
            }

            schedule = null;
            appointmentCollection = null;
            endTimeCollection     = null;
            startTimeCollection   = null;
            subjectCollection     = null;
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            this.CurrentFrame = new CGRect(0, 0, UIScreen.MainScreen.Bounds.Size.Width, UIScreen.MainScreen.Bounds.Size.Height);
            this.AddButton();
            //Creating an instance for SfSchedule control
            SFSchedule schedule = new SFSchedule();

            schedule.Frame        = new CGRect(0, removeExceptionAppointment.Frame.Bottom, this.CurrentFrame.Size.Width, this.CurrentFrame.Size.Height - removeExceptionAppointment.Frame.Bottom);
            schedule.ScheduleView = SFScheduleView.SFScheduleViewWeek;

            NSCalendar calendar = new NSCalendar(NSCalendarType.Gregorian);
            NSDate     today    = NSDate.Now;
            // Get the year, month, day from the date
            NSDateComponents startDateComponents = calendar.Components(NSCalendarUnit.Year |
                                                                       NSCalendarUnit.Month |
                                                                       NSCalendarUnit.Day, today);

            // Set the year, month, day, hour, minute, second
            startDateComponents.Year   = 2017;
            startDateComponents.Month  = 09;
            startDateComponents.Day    = 03;
            startDateComponents.Hour   = 10;
            startDateComponents.Minute = 0;
            startDateComponents.Second = 0;

            //setting start time for the event
            NSDate startDate = calendar.DateFromComponents(startDateComponents);

            //setting end time for the event
            NSDate endDate = startDate.AddSeconds(2 * 60 * 60);

            // set moveto date to schedule
            schedule.MoveToDate(startDate);

            // Set the exception dates.
            var exceptionDate1 = startDate;
            var exceptionDate2 = startDate.AddSeconds(2 * 24 * 60 * 60);

            exceptionDate3 = startDate.AddSeconds(4 * 24 * 60 * 60);

            // Add Schedule appointment
            ScheduleAppointment recurrenceAppointment = new ScheduleAppointment();

            recurrenceAppointment.Id                       = 1;
            recurrenceAppointment.StartTime                = startDate;
            recurrenceAppointment.EndTime                  = endDate;
            recurrenceAppointment.Subject                  = (NSString)"Occurs Daily";
            recurrenceAppointment.AppointmentBackground    = UIColor.Blue;
            recurrenceAppointment.RecurrenceRule           = (NSString)"FREQ=DAILY;COUNT=20";
            recurrenceAppointment.RecurrenceExceptionDates = new System.Collections.ObjectModel.ObservableCollection <NSDate> {
                exceptionDate1,
                exceptionDate2,
                exceptionDate3
            };

            scheduleAppointmentCollection.Add(recurrenceAppointment);
            schedule.ItemsSource = scheduleAppointmentCollection;
            this.View.AddSubview(schedule);
        }
Example #3
0
        public Configuration()
        {
            schedule = new SFSchedule();
            schedule.ScheduleView = SFScheduleView.SFScheduleViewWeek;

            //Initializing configuration controls
            pickerScheduleView         = new UIPickerView();
            rangeslider                = new SfRangeSlider();
            labelScheduleView          = new UILabel();
            buttonScheduleView         = new UIButton();
            labelWorkingHours          = new UILabel();
            labelWeekNumber            = new UILabel();
            labelShowNonAccess         = new UILabel();
            labelBlackOutDays          = new UILabel();
            switchBlackOutDates        = new UISwitch();
            switchNonAccessbleBlock    = new UISwitch();
            switchWeekNumber           = new UISwitch();
            switchNonAccessbleBlock.On = true;
            switchBlackOutDates.On     = true;
            switchWeekNumber.On        = true;
            SetNonWorkingHours();
            SetMonthSettings();
            schedule.ItemsSource = viewModel.CreateAppointments();
            this.AddSubview(schedule);
            this.OptionView = new UIView();
        }
Example #4
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (schedule != null)
         {
             schedule.AppointmentsForDate  -= Schedule_AppointmentsForDate;
             schedule.AppointmentsFromDate -= Schedule_AppointmentsFromDate;
             schedule.CellTapped           -= Schedule_CellTapped;
             schedule.CellDoubleTapped     -= Schedule_DoubleTapped;
             schedule.VisibleDatesChanged  -= Schedule_VisibleDatesChanged;
             schedule.Dispose();
             schedule = null;
         }
         if (moveToDate != null)
         {
             moveToDate.TouchUpInside -= MoveToDate_TouchUpInside;
             moveToDate.Dispose();
             moveToDate = null;
         }
         if (headerButton != null)
         {
             headerButton.TouchUpInside -= HeaderButton_TouchUpInside;
             headerButton.Dispose();
             headerButton = null;
         }
         if (editorView != null)
         {
             editorView.TouchUpInside -= EditorView_TouchUpInside;
             editorView.Dispose();
             editorView = null;
         }
     }
     base.Dispose(disposing);
 }
Example #5
0
        public DragDrop()
        {
            schedule = new SFSchedule();
            schedule.ScheduleView = SFScheduleView.SFScheduleViewWeek;

            NonAccessibleBlock nonAccessibleBlock = new NonAccessibleBlock();
            //Create new instance of NonAccessibleBlocksCollection
            NSMutableArray   nonAccessibleBlocksCollection = new NSMutableArray();
            WeekViewSettings weekViewSettings = new WeekViewSettings();

            nonAccessibleBlock.StartHour       = 13;
            nonAccessibleBlock.EndHour         = 14;
            nonAccessibleBlock.Text            = (NSString)"LUNCH";
            nonAccessibleBlock.BackgroundColor = UIColor.Black;
            nonAccessibleBlocksCollection.Add(nonAccessibleBlock);
            weekViewSettings.NonAccessibleBlockCollection = nonAccessibleBlocksCollection;
            schedule.WeekViewSettings = weekViewSettings;

            schedule.AllowAppointmentDrag     = true;
            schedule.AppointmentDragStarting += Schedule_AppointmentDragStarting;
            schedule.AppointmentDrop         += Schedule_AppointmentDrop;
            schedule.AppointmentDragOver     += Schedule_AppointmentDragOver;
            schedule.ItemsSource              = CreateAppointments();
            this.AddSubview(schedule);
        }
Example #6
0
 public ScheduleEditor(SFSchedule sfSchedule, ScheduleViews scheduleView)
 {
     this.schedule          = sfSchedule;
     this.scheduleViews     = scheduleView;
     Editor                 = new UIView();
     Editor.BackgroundColor = UIColor.White;
 }
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (textbutton != null)
         {
             textbutton.TouchUpInside -= ShowPicker;
             textbutton.Dispose();
             textbutton = null;
         }
         if (button != null)
         {
             button.TouchUpInside -= HidePicker;
             button.Dispose();
             button = null;
         }
         if (schedule != null)
         {
             schedule.MonthCellLoaded   -= Schedule_MonthCellLoaded;
             schedule.AppointmentLoaded -= Schedule_AppointmentLoaded;
             this.schedule.Dispose();
             this.schedule = null;
         }
     }
     base.Dispose(disposing);
 }
Example #8
0
        public Configuration()
        {
            schedule = new SFSchedule();
            schedule.ScheduleView = SFScheduleView.SFScheduleViewWeek;

            //Intializing configurationc controls
            picker_scheduleView         = new UIPickerView();
            _rangeslider                = new SfRangeSlider();
            label_scheduleView          = new UILabel();
            button_scheduleView         = new UIButton();
            label_workingHours          = new UILabel();
            label_weekNumber            = new UILabel();
            label_showNonAccess         = new UILabel();
            label_blackOutDays          = new UILabel();
            switch_blackOutDates        = new UISwitch();
            switch_nonAccessbleBlock    = new UISwitch();
            switch_weekNumber           = new UISwitch();
            switch_nonAccessbleBlock.On = true;
            switch_blackOutDates.On     = true;
            switch_weekNumber.On        = true;
            SetNonWorkingHours();
            SetMonthSettings();
            //schedule.AppointmentStyle.BorderColor = UIColor.LightGray;
            //schedule.AppointmentStyle.SelectionBorderColor = UIColor.Red;
            //schedule.AppointmentStyle.SelectionTextColor = UIColor.Orange;
            //schedule.AppointmentStyle.BorderWidth = 5;
            //schedule.AppointmentStyle.TextColor = UIColor.Magenta;
            schedule.Appointments = CreateAppointments();
            this.AddSubview(schedule);
            this.OptionView = new UIView();
            //control = this;
        }
Example #9
0
 public Recurrence()
 {
     schedule = new SFSchedule();
     schedule.ScheduleView = SFScheduleView.SFScheduleViewMonth;
     schedule.ItemsSource  = CreateAppointments();
     schedule.MonthViewSettings.ShowAppointmentsInline = true;
     this.AddSubview(schedule);
 }
Example #10
0
 protected override void Dispose(bool disposing)
 {
     if (schedule != null)
     {
         this.schedule.Dispose();
     }
     this.schedule = null;
 }
Example #11
0
 public Recurrence()
 {
     schedule = new SFSchedule();
     schedule.ScheduleView = SFScheduleView.SFScheduleViewMonth;
     schedule.Appointments = CreateAppointments();
     schedule.MonthViewSettings.ShowAppointmentsInline = true;
     schedule.MonthInlineLoaded            += Schedule_MonthInlineLoaded;
     schedule.MonthInlineAppointmentLoaded += Schedule_MonthInlineAppointmentLoaded;
     this.AddSubview(schedule);
     //control = this;
 }
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (schedule != null)
         {
             schedule.Dispose();
             schedule = null;
         }
     }
     base.Dispose(disposing);
 }
Example #13
0
        public AgendaView()
        {
            schedule = new SFSchedule();
            schedule.ScheduleView = SFScheduleView.SFScheduleViewMonth;
            MonthViewSettings monthSettings = new MonthViewSettings();

            monthSettings.ShowAppointmentsInline = false;
            monthSettings.ShowAgendaView         = true;
            schedule.MonthViewSettings           = monthSettings;
            schedule.ItemsSource = CreateAppointments();
            this.AddSubview(schedule);
        }
        public AgendaView()
        {
            schedule = new SFSchedule();
            schedule.ScheduleView = SFScheduleView.SFScheduleViewMonth;
            schedule.SelectedDate = NSDate.Now;
            MonthViewSettings monthSettings = new MonthViewSettings();

            monthSettings.ShowAppointmentsInline = false;
            monthSettings.ShowAgendaView         = true;
            schedule.MonthViewSettings           = monthSettings;
            schedule.Appointments = CreateAppointments();
            this.AddSubview(schedule);
        }
Example #15
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (schedule != null)
         {
             schedule.AppointmentDrop -= Schedule_AppointmentDrop;
             schedule.Dispose();
             schedule = null;
         }
     }
     base.Dispose(disposing);
 }
Example #16
0
        protected override void Dispose(bool disposing)
        {
            if (schedule != null)
            {
                this.schedule.Dispose();
            }

            this.schedule = null;

            if (scheduleTypePicker != null)
            {
                scheduleTypePicker.Dispose();
                scheduleTypePicker = null;
            }
        }
Example #17
0
        public Timetable()
        {
            schedule = new SFSchedule();
            schedule.ScheduleView         = SFScheduleView.SFScheduleViewDay;
            schedule.TimeIntervalHeight   = -1;
            schedule.VisibleDatesChanged += Schedule_VisibleDatesChanged;
            InitializeAppointmentComponents();
            var dayViewSettings = new DayViewSettings();

            dayViewSettings.StartHour = 9;
            dayViewSettings.EndHour   = 16;
            schedule.DayViewSettings  = dayViewSettings;
            dayViewSettings.NonAccessibleBlockCollection = CreateNonAccescibleBlock();
            schedule.DayViewSettings = dayViewSettings;
            this.AddSubview(schedule);
        }
Example #18
0
        //UITapGestureRecognizer tapGesture;
        public AppointmentEditor()
        {
            schedule              = new SFSchedule();
            editor                = new UIView();
            schedule.CellTapped  += Schedule_ScheduleTapped;
            schedule.ScheduleView = SFScheduleView.SFScheduleViewWeek;
            schedule.Appointments = CreateAppointments();
            createEditor();

            this.AddSubview(schedule);
            schedule.Hidden = false;
            editor.Hidden   = true;
            this.AddSubview(editor);

            //	control = this;
        }
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (textbutton != null)
                {
                    textbutton.TouchUpInside -= ShowPicker;
                    textbutton.Dispose();
                    textbutton = null;
                }

                if (button != null)
                {
                    button.TouchUpInside -= HidePicker;
                    button.Dispose();
                    button = null;
                }

                if (schedule != null)
                {
                    schedule.MonthCellLoaded   -= Schedule_MonthCellLoaded;
                    schedule.AppointmentLoaded -= Schedule_AppointmentLoaded;
                    this.schedule.Dispose();
                    this.schedule = null;
                }

                if (scheduleTypePicker != null)
                {
                    scheduleTypePicker.Dispose();
                    scheduleTypePicker = null;
                }

                if (label != null)
                {
                    label.Dispose();
                    label = null;
                }

                if (customizationSegment != null)
                {
                    customizationSegment.Dispose();
                    customizationSegment = null;
                }
            }

            base.Dispose(disposing);
        }
Example #20
0
 public ScheduleViews()
 {
     schedule       = new SFSchedule();
     scheduleEditor = new ScheduleEditor(schedule, this);
     schedule.AppointmentsForDate  += Schedule_AppointmentsForDate;
     schedule.AppointmentsFromDate += Schedule_AppointmentsFromDate;
     schedule.CellTapped           += Schedule_CellTapped;
     schedule.CellDoubleTapped     += Schedule_DoubleTapped;
     schedule.VisibleDatesChanged  += Schedule_VisibleDatesChanged;
     schedule.ScheduleView          = SFScheduleView.SFScheduleViewWeek;
     schedule.ItemsSource           = viewModel.CreateAppointments();
     scheduleEditor.CreateEditor();
     this.OptionView              = new UIView();
     schedule.HeaderHeight        = 0;
     schedule.ViewHeaderHeight    = 50;
     schedule.Hidden              = false;
     scheduleEditor.Editor.Hidden = true;
 }
Example #21
0
        protected override void Dispose(bool disposing)
        {
            if (this.appointmentCollection != null)
            {
                this.appointmentCollection = null;
            }

            if (this.scheduleViews != null)
            {
                this.scheduleViews.Clear();
            }

            if (this.scheduleViewPicker != null)
            {
                this.scheduleViewPicker.Dispose();
                this.scheduleViewPicker = null;
            }

            if (this.label != null)
            {
                this.label.Dispose();
                this.label = null;
            }

            if (this.button != null)
            {
                this.button.Dispose();
                this.button = null;
            }

            if (this.textButton != null)
            {
                this.textButton.Dispose();
                this.textButton = null;
            }

            if (this.schedule != null)
            {
                this.schedule.Dispose();
                this.schedule = null;
            }

            base.Dispose(disposing);
        }
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (schedule != null)
                {
                    this.schedule.Dispose();
                    this.schedule = null;
                }

                if (textbutton != null)
                {
                    textbutton.TouchUpInside -= ShowPicker;
                    textbutton.Dispose();
                    textbutton = null;
                }

                if (button != null)
                {
                    button.TouchUpInside -= HidePicker;
                    button.Dispose();
                    button = null;
                }

                if (scheduleTypePicker != null)
                {
                    scheduleTypePicker.Dispose();
                    scheduleTypePicker = null;
                }

                if (label != null)
                {
                    label.Dispose();
                    label = null;
                }
            }

            base.Dispose(disposing);
        }
Example #23
0
        public Timetable()
        {
            schedule = new SFSchedule();
            schedule.ScheduleView = SFScheduleView.SFScheduleViewDay;
            if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone)
            {
                schedule.TimeIntervalHeight = 100;
            }
            else
            {
                schedule.TimeIntervalHeight = 130;
            }
            schedule.VisibleDatesChanged += Schedule_VisibleDatesChanged;
            InitializeAppointmentComponents();
            var dayViewSettings = new DayViewSettings();

            dayViewSettings.StartHour = 9;
            dayViewSettings.EndHour   = 16;
            schedule.DayViewSettings  = dayViewSettings;
            dayViewSettings.NonAccessibleBlockCollection = CreateNonAccescibleBlock();
            schedule.DayViewSettings = dayViewSettings;
            this.AddSubview(schedule);
        }
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (schedule != null)
         {
             schedule.Dispose();
             schedule = null;
         }
         if (OptionView != null)
         {
             this.OptionView.RemoveFromSuperview();
             this.OptionView.Dispose();
             this.OptionView = null;
         }
         if (button_scheduleView != null)
         {
             button_scheduleView.TouchUpInside -= ShowPicker1;
             button_scheduleView.Dispose();
             button_scheduleView = null;
         }
         if (doneButton != null)
         {
             doneButton.TouchUpInside -= HidePicker;
             doneButton.Dispose();
             doneButton = null;
         }
         if (_rangeslider != null)
         {
             _rangeslider.RangeValueChange -= Slider_RangeValueChange;
             _rangeslider.Dispose();
             _rangeslider = null;
         }
     }
     base.Dispose(disposing);
 }
Example #25
0
        public Localization()
        {
            schedule        = new SFSchedule();
            viewModel       = new ScheduleLocalViewModel();
            label.Text      = "Select the Locale";
            label.TextColor = UIColor.Black;
            this.AddSubview(label);
            textbutton.SetTitle("French", UIControlState.Normal);
            textbutton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center;
            textbutton.BackgroundColor     = UIColor.Clear;
            textbutton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            textbutton.Hidden             = false;
            textbutton.Layer.BorderColor  = UIColor.FromRGB(246, 246, 246).CGColor;
            textbutton.Layer.BorderWidth  = 4;
            textbutton.Layer.CornerRadius = 8;
            textbutton.TouchUpInside     += ShowPicker;
            this.AddSubview(textbutton);

            button.SetTitle("Done\t", UIControlState.Normal);
            button.HorizontalAlignment = UIControlContentHorizontalAlignment.Right;
            button.BackgroundColor     = UIColor.FromRGB(240, 240, 240);
            button.SetTitleColor(UIColor.Black, UIControlState.Normal);
            button.Hidden         = true;
            button.TouchUpInside += HidePicker;

            schedule.Locale       = new NSLocale("fr-FR");
            schedule.ItemsSource  = getFrenchAppointments();
            schedule.ScheduleView = SFScheduleView.SFScheduleViewWeek;
            this.AddSubview(schedule);

            appView = new UITableView();
            appView.RegisterClassForCellReuse(typeof(UITableViewCell), "Cell");
            this.AddSubview(appView);

            this.languages.Add((NSString)"French");
            this.languages.Add((NSString)"Spanish");
            this.languages.Add((NSString)"English");
            this.languages.Add((NSString)"Chinese");

            SchedulePickerModel model = new SchedulePickerModel(this.languages);

            model.PickerChanged += (sender, e) =>
            {
                this.localisation_Languages = e.SelectedValue;
                textbutton.SetTitle(localisation_Languages, UIControlState.Normal);
                if (localisation_Languages == "French")
                {
                    schedule.Locale      = new NSLocale("fr-FR");
                    schedule.ItemsSource = getFrenchAppointments();
                }
                else if (localisation_Languages == "Spanish")
                {
                    schedule.Locale      = new NSLocale("es-AR");
                    schedule.ItemsSource = getSpanishAppointments();
                }
                else if (localisation_Languages == "English")
                {
                    schedule.Locale      = new NSLocale("en-US");
                    schedule.ItemsSource = getEnglishAppointments();
                }
                else if (localisation_Languages == "Chinese")
                {
                    schedule.Locale      = new NSLocale("zh-CN");
                    schedule.ItemsSource = getChineseAppointments();
                }
            };
            scheduleTypePicker.ShowSelectionIndicator = true;
            scheduleTypePicker.Hidden          = true;
            scheduleTypePicker.Model           = model;
            scheduleTypePicker.BackgroundColor = UIColor.White;
            this.OptionView = new UIView();
        }
        public Customization()
        {
            schedule = new SFSchedule();

            label.Text      = "Select the Schedule Type";
            label.TextColor = UIColor.Black;

            headerStyle     = new HeaderStyle();
            viewHeaderStyle = new SFViewHeaderStyle();

            schedule.HeaderHeight       = 30;
            schedule.MonthCellLoaded   += Schedule_MonthCellLoaded;
            schedule.AppointmentLoaded += Schedule_AppointmentLoaded;

            textbutton.SetTitle("Day View", UIControlState.Normal);
            textbutton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center;
            textbutton.BackgroundColor     = UIColor.Clear;
            textbutton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            textbutton.Hidden             = false;
            textbutton.Layer.BorderColor  = UIColor.FromRGB(246, 246, 246).CGColor;
            textbutton.Layer.BorderWidth  = 4;
            textbutton.Layer.CornerRadius = 8;
            textbutton.TouchUpInside     += ShowPicker;

            button.SetTitle("Done\t", UIControlState.Normal);
            button.HorizontalAlignment = UIControlContentHorizontalAlignment.Right;
            button.BackgroundColor     = UIColor.FromRGB(240, 240, 240);
            button.SetTitleColor(UIColor.Black, UIControlState.Normal);
            button.Hidden         = true;
            button.TouchUpInside += HidePicker;

            schedule.ItemsSource  = CreateAppointments();
            schedule.ScheduleView = SFScheduleView.SFScheduleViewDay;

            schedule.DayViewSettings = new DayViewSettings();
            schedule.DayViewSettings.TimeTextColor       = UIColor.FromRGB(168, 168, 173);
            schedule.DayViewSettings.TimeSlotBorderColor = UIColor.FromRGB(219, 219, 219);
            schedule.DayViewSettings.NonWorkingHourTimeSlotBorderColor = UIColor.FromRGB(219, 219, 219);

            UIButton selectionView = new UIButton();

            selectionView.BackgroundColor = UIColor.FromRGB(0, 122, 255);
            selectionView.SetTitle("+ New Event", UIControlState.Normal);
            schedule.SelectionView = selectionView;

            viewHeaderStyle.BackgroundColor = UIColor.FromRGB(247, 247, 247);
            viewHeaderStyle.DayTextStyle    = UIFont.SystemFontOfSize(18);
            viewHeaderStyle.DayTextColor    = UIColor.FromRGB(3, 3, 3);

            headerStyle.TextPosition       = UITextAlignment.Center;
            headerStyle.TextColor          = UIColor.FromRGB(3, 3, 3);
            schedule.HeaderStyle           = headerStyle;
            schedule.DayHeaderStyle        = viewHeaderStyle;
            schedule.AppointmentViewLayout = SFViewLayoutOptions.Overlay;
            this.scheduleTypes.Add((NSString)"Day View");
            this.scheduleTypes.Add((NSString)"Month View");

            Localization.SchedulePickerModel model = new Localization.SchedulePickerModel(this.scheduleTypes);
            model.PickerChanged += (sender, e) =>
            {
                this.selectedType = e.SelectedValue;
                textbutton.SetTitle(selectedType, UIControlState.Normal);
                if (selectedType == "Day View")
                {
                    schedule.ScheduleView = SFScheduleView.SFScheduleViewDay;
                }
                else if (selectedType == "Month View")
                {
                    schedule.ScheduleView = SFScheduleView.SFScheduleViewMonth;
                }
            };
            scheduleTypePicker.ShowSelectionIndicator = true;
            scheduleTypePicker.Hidden          = true;
            scheduleTypePicker.Model           = model;
            scheduleTypePicker.BackgroundColor = UIColor.White;
        }
Example #27
0
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (schedule != null)
                {
                    schedule.Dispose();
                    schedule = null;
                }

                if (OptionView != null)
                {
                    this.OptionView.RemoveFromSuperview();
                    this.OptionView.Dispose();
                    this.OptionView = null;
                }

                if (buttonScheduleView != null)
                {
                    buttonScheduleView.TouchUpInside -= ShowPicker1;
                    buttonScheduleView.Dispose();
                    buttonScheduleView = null;
                }

                if (doneButton != null)
                {
                    doneButton.TouchUpInside -= HidePicker;
                    doneButton.Dispose();
                    doneButton = null;
                }

                if (rangeslider != null)
                {
                    rangeslider.RangeValueChange -= Slider_RangeValueChange;
                    rangeslider.Dispose();
                    rangeslider = null;
                }

                if (daySettings != null)
                {
                    daySettings.Dispose();
                    daySettings = null;
                }

                if (labelBlackOutDays != null)
                {
                    labelBlackOutDays.Dispose();
                    labelBlackOutDays = null;
                }

                if (labelScheduleView != null)
                {
                    labelScheduleView.Dispose();
                    labelScheduleView = null;
                }

                if (labelShowNonAccess != null)
                {
                    labelShowNonAccess.Dispose();
                    labelShowNonAccess = null;
                }

                if (labelWeekNumber != null)
                {
                    labelWeekNumber.Dispose();
                    labelWeekNumber = null;
                }

                if (labelWorkingHours != null)
                {
                    labelWorkingHours.Dispose();
                    labelWorkingHours = null;
                }

                if (monthSettings != null)
                {
                    monthSettings.Dispose();
                    monthSettings = null;
                }

                if (pickerScheduleView != null)
                {
                    pickerScheduleView.Dispose();
                    pickerScheduleView = null;
                }

                if (switchBlackOutDates != null)
                {
                    switchBlackOutDates.Dispose();
                    switchBlackOutDates = null;
                }

                if (switchNonAccessbleBlock != null)
                {
                    switchNonAccessbleBlock.Dispose();
                    switchNonAccessbleBlock = null;
                }

                if (switchWeekNumber != null)
                {
                    switchWeekNumber.Dispose();
                    switchWeekNumber = null;
                }

                if (weekSettings != null)
                {
                    weekSettings.Dispose();
                    weekSettings = null;
                }

                if (workWeekSettings != null)
                {
                    workWeekSettings.Dispose();
                    workWeekSettings = null;
                }
            }

            base.Dispose(disposing);
        }
        /// <summary>
        /// Initialize a new instance of the class <see cref="ScheduleGettingStarted"/> class
        /// </summary>
        public ScheduleGettingStarted()
        {
            schedule        = new SFSchedule();
            label.Text      = "Schedule View";
            label.TextColor = UIColor.Black;
            this.AddSubview(label);

            textButton.SetTitle("WeekView", UIControlState.Normal);
            textButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center;
            textButton.BackgroundColor     = UIColor.Clear;
            textButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            textButton.Hidden             = false;
            textButton.Layer.BorderColor  = UIColor.FromRGB(246, 246, 246).CGColor;
            textButton.Layer.BorderWidth  = 4;
            textButton.Layer.CornerRadius = 8;
            textButton.TouchUpInside     += ShowPicker;
            this.AddSubview(textButton);

            button.SetTitle("Done\t", UIControlState.Normal);
            button.HorizontalAlignment = UIControlContentHorizontalAlignment.Right;
            button.BackgroundColor     = UIColor.FromRGB(240, 240, 240);
            button.SetTitleColor(UIColor.Black, UIControlState.Normal);
            button.Hidden         = true;
            button.TouchUpInside += HidePicker;

            appointmentCollection = new AppointmentCollection();
            schedule.ScheduleView = SFScheduleView.SFScheduleViewWeek;
            schedule.MonthViewSettings.ShowAppointmentsInline = true;

            // Custom appointment mapping
            AppointmentMapping mapping = new AppointmentMapping();

            mapping.Subject               = "EventName";
            mapping.StartTime             = "From";
            mapping.EndTime               = "To";
            mapping.AppointmentBackground = "color";
            mapping.Location              = "Organizer";
            mapping.IsAllDay              = "isAllDay";
            mapping.MinHeight             = "MinimumHeight";
            schedule.AppointmentMapping   = mapping;

            schedule.ItemsSource = appointmentCollection.GetAppointments();


            this.AddSubview(schedule);

            this.scheduleViews.Add((NSString)"Week View");
            this.scheduleViews.Add((NSString)"Day View");
            this.scheduleViews.Add((NSString)"Work Week View");
            this.scheduleViews.Add((NSString)"Month View");

            SchedulePickerModel model = new SchedulePickerModel(this.scheduleViews);

            // Event occurs when the item picked in the picker
            model.PickerChanged += (sender, e) =>
            {
                this.selectedView = e.SelectedValue;
                textButton.SetTitle(selectedView, UIControlState.Normal);
                if (selectedView == "Day View")
                {
                    schedule.ScheduleView = SFScheduleView.SFScheduleViewDay;
                }
                else if (selectedView == "Week View")
                {
                    schedule.ScheduleView = SFScheduleView.SFScheduleViewWeek;
                }
                else if (selectedView == "Work Week View")
                {
                    schedule.ScheduleView = SFScheduleView.SFScheduleViewWorkWeek;
                }
                else if (selectedView == "Month View")
                {
                    schedule.ScheduleView = SFScheduleView.SFScheduleViewMonth;
                }
            };

            scheduleViewPicker.ShowSelectionIndicator = true;
            scheduleViewPicker.Hidden          = true;
            scheduleViewPicker.Model           = model;
            scheduleViewPicker.BackgroundColor = UIColor.White;

            this.OptionView = new UIView();
        }