private void CreateOptionView() { //Schedule View Localization.SchedulePickerModel model = new Localization.SchedulePickerModel(scheduleViewsCollection); pickerScheduleView.Model = model; labelScheduleView.Text = "Select the Schedule Type"; labelScheduleView.TextColor = UIColor.Black; labelScheduleView.TextAlignment = UITextAlignment.Left; buttonScheduleView.SetTitle("WeekView", UIControlState.Normal); buttonScheduleView.SetTitleColor(UIColor.Black, UIControlState.Normal); buttonScheduleView.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; buttonScheduleView.Layer.CornerRadius = 8; buttonScheduleView.Layer.BorderWidth = 2; buttonScheduleView.TouchUpInside += ShowPicker1; buttonScheduleView.Layer.BorderColor = UIColor.FromRGB(246, 246, 246).CGColor; doneButton.SetTitle("Done\t", UIControlState.Normal); doneButton.SetTitleColor(UIColor.Black, UIControlState.Normal); doneButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Right; doneButton.TouchUpInside += HidePicker; doneButton.Hidden = true; doneButton.BackgroundColor = UIColor.FromRGB(246, 246, 246); model.PickerChanged += Model_PickerChanged; pickerScheduleView.ShowSelectionIndicator = true; pickerScheduleView.Hidden = true; //working Hours labelWorkingHours.Text = "Working Hours "; labelWorkingHours.TextColor = UIColor.Black; labelWorkingHours.TextAlignment = UITextAlignment.Left; rangeslider.Maximum = 24; rangeslider.Minimum = 0; rangeslider.RangeStart = (nfloat)schedule.WeekViewSettings.WorkStartHour; rangeslider.RangeEnd = (nfloat)schedule.WeekViewSettings.WorkEndHour; rangeslider.ShowRange = true; rangeslider.ShowValueLabel = false; rangeslider.SnapsTo = SFSnapsTo.SFSnapsToNone; rangeslider.TickPlacement = SFTickPlacement.SFTickPlacementNone; rangeslider.LabelColor = UIColor.Gray; rangeslider.TickFrequency = 2; rangeslider.ToolTipPlacement = SFToolTipPlacement.SFToolTipPlacementTopLeft; rangeslider.KnobColor = UIColor.White; rangeslider.RangeValueChange += Slider_RangeValueChange; // show week number labelWeekNumber.Text = "Show Week number "; labelWeekNumber.TextColor = UIColor.Black; labelWeekNumber.TextAlignment = UITextAlignment.Left; switchWeekNumber.ValueChanged += (object sender, EventArgs e) => { SetMonthSettings(); }; //show non acceesible block labelShowNonAccess.Text = "Show Non AccessibleBlocks "; labelShowNonAccess.TextColor = UIColor.Black; labelShowNonAccess.TextAlignment = UITextAlignment.Left; switchNonAccessbleBlock.ValueChanged += (object sender, EventArgs e) => { SetNonWorkingHours(); }; //show black out dates labelBlackOutDays.Text = "Show Blackout dates "; labelBlackOutDays.TextColor = UIColor.Black; labelBlackOutDays.TextAlignment = UITextAlignment.Left; switchBlackOutDates.On = true; switchBlackOutDates.ValueChanged += (object sender, EventArgs e) => { SetMonthSettings(); }; string deviceType = UIDevice.CurrentDevice.Model; if (deviceType == "iPhone" || deviceType == "iPod touch") { labelWorkingHours.Frame = new CGRect(this.Frame.X + 10, this.Frame.Y - 70, this.Frame.Size.Width - 20, 30); rangeslider.Frame = new CGRect(this.Frame.X + 10, this.Frame.Y - 40, this.Frame.Size.Width - 20, 30); switchWeekNumber.Frame = new CGRect(this.Frame.X + 10, this.Frame.Y, this.Frame.Size.Width / 9, 30); labelWeekNumber.Frame = new CGRect((this.Frame.Size.Width / 9) + 30, this.Frame.Y, this.Frame.Size.Width - 20, 30); //switch_weekNumber switchNonAccessbleBlock.Frame = new CGRect(this.Frame.X + 10, this.Frame.Y + 40, this.Frame.Size.Width / 9, 30); labelShowNonAccess.Frame = new CGRect((this.Frame.Size.Width / 9) + 30, this.Frame.Y + 40, this.Frame.Size.Width - 20, 30); //switch_nonAccessbleBlock switchBlackOutDates.Frame = new CGRect(this.Frame.X + 10, this.Frame.Y + 80, this.Frame.Size.Width / 9, 30); labelBlackOutDays.Frame = new CGRect((this.Frame.Size.Width / 9) + 30, this.Frame.Y + 80, this.Frame.Size.Width - 20, 30); //label_blackOutDays labelScheduleView.Frame = new CGRect(this.Frame.X + 10, this.Frame.Y + 120, this.Frame.Size.Width - 20, 30); buttonScheduleView.Frame = new CGRect(this.Frame.X + 10, this.Frame.Y + 150, this.Frame.Size.Width - 20, 30); doneButton.Frame = new CGRect(this.Frame.X + 10, this.Frame.Y + 180, this.Frame.Size.Width - 20, 30); pickerScheduleView.Frame = new CGRect(this.Frame.X + 10, this.Frame.Y + 170, this.Frame.Size.Width - 20, 150); } else { schedule.DayViewSettings.WorkStartHour = 7; schedule.DayViewSettings.WorkEndHour = 18; schedule.WeekViewSettings.WorkStartHour = 7; schedule.WeekViewSettings.WorkEndHour = 18; schedule.WorkWeekViewSettings.WorkStartHour = 7; schedule.WorkWeekViewSettings.WorkEndHour = 18; labelWorkingHours.Frame = new CGRect(10, 10, 320, 20); rangeslider.Frame = new CGRect(0, 30, 320, 30); switchWeekNumber.Frame = new CGRect(10, 60, 30, 30); labelWeekNumber.Frame = new CGRect(80, 60, 320, 30); //switch_weekNumber switchNonAccessbleBlock.Frame = new CGRect(10, 100, 30, 30); labelShowNonAccess.Frame = new CGRect(80, 100, 320, 30); //switch_nonAccessbleBlock switchBlackOutDates.Frame = new CGRect(10, 140, 30, 30); labelBlackOutDays.Frame = new CGRect(80, 140, 320, 30); //label_blackOutDays labelScheduleView.Frame = new CGRect(10, 180, 320, 20); buttonScheduleView.Frame = new CGRect(0, 210, 320, 30); doneButton.Frame = new CGRect(0, 250, 320, 30); pickerScheduleView.Frame = new CGRect(0, 270, 320, 100); } this.OptionView.AddSubview(labelWorkingHours); this.OptionView.AddSubview(rangeslider); this.OptionView.AddSubview(labelWeekNumber); this.OptionView.AddSubview(switchWeekNumber); this.OptionView.AddSubview(labelShowNonAccess); this.OptionView.AddSubview(switchNonAccessbleBlock); this.OptionView.AddSubview(labelBlackOutDays); this.OptionView.AddSubview(switchBlackOutDates); this.OptionView.AddSubview(labelScheduleView); this.OptionView.AddSubview(buttonScheduleView); this.OptionView.AddSubview(pickerScheduleView); this.OptionView.AddSubview(doneButton); }
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; }