コード例 #1
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();
        }
コード例 #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);
        }
コード例 #4
0
        internal void CreateOptionWindow()
        {
            if (TimezoneButton == null)
            {
                TimezoneButton = new UIButton();
                TimezoneButton.Layer.BorderWidth  = 2;
                TimezoneButton.Layer.CornerRadius = 4;
                TimezoneButton.Layer.BorderColor  = UIColor.FromRGB(246, 246, 246).CGColor;
                TimezoneButton.SetTitle("Default", UIControlState.Normal);
                TimezoneButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            }

            if (TimezoneLabel == null)
            {
                TimezoneLabel           = new UILabel();
                TimezoneLabel.Text      = "Time Zone";
                TimezoneLabel.TextColor = UIColor.Black;
            }

            if (TimeZonePicker == null)
            {
                TimeZonePicker        = new UIPickerView();
                TimeZonePicker.Hidden = true;
            }

            if (DoneButton1 == null)
            {
                DoneButton1        = new UIButton();
                DoneButton1.Hidden = true;
                DoneButton1.SetTitleColor(UIColor.Black, UIControlState.Normal);
                DoneButton1.SetTitle("Done\t", UIControlState.Normal);
                DoneButton1.BackgroundColor     = UIColor.LightGray;
                DoneButton1.HorizontalAlignment = UIControlContentHorizontalAlignment.Right;
            }

            TimezoneButton.TouchUpInside += (object sender, EventArgs e) =>
            {
                TimeZonePicker.Hidden = false;
                DoneButton1.Hidden    = false;
            };
            DoneButton1.TouchUpInside += (object sender, EventArgs e) =>
            {
                TimeZonePicker.Hidden = true;
                DoneButton1.Hidden    = true;
            };

            SchedulePickerModel model = new SchedulePickerModel(TimeZoneCollection.TimeZoneList);

            model.PickerChanged += (sender, e) =>
            {
                if (e.SelectedValue != "Default")
                {
                    schedule.TimeZone = e.SelectedValue;
                }

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

            TimeZonePicker.Model = model;
            TimeZonePicker.ShowSelectionIndicator = true;

            if (Utility.IsIPad)
            {
                TimezoneLabel.Frame  = new CGRect(0, 0, 320, 30);
                TimezoneButton.Frame = new CGRect(0, TimezoneLabel.Frame.Bottom, 320, 30);
                DoneButton1.Frame    = new CGRect(0, TimezoneButton.Frame.Bottom, 320, 30);
                TimeZonePicker.Frame = new CGRect(0, DoneButton1.Frame.Bottom, 320, 200);
            }
        }
コード例 #5
0
        /// <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();
        }