Пример #1
0
        private void createEditor()
        {
            button_cancel    = new UIButton();
            button_save      = new UIButton();
            label_subject    = new UITextView();
            label_location   = new UITextView();
            label_ends       = new UILabel();
            label_starts     = new UILabel();
            button_startDate = new UIButton();
            button_endDate   = new UIButton();
            picker_startDate = new UIDatePicker();
            picker_endDate   = new UIDatePicker();
            done_button      = new UIButton();


            //cancel button
            button_cancel.SetTitle("Cancel", UIControlState.Normal);
            button_cancel.SetTitleColor(UIColor.Blue, UIControlState.Normal);
            button_cancel.HorizontalAlignment = UIControlContentHorizontalAlignment.Center;
            button_cancel.TouchUpInside      += (object sender, EventArgs e) =>
            {
                editor.Hidden   = true;
                schedule.Hidden = false;
                editor.EndEditing(true);
            };

            //save button
            button_save.SetTitle("Save", UIControlState.Normal);
            button_save.SetTitleColor(UIColor.Blue, UIControlState.Normal);
            button_save.HorizontalAlignment = UIControlContentHorizontalAlignment.Center;
            button_save.TouchUpInside      += (object sender, EventArgs e) =>
            {
                if (indexOfAppointment != -1)
                {
                    schedule.Appointments.GetItem <ScheduleAppointment>(nuint.Parse(indexOfAppointment.ToString())).Subject   = (NSString)label_subject.Text;
                    schedule.Appointments.GetItem <ScheduleAppointment>(nuint.Parse(indexOfAppointment.ToString())).Location  = (NSString)label_location.Text;
                    schedule.Appointments.GetItem <ScheduleAppointment>(nuint.Parse(indexOfAppointment.ToString())).StartTime = picker_startDate.Date;
                    schedule.Appointments.GetItem <ScheduleAppointment>(nuint.Parse(indexOfAppointment.ToString())).EndTime   = picker_endDate.Date;
                }
                else
                {
                    ScheduleAppointment appointment = new ScheduleAppointment();
                    appointment.Subject               = (NSString)label_subject.Text;
                    appointment.Location              = (NSString)label_location.Text;
                    appointment.StartTime             = picker_startDate.Date;
                    appointment.EndTime               = picker_endDate.Date;
                    appointment.AppointmentBackground = UIColor.FromRGB(0xA2, 0xC1, 0x39);
                    schedule.Appointments.Add(appointment);
                }
                editor.Hidden   = true;
                schedule.Hidden = false;
                schedule.ReloadData();
                editor.EndEditing(true);
            };

            //subject label
            label_subject.TextColor          = UIColor.Black;
            label_subject.TextAlignment      = UITextAlignment.Left;
            label_subject.Layer.CornerRadius = 8;
            label_subject.Layer.BorderWidth  = 2;
            label_subject.Layer.BorderColor  = UIColor.FromRGB(246, 246, 246).CGColor;


            //location label
            label_location.TextColor          = UIColor.Black;
            label_location.TextAlignment      = UITextAlignment.Left;
            label_location.Layer.CornerRadius = 8;
            label_location.Layer.BorderWidth  = 2;
            label_location.Layer.BorderColor  = UIColor.FromRGB(246, 246, 246).CGColor;

            //starts time

            label_starts.Text      = "Start Time :";
            label_starts.TextColor = UIColor.Black;

            button_startDate.SetTitle("Start time", UIControlState.Normal);
            button_startDate.SetTitleColor(UIColor.Blue, UIControlState.Normal);
            button_startDate.HorizontalAlignment = UIControlContentHorizontalAlignment.Center;
            button_startDate.TouchUpInside      += (object sender, EventArgs e) =>
            {
                picker_startDate.Hidden = false;
                done_button.Hidden      = false;
                label_ends.Hidden       = true;
                button_endDate.Hidden   = true;
                button_startDate.Hidden = true;
                label_starts.Hidden     = true;
                editor.EndEditing(true);
            };

            //end time

            label_ends.Text      = "End Time :";
            label_ends.TextColor = UIColor.Black;


            //end date
            button_endDate.SetTitle("End time", UIControlState.Normal);
            button_endDate.SetTitleColor(UIColor.Blue, UIControlState.Normal);
            button_endDate.HorizontalAlignment = UIControlContentHorizontalAlignment.Center;
            button_endDate.TouchUpInside      += (object sender, EventArgs e) =>
            {
                picker_endDate.Hidden   = false;
                done_button.Hidden      = false;
                label_ends.Hidden       = true;
                button_endDate.Hidden   = true;
                button_startDate.Hidden = true;
                label_starts.Hidden     = true;
                editor.EndEditing(true);
            };

            //date and time pickers
            picker_startDate.Hidden = true;
            picker_endDate.Hidden   = true;

            //done button
            done_button.SetTitle("Done", UIControlState.Normal);
            done_button.SetTitleColor(UIColor.Blue, UIControlState.Normal);
            done_button.HorizontalAlignment = UIControlContentHorizontalAlignment.Right;
            done_button.TouchUpInside      += (object sender, EventArgs e) =>
            {
                picker_startDate.Hidden = true;
                picker_endDate.Hidden   = true;
                done_button.Hidden      = true;
                label_ends.Hidden       = false;
                button_endDate.Hidden   = false;
                button_startDate.Hidden = false;
                label_starts.Hidden     = false;

                String _sDate = DateTime.Parse((picker_startDate.Date.ToString())).ToString();
                button_startDate.SetTitle(_sDate, UIControlState.Normal);

                String _eDate = DateTime.Parse((picker_endDate.Date.ToString())).ToString();
                button_endDate.SetTitle(_eDate, UIControlState.Normal);
                editor.EndEditing(true);
            };

            button_cancel.Frame    = new CGRect(this.Frame.X + 10, this.Frame.Y + 10, 100, 30);
            button_save.Frame      = new CGRect(100, this.Frame.Y + 10, 300, 30);
            label_subject.Frame    = new CGRect(this.Frame.X + 10, this.Frame.Y + 50, 300, 30);
            label_location.Frame   = new CGRect(this.Frame.X + 10, this.Frame.Y + 90, 300, 30);
            label_starts.Frame     = new CGRect(this.Frame.X + 10, this.Frame.Y + 140, 300, 30);
            button_startDate.Frame = new CGRect(this.Frame.X + 10, this.Frame.Y + 180, 300, 30);
            label_ends.Frame       = new CGRect(this.Frame.X + 10, this.Frame.Y + 220, 300, 30);
            button_endDate.Frame   = new CGRect(this.Frame.X + 10, this.Frame.Y + 260, 300, 30);

            picker_startDate.Frame = new CGRect(this.Frame.X + 10, this.Frame.Y + 180, 300, 30);
            picker_endDate.Frame   = new CGRect(100, this.Frame.Y + 180, 300, 30);
            picker_endDate.Frame   = new CGRect(this.Frame.X + 10, this.Frame.Y + 180, 300, 30);
            done_button.Frame      = new CGRect(this.Frame.X + 10, this.Frame.Y + 180, 300, 30);
            done_button.Hidden     = true;

            editor.Add(button_cancel);
            editor.Add(button_save);
            editor.Add(label_subject);
            editor.Add(label_location);
            editor.Add(label_starts);
            editor.Add(button_startDate);
            editor.Add(label_ends);
            editor.Add(button_endDate);
            editor.Add(picker_endDate);
            editor.Add(picker_startDate);
            editor.Add(done_button);
        }
Пример #2
0
        internal void CreateEditor()
        {
            ButtonCancel        = new UIButton();
            ButtonSave          = new UIButton();
            LabelSubject        = new UITextView();
            LabelLocation       = new UITextView();
            LabelEnds           = new UILabel();
            LabelStarts         = new UILabel();
            ButtonStartDate     = new UIButton();
            ButtonEndDate       = new UIButton();
            StartTimeZoneLabel  = new UILabel();
            EndTimeZoneLabel    = new UILabel();
            StartTimeZoneButton = new UIButton();
            EndTimeZoneButton   = new UIButton();
            PickerStartDate     = new UIDatePicker();
            PickerEndDate       = new UIDatePicker();
            DoneButton          = new UIButton();
            ScrollView          = new UIScrollView();
            StartTimeZonePicker = new UIPickerView();
            EndTimeZonePicker   = new UIPickerView();
            AllDaySwitch        = new UISwitch();
            AllDaylabel         = new UILabel();

            ScrollView.BackgroundColor = UIColor.White;

            LabelSubject.Font        = UIFont.SystemFontOfSize(14);
            LabelLocation.Font       = UIFont.SystemFontOfSize(14);
            LabelStarts.Font         = UIFont.SystemFontOfSize(15);
            LabelEnds.Font           = UIFont.SystemFontOfSize(15);
            StartTimeZoneLabel.Font  = UIFont.SystemFontOfSize(15);
            EndTimeZoneLabel.Font    = UIFont.SystemFontOfSize(15);
            AllDaylabel.Font         = UIFont.SystemFontOfSize(15);
            StartTimeZoneButton.Font = UIFont.SystemFontOfSize(15);
            EndTimeZoneButton.Font   = UIFont.SystemFontOfSize(15);
            ButtonStartDate.Font     = UIFont.SystemFontOfSize(15);
            ButtonEndDate.Font       = UIFont.SystemFontOfSize(15);

            ButtonCancel.BackgroundColor = UIColor.FromRGB(229, 229, 229);
            ButtonCancel.Font            = UIFont.SystemFontOfSize(15);
            ButtonSave.Font                    = UIFont.SystemFontOfSize(15);
            ButtonSave.BackgroundColor         = UIColor.FromRGB(33, 150, 243);
            ButtonCancel.Layer.CornerRadius    = 6;
            ButtonSave.Layer.CornerRadius      = 6;
            ButtonStartDate.Layer.CornerRadius = 6;
            ButtonEndDate.Layer.CornerRadius   = 6;

            StartTimeZoneLabel.Text      = "Start Time Zone";
            StartTimeZoneLabel.TextColor = UIColor.Black;

            EndTimeZoneLabel.Text      = "End Time Zone";
            EndTimeZoneLabel.TextColor = UIColor.Black;

            AllDaylabel.Text      = "All Day";
            AllDaylabel.TextColor = UIColor.Black;

            AllDaySwitch.On            = false;
            AllDaySwitch.OnTintColor   = UIColor.FromRGB(33, 150, 243);
            AllDaySwitch.ValueChanged += AllDaySwitch_ValueChanged;

            StartTimeZoneButton.SetTitle("Default", UIControlState.Normal);
            StartTimeZoneButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            StartTimeZoneButton.Layer.BorderWidth   = 2;
            StartTimeZoneButton.Layer.CornerRadius  = 4;
            StartTimeZoneButton.Layer.BorderColor   = UIColor.FromRGB(246, 246, 246).CGColor;
            StartTimeZoneButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center;
            StartTimeZoneButton.TouchUpInside      += (object sender, EventArgs e) =>
            {
                StartTimeZonePicker.Hidden = false;
                DoneButton.Hidden          = false;

                AllDaylabel.Hidden       = true;
                AllDaySwitch.Hidden      = true;
                ButtonCancel.Hidden      = true;
                ButtonSave.Hidden        = true;
                EndTimeZoneLabel.Hidden  = true;
                EndTimeZoneButton.Hidden = true;
                Editor.EndEditing(true);
            };

            EndTimeZoneButton.SetTitle("Default", UIControlState.Normal);
            EndTimeZoneButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            EndTimeZoneButton.Layer.BorderWidth   = 2;
            EndTimeZoneButton.Layer.CornerRadius  = 4;
            EndTimeZoneButton.Layer.BorderColor   = UIColor.FromRGB(246, 246, 246).CGColor;
            EndTimeZoneButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center;
            EndTimeZoneButton.TouchUpInside      += (object sender, EventArgs e) =>
            {
                EndTimeZonePicker.Hidden = false;
                DoneButton.Hidden        = false;
                AllDaylabel.Hidden       = true;
                AllDaySwitch.Hidden      = true;
                ButtonCancel.Hidden      = true;
                ButtonSave.Hidden        = true;
                EndTimeZoneLabel.Hidden  = true;
                EndTimeZoneButton.Hidden = true;
                Editor.EndEditing(true);
            };

            //cancel button
            ButtonCancel.SetTitle("Cancel", UIControlState.Normal);
            ButtonCancel.SetTitleColor(UIColor.FromRGB(59, 59, 59), UIControlState.Normal);
            ButtonCancel.TouchUpInside += (object sender, EventArgs e) =>
            {
                Editor.Hidden   = true;
                schedule.Hidden = false;
                Editor.EndEditing(true);
                scheduleViews.HeaderView.Hidden = false;
            };

            //save button
            ButtonSave.SetTitle("Save", UIControlState.Normal);
            ButtonSave.SetTitleColor(UIColor.White, UIControlState.Normal);
            ButtonSave.TouchUpInside += (object sender, EventArgs e) =>
            {
                scheduleViews.HeaderView.Hidden = false;
                if (scheduleViews.IndexOfAppointment != -1)
                {
                    (schedule.ItemsSource as ObservableCollection <ScheduleAppointment>)[int.Parse(scheduleViews.IndexOfAppointment.ToString())].Subject   = (NSString)LabelSubject.Text;
                    (schedule.ItemsSource as ObservableCollection <ScheduleAppointment>)[int.Parse(scheduleViews.IndexOfAppointment.ToString())].Location  = (NSString)LabelLocation.Text;
                    (schedule.ItemsSource as ObservableCollection <ScheduleAppointment>)[int.Parse(scheduleViews.IndexOfAppointment.ToString())].StartTime = PickerStartDate.Date;
                    (schedule.ItemsSource as ObservableCollection <ScheduleAppointment>)[int.Parse(scheduleViews.IndexOfAppointment.ToString())].EndTime   = PickerEndDate.Date;
                    (schedule.ItemsSource as ObservableCollection <ScheduleAppointment>)[int.Parse(scheduleViews.IndexOfAppointment.ToString())].IsAllDay  = AllDaySwitch.On;
                }
                else
                {
                    ScheduleAppointment appointment = new ScheduleAppointment();
                    appointment.Subject               = (NSString)LabelSubject.Text;
                    appointment.Location              = (NSString)LabelLocation.Text;
                    appointment.StartTime             = PickerStartDate.Date;
                    appointment.EndTime               = PickerEndDate.Date;
                    appointment.AppointmentBackground = UIColor.FromRGB(0xA2, 0xC1, 0x39);
                    appointment.IsAllDay              = AllDaySwitch.On;
                    (schedule.ItemsSource as ObservableCollection <ScheduleAppointment>).Add(appointment);
                }

                Editor.Hidden   = true;
                schedule.Hidden = false;
                schedule.ReloadData();
                Editor.EndEditing(true);
            };

            //subject label
            LabelSubject.TextColor          = UIColor.Black;
            LabelSubject.TextAlignment      = UITextAlignment.Left;
            LabelSubject.Layer.CornerRadius = 8;
            LabelSubject.Layer.BorderWidth  = 2;
            LabelSubject.Layer.BorderColor  = UIColor.FromRGB(246, 246, 246).CGColor;

            //location label
            LabelLocation.TextColor          = UIColor.Black;
            LabelLocation.TextAlignment      = UITextAlignment.Left;
            LabelLocation.Layer.CornerRadius = 8;
            LabelLocation.Layer.BorderWidth  = 2;
            LabelLocation.Layer.BorderColor  = UIColor.FromRGB(246, 246, 246).CGColor;

            //starts time
            LabelStarts.Text      = "Start Time";
            LabelStarts.TextColor = UIColor.Black;

            ButtonStartDate.SetTitle("Start time", UIControlState.Normal);
            ButtonStartDate.Layer.BorderWidth  = 2;
            ButtonStartDate.Layer.CornerRadius = 4;
            ButtonStartDate.Layer.BorderColor  = UIColor.FromRGB(246, 246, 246).CGColor;
            ButtonStartDate.SetTitleColor(UIColor.Black, UIControlState.Normal);
            ButtonStartDate.HorizontalAlignment = UIControlContentHorizontalAlignment.Center;
            ButtonStartDate.TouchUpInside      += (object sender, EventArgs e) =>
            {
                PickerStartDate.Hidden = false;
                DoneButton.Hidden      = false;

                AllDaylabel.Hidden       = true;
                AllDaySwitch.Hidden      = true;
                ButtonCancel.Hidden      = true;
                ButtonSave.Hidden        = true;
                EndTimeZoneLabel.Hidden  = true;
                EndTimeZoneButton.Hidden = true;
                Editor.EndEditing(true);
            };

            //end time
            LabelEnds.Text      = "End Time";
            LabelEnds.TextColor = UIColor.Black;

            //end date
            ButtonEndDate.SetTitle("End time", UIControlState.Normal);
            ButtonEndDate.SetTitleColor(UIColor.Black, UIControlState.Normal);
            ButtonEndDate.Layer.BorderWidth   = 2;
            ButtonEndDate.Layer.CornerRadius  = 4;
            ButtonEndDate.Layer.BorderColor   = UIColor.FromRGB(246, 246, 246).CGColor;
            ButtonEndDate.HorizontalAlignment = UIControlContentHorizontalAlignment.Center;
            ButtonEndDate.TouchUpInside      += (object sender, EventArgs e) =>
            {
                PickerEndDate.Hidden     = false;
                DoneButton.Hidden        = false;
                AllDaylabel.Hidden       = true;
                AllDaySwitch.Hidden      = true;
                ButtonCancel.Hidden      = true;
                ButtonSave.Hidden        = true;
                EndTimeZoneLabel.Hidden  = true;
                EndTimeZoneButton.Hidden = true;

                Editor.EndEditing(true);
            };

            //date and time pickers
            PickerStartDate.Hidden     = true;
            PickerEndDate.Hidden       = true;
            StartTimeZonePicker.Hidden = true;
            EndTimeZonePicker.Hidden   = true;
            DoneButton.Hidden          = true;

            //done button
            DoneButton.SetTitle("Done", UIControlState.Normal);
            DoneButton.SetTitleColor(UIColor.Blue, UIControlState.Normal);
            DoneButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Right;
            DoneButton.TouchUpInside      += (object sender, EventArgs e) =>
            {
                PickerStartDate.Hidden     = true;
                PickerEndDate.Hidden       = true;
                StartTimeZonePicker.Hidden = true;
                EndTimeZonePicker.Hidden   = true;
                DoneButton.Hidden          = true;

                LabelEnds.Hidden           = false;
                ButtonEndDate.Hidden       = false;
                ButtonStartDate.Hidden     = false;
                LabelStarts.Hidden         = false;
                EndTimeZoneLabel.Hidden    = false;
                StartTimeZoneLabel.Hidden  = false;
                AllDaylabel.Hidden         = false;
                AllDaySwitch.Hidden        = false;
                StartTimeZoneButton.Hidden = false;
                EndTimeZoneButton.Hidden   = false;
                ButtonCancel.Hidden        = false;
                ButtonSave.Hidden          = false;

                String _sDate = DateTime.Parse(PickerStartDate.Date.ToString()).ToString();
                ButtonStartDate.SetTitle(_sDate, UIControlState.Normal);

                String _eDate = DateTime.Parse(PickerEndDate.Date.ToString()).ToString();
                ButtonEndDate.SetTitle(_eDate, UIControlState.Normal);
                Editor.EndEditing(true);
            };

            SchedulePickerModel model = new SchedulePickerModel(TimeZoneCollection.TimeZoneList);

            model.PickerChanged += (sender, e) =>
            {
                if (e.SelectedValue != "Default" && scheduleViews.SelectedAppointment != null)
                {
                    scheduleViews.SelectedAppointment.StartTimeZone = e.SelectedValue;
                }

                StartTimeZoneButton.SetTitle(e.SelectedValue, UIControlState.Normal);
            };

            SchedulePickerModel model2 = new SchedulePickerModel(TimeZoneCollection.TimeZoneList);

            model2.PickerChanged += (sender, e) =>
            {
                if (e.SelectedValue != "Default" && scheduleViews.SelectedAppointment != null)
                {
                    scheduleViews.SelectedAppointment.EndTimeZone = e.SelectedValue;
                }

                EndTimeZoneButton.SetTitle(e.SelectedValue, UIControlState.Normal);
            };

            StartTimeZonePicker.Model = model;
            EndTimeZonePicker.Model   = model2;
            StartTimeZonePicker.ShowSelectionIndicator = true;
            EndTimeZonePicker.ShowSelectionIndicator   = true;

            ScrollView.Add(LabelSubject);
            ScrollView.Add(LabelLocation);
            ScrollView.Add(LabelStarts);
            ScrollView.Add(ButtonStartDate);
            ScrollView.Add(StartTimeZoneLabel);
            ScrollView.Add(StartTimeZoneButton);
            ScrollView.Add(LabelEnds);
            ScrollView.Add(ButtonEndDate);
            ScrollView.Add(EndTimeZoneLabel);
            ScrollView.Add(EndTimeZoneButton);
            ScrollView.Add(StartTimeZonePicker);
            ScrollView.Add(EndTimeZonePicker);
            ScrollView.Add(PickerEndDate);
            ScrollView.Add(PickerStartDate);
            ScrollView.Add(DoneButton);
            ScrollView.Add(AllDaylabel);
            ScrollView.Add(AllDaySwitch);
            ScrollView.Add(ButtonCancel);
            ScrollView.Add(ButtonSave);

            Editor.Add(ScrollView);
        }
Пример #3
0
        internal void CreateEditor()
        {
            button_cancel       = new UIButton();
            button_save         = new UIButton();
            label_subject       = new UITextView();
            label_location      = new UITextView();
            label_ends          = new UILabel();
            label_starts        = new UILabel();
            button_startDate    = new UIButton();
            button_endDate      = new UIButton();
            startTimeZoneLabel  = new UILabel();
            endTimeZoneLabel    = new UILabel();
            startTimeZoneButton = new UIButton();
            endTimeZoneButton   = new UIButton();
            picker_startDate    = new UIDatePicker();
            picker_endDate      = new UIDatePicker();
            done_button         = new UIButton();
            scrollView          = new UIScrollView();
            startTimeZonePicker = new UIPickerView();
            endTimeZonePicker   = new UIPickerView();
            allDaySwitch        = new UISwitch();
            allDaylabel         = new UILabel();

            scrollView.BackgroundColor = UIColor.White;

            label_subject.Font       = UIFont.SystemFontOfSize(14);
            label_location.Font      = UIFont.SystemFontOfSize(14);
            label_starts.Font        = UIFont.SystemFontOfSize(15);
            label_ends.Font          = UIFont.SystemFontOfSize(15);
            startTimeZoneLabel.Font  = UIFont.SystemFontOfSize(15);
            endTimeZoneLabel.Font    = UIFont.SystemFontOfSize(15);
            allDaylabel.Font         = UIFont.SystemFontOfSize(15);
            startTimeZoneButton.Font = UIFont.SystemFontOfSize(15);
            endTimeZoneButton.Font   = UIFont.SystemFontOfSize(15);
            button_startDate.Font    = UIFont.SystemFontOfSize(15);
            button_endDate.Font      = UIFont.SystemFontOfSize(15);

            button_cancel.BackgroundColor = UIColor.FromRGB(229, 229, 229);
            button_cancel.Font            = UIFont.SystemFontOfSize(15);
            button_save.Font                    = UIFont.SystemFontOfSize(15);
            button_save.BackgroundColor         = UIColor.FromRGB(33, 150, 243);
            button_cancel.Layer.CornerRadius    = 6;
            button_save.Layer.CornerRadius      = 6;
            button_startDate.Layer.CornerRadius = 6;
            button_endDate.Layer.CornerRadius   = 6;


            startTimeZoneLabel.Text      = "Start Time Zone";
            startTimeZoneLabel.TextColor = UIColor.Black;

            endTimeZoneLabel.Text      = "End Time Zone";
            endTimeZoneLabel.TextColor = UIColor.Black;

            allDaylabel.Text      = "All Day";
            allDaylabel.TextColor = UIColor.Black;

            allDaySwitch.On            = false;
            allDaySwitch.OnTintColor   = UIColor.FromRGB(33, 150, 243);
            allDaySwitch.ValueChanged += AllDaySwitch_ValueChanged;

            startTimeZoneButton.SetTitle("Default", UIControlState.Normal);
            startTimeZoneButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            startTimeZoneButton.Layer.BorderWidth   = 2;
            startTimeZoneButton.Layer.CornerRadius  = 4;
            startTimeZoneButton.Layer.BorderColor   = UIColor.FromRGB(246, 246, 246).CGColor;
            startTimeZoneButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center;
            startTimeZoneButton.TouchUpInside      += (object sender, EventArgs e) =>
            {
                startTimeZonePicker.Hidden = false;
                done_button.Hidden         = false;

                allDaylabel.Hidden       = true;
                allDaySwitch.Hidden      = true;
                button_cancel.Hidden     = true;
                button_save.Hidden       = true;
                endTimeZoneLabel.Hidden  = true;
                endTimeZoneButton.Hidden = true;
                Editor.EndEditing(true);
            };

            endTimeZoneButton.SetTitle("Default", UIControlState.Normal);
            endTimeZoneButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            endTimeZoneButton.Layer.BorderWidth   = 2;
            endTimeZoneButton.Layer.CornerRadius  = 4;
            endTimeZoneButton.Layer.BorderColor   = UIColor.FromRGB(246, 246, 246).CGColor;
            endTimeZoneButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center;
            endTimeZoneButton.TouchUpInside      += (object sender, EventArgs e) =>
            {
                endTimeZonePicker.Hidden = false;
                done_button.Hidden       = false;
                allDaylabel.Hidden       = true;
                allDaySwitch.Hidden      = true;
                button_cancel.Hidden     = true;
                button_save.Hidden       = true;
                endTimeZoneLabel.Hidden  = true;
                endTimeZoneButton.Hidden = true;
                Editor.EndEditing(true);
            };


            //cancel button
            button_cancel.SetTitle("Cancel", UIControlState.Normal);
            button_cancel.SetTitleColor(UIColor.FromRGB(59, 59, 59), UIControlState.Normal);// UIColor.FromRGB(59, 59, 59);
            button_cancel.TouchUpInside += (object sender, EventArgs e) =>
            {
                Editor.Hidden   = true;
                schedule.Hidden = false;
                Editor.EndEditing(true);
                scheduleViews.headerView.Hidden = false;
            };

            //save button
            button_save.SetTitle("Save", UIControlState.Normal);
            button_save.SetTitleColor(UIColor.White, UIControlState.Normal);
            button_save.TouchUpInside += (object sender, EventArgs e) =>
            {
                scheduleViews.headerView.Hidden = false;
                if (scheduleViews.indexOfAppointment != -1)
                {
                    (schedule.ItemsSource as ObservableCollection <ScheduleAppointment>)[int.Parse(scheduleViews.indexOfAppointment.ToString())].Subject   = (NSString)label_subject.Text;
                    (schedule.ItemsSource as ObservableCollection <ScheduleAppointment>)[int.Parse(scheduleViews.indexOfAppointment.ToString())].Location  = (NSString)label_location.Text;
                    (schedule.ItemsSource as ObservableCollection <ScheduleAppointment>)[int.Parse(scheduleViews.indexOfAppointment.ToString())].StartTime = picker_startDate.Date;
                    (schedule.ItemsSource as ObservableCollection <ScheduleAppointment>)[int.Parse(scheduleViews.indexOfAppointment.ToString())].EndTime   = picker_endDate.Date;
                    (schedule.ItemsSource as ObservableCollection <ScheduleAppointment>)[int.Parse(scheduleViews.indexOfAppointment.ToString())].IsAllDay  = allDaySwitch.On;
                }
                else
                {
                    ScheduleAppointment appointment = new ScheduleAppointment();
                    appointment.Subject               = (NSString)label_subject.Text;
                    appointment.Location              = (NSString)label_location.Text;
                    appointment.StartTime             = picker_startDate.Date;
                    appointment.EndTime               = picker_endDate.Date;
                    appointment.AppointmentBackground = UIColor.FromRGB(0xA2, 0xC1, 0x39);
                    appointment.IsAllDay              = allDaySwitch.On;
                    (schedule.ItemsSource as ObservableCollection <ScheduleAppointment>).Add(appointment);
                }
                Editor.Hidden   = true;
                schedule.Hidden = false;
                schedule.ReloadData();
                Editor.EndEditing(true);
            };

            //subject label
            label_subject.TextColor          = UIColor.Black;
            label_subject.TextAlignment      = UITextAlignment.Left;
            label_subject.Layer.CornerRadius = 8;
            label_subject.Layer.BorderWidth  = 2;
            label_subject.Layer.BorderColor  = UIColor.FromRGB(246, 246, 246).CGColor;


            //location label
            label_location.TextColor          = UIColor.Black;
            label_location.TextAlignment      = UITextAlignment.Left;
            label_location.Layer.CornerRadius = 8;
            label_location.Layer.BorderWidth  = 2;
            label_location.Layer.BorderColor  = UIColor.FromRGB(246, 246, 246).CGColor;

            //starts time

            label_starts.Text      = "Start Time";
            label_starts.TextColor = UIColor.Black;

            button_startDate.SetTitle("Start time", UIControlState.Normal);
            button_startDate.Layer.BorderWidth  = 2;
            button_startDate.Layer.CornerRadius = 4;
            button_startDate.Layer.BorderColor  = UIColor.FromRGB(246, 246, 246).CGColor;
            button_startDate.SetTitleColor(UIColor.Black, UIControlState.Normal);
            button_startDate.HorizontalAlignment = UIControlContentHorizontalAlignment.Center;
            button_startDate.TouchUpInside      += (object sender, EventArgs e) =>
            {
                picker_startDate.Hidden = false;
                done_button.Hidden      = false;

                allDaylabel.Hidden       = true;
                allDaySwitch.Hidden      = true;
                button_cancel.Hidden     = true;
                button_save.Hidden       = true;
                endTimeZoneLabel.Hidden  = true;
                endTimeZoneButton.Hidden = true;
                Editor.EndEditing(true);
            };

            //end time

            label_ends.Text      = "End Time";
            label_ends.TextColor = UIColor.Black;


            //end date
            button_endDate.SetTitle("End time", UIControlState.Normal);
            button_endDate.SetTitleColor(UIColor.Black, UIControlState.Normal);
            button_endDate.Layer.BorderWidth   = 2;
            button_endDate.Layer.CornerRadius  = 4;
            button_endDate.Layer.BorderColor   = UIColor.FromRGB(246, 246, 246).CGColor;
            button_endDate.HorizontalAlignment = UIControlContentHorizontalAlignment.Center;
            button_endDate.TouchUpInside      += (object sender, EventArgs e) =>
            {
                picker_endDate.Hidden    = false;
                done_button.Hidden       = false;
                allDaylabel.Hidden       = true;
                allDaySwitch.Hidden      = true;
                button_cancel.Hidden     = true;
                button_save.Hidden       = true;
                endTimeZoneLabel.Hidden  = true;
                endTimeZoneButton.Hidden = true;

                Editor.EndEditing(true);
            };

            //date and time pickers
            picker_startDate.Hidden    = true;
            picker_endDate.Hidden      = true;
            startTimeZonePicker.Hidden = true;
            endTimeZonePicker.Hidden   = true;
            done_button.Hidden         = true;

            //done button
            done_button.SetTitle("Done", UIControlState.Normal);
            done_button.SetTitleColor(UIColor.Blue, UIControlState.Normal);
            done_button.HorizontalAlignment = UIControlContentHorizontalAlignment.Right;
            done_button.TouchUpInside      += (object sender, EventArgs e) =>
            {
                picker_startDate.Hidden    = true;
                picker_endDate.Hidden      = true;
                startTimeZonePicker.Hidden = true;
                endTimeZonePicker.Hidden   = true;
                done_button.Hidden         = true;

                label_ends.Hidden          = false;
                button_endDate.Hidden      = false;
                button_startDate.Hidden    = false;
                label_starts.Hidden        = false;
                endTimeZoneLabel.Hidden    = false;
                startTimeZoneLabel.Hidden  = false;
                allDaylabel.Hidden         = false;
                allDaySwitch.Hidden        = false;
                startTimeZoneButton.Hidden = false;
                endTimeZoneButton.Hidden   = false;
                button_cancel.Hidden       = false;
                button_save.Hidden         = false;

                String _sDate = DateTime.Parse((picker_startDate.Date.ToString())).ToString();
                button_startDate.SetTitle(_sDate, UIControlState.Normal);

                String _eDate = DateTime.Parse((picker_endDate.Date.ToString())).ToString();
                button_endDate.SetTitle(_eDate, UIControlState.Normal);
                Editor.EndEditing(true);
            };

            SchedulePickerModel model = new SchedulePickerModel(TimeZoneCollection.TimeZoneList);

            model.PickerChanged += (sender, e) =>
            {
                if (e.SelectedValue != "Default" && scheduleViews.selectedAppointment != null)
                {
                    scheduleViews.selectedAppointment.StartTimeZone = e.SelectedValue;
                }
                startTimeZoneButton.SetTitle(e.SelectedValue, UIControlState.Normal);
            };

            SchedulePickerModel model2 = new SchedulePickerModel(TimeZoneCollection.TimeZoneList);

            model2.PickerChanged += (sender, e) =>
            {
                if (e.SelectedValue != "Default" && scheduleViews.selectedAppointment != null)
                {
                    scheduleViews.selectedAppointment.EndTimeZone = e.SelectedValue;
                }
                endTimeZoneButton.SetTitle(e.SelectedValue, UIControlState.Normal);
            };

            startTimeZonePicker.Model = model;
            endTimeZonePicker.Model   = model2;
            startTimeZonePicker.ShowSelectionIndicator = true;
            endTimeZonePicker.ShowSelectionIndicator   = true;

            scrollView.Add(label_subject);
            scrollView.Add(label_location);
            scrollView.Add(label_starts);
            scrollView.Add(button_startDate);
            scrollView.Add(startTimeZoneLabel);
            scrollView.Add(startTimeZoneButton);
            scrollView.Add(label_ends);
            scrollView.Add(button_endDate);
            scrollView.Add(endTimeZoneLabel);
            scrollView.Add(endTimeZoneButton);
            scrollView.Add(startTimeZonePicker);
            scrollView.Add(endTimeZonePicker);
            scrollView.Add(picker_endDate);
            scrollView.Add(picker_startDate);
            scrollView.Add(done_button);
            scrollView.Add(allDaylabel);
            scrollView.Add(allDaySwitch);
            scrollView.Add(button_cancel);
            scrollView.Add(button_save);

            Editor.Add(scrollView);
        }