예제 #1
0
        private void CreateOptionView()
        {
            ScheduleEditor.CreateOptionWindow();
            var deviceType = UIDevice.CurrentDevice.Model;

            if (deviceType == "iPad")
            {
                ScheduleEditor.TimezoneLabel.Frame  = new CGRect(10, 0, 320, 30);
                ScheduleEditor.TimezoneButton.Frame = new CGRect(0, ScheduleEditor.TimezoneLabel.Frame.Bottom, 320, 30);
                ScheduleEditor.DoneButton1.Frame    = new CGRect(0, ScheduleEditor.TimezoneButton.Frame.Bottom, 320, 30);
                ScheduleEditor.TimeZonePicker.Frame = new CGRect(0, ScheduleEditor.DoneButton1.Frame.Bottom, 320, 200);
            }
            else
            {
                ScheduleEditor.TimezoneLabel.Frame  = new CGRect(0, 0, this.Frame.Size.Width, 30);
                ScheduleEditor.TimezoneButton.Frame = new CGRect(0, ScheduleEditor.TimezoneLabel.Frame.Bottom, this.Frame.Size.Width, 30);
                ScheduleEditor.DoneButton1.Frame    = new CGRect(0, ScheduleEditor.TimezoneButton.Frame.Bottom, this.Frame.Size.Width, 30);
                ScheduleEditor.TimeZonePicker.Frame = new CGRect(0, ScheduleEditor.DoneButton1.Frame.Bottom, this.Frame.Size.Width, 200);
            }

            this.OptionView.AddSubview(ScheduleEditor.TimezoneLabel);
            this.OptionView.AddSubview(ScheduleEditor.TimezoneButton);
            this.OptionView.AddSubview(ScheduleEditor.DoneButton1);
            this.OptionView.AddSubview(ScheduleEditor.TimeZonePicker);
        }
예제 #2
0
        private void Schedule_DoubleTapped(object sender, CellTappedEventArgs e)
        {
            //base.didSelectDate (schedule, selectedDate, appointments);
            ScheduleEditor.Editor.Hidden = false;
            HeaderView.Hidden            = true;
            Schedule.Hidden    = true;
            IndexOfAppointment = -1;
            TableView.Hidden   = true;
            if (e.ScheduleAppointment != null)
            {
                for (int i = 0; i < (Schedule.ItemsSource as ObservableCollection <ScheduleAppointment>).Count; i++)
                {
                    if ((Schedule.ItemsSource as ObservableCollection <ScheduleAppointment>)[i] == e.ScheduleAppointment)
                    {
                        IndexOfAppointment = int.Parse(i.ToString());
                        break;
                    }
                }

                SelectedAppointment = e.ScheduleAppointment;
                ScheduleEditor.LabelSubject.Text  = SelectedAppointment.Subject;
                ScheduleEditor.LabelLocation.Text = SelectedAppointment.Location;
                String startDate = DateTime.Parse(SelectedAppointment.StartTime.ToString()).ToString();
                ScheduleEditor.ButtonStartDate.SetTitle(startDate, UIControlState.Normal);
                ScheduleEditor.PickerStartDate.SetDate(SelectedAppointment.StartTime, true);
                String endDate = DateTime.Parse(SelectedAppointment.EndTime.ToString()).ToString();
                ScheduleEditor.ButtonEndDate.SetTitle(endDate, UIControlState.Normal);
                ScheduleEditor.PickerEndDate.SetDate(SelectedAppointment.EndTime, true);
                ScheduleEditor.AllDaySwitch.On = SelectedAppointment.IsAllDay;
                if (ScheduleEditor.AllDaySwitch.On)
                {
                    ScheduleEditor.Disablechild();
                }
                else
                {
                    ScheduleEditor.EnableChild();
                }

                ScheduleEditor.Editor.EndEditing(true);
            }
            else
            {
                List <UIColor> colorCollection = new List <UIColor>();
                colorCollection.Add(UIColor.FromRGB(0xA2, 0xC1, 0x39));
                colorCollection.Add(UIColor.FromRGB(0xD8, 0x00, 0x73));
                ScheduleEditor.LabelSubject.Text  = "Subject";
                ScheduleEditor.LabelLocation.Text = "Location";
                String startDate = DateTime.Parse(e.Date.ToString()).ToString();
                ScheduleEditor.PickerStartDate.SetDate(e.Date, true);
                ScheduleEditor.ButtonStartDate.SetTitle(startDate, UIControlState.Normal);
                String endDate = DateTime.Parse(e.Date.AddSeconds(3600).ToString()).ToString();
                ScheduleEditor.PickerEndDate.SetDate(e.Date.AddSeconds(3600), true);
                ScheduleEditor.ButtonEndDate.SetTitle(endDate, UIControlState.Normal);
                ScheduleEditor.AllDaySwitch.On = false;
                this.ScheduleEditor.EnableChild();
            }
        }
예제 #3
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;
 }
예제 #4
0
        public override void LayoutSubviews()
        {
            foreach (var view in this.Subviews)
            {
                view.Frame = new CGRect(Frame.X, 0, Frame.Width, Frame.Height);
            }

            CreateOptionView();
            ScheduleEditor.Editor.Frame     = new CGRect(0, 0, this.Frame.Size.Width, this.Frame.Size.Height);
            ScheduleEditor.ScrollView.Frame = new CGRect(ScheduleEditor.Editor.Frame.X + 10, ScheduleEditor.Editor.Frame.Y + 10, ScheduleEditor.Editor.Frame.Size.Width - 10, ScheduleEditor.Editor.Frame.Size.Height);

            ScheduleEditor.EditorFrameUpdate();

            UIImageView image1 = new UIImageView();
            UIImageView image2 = new UIImageView();
            UIImageView image3 = new UIImageView();

            moveToDate = new UIButton();
            editorView = new UIButton();
            monthText  = new UILabel();

            HeaderView = new UIView();
            HeaderView.BackgroundColor = UIColor.FromRGB(214, 214, 214);

            NSDate     today    = new NSDate();
            NSCalendar calendar = NSCalendar.CurrentCalendar;

            // Get the year, month, day from the date
            NSDateComponents components = calendar.Components(
                NSCalendarUnit.Year | NSCalendarUnit.Month | NSCalendarUnit.Day, today);
            NSDate          startDate  = calendar.DateFromComponents(components);
            NSDateFormatter dateFormat = new NSDateFormatter();

            dateFormat.DateFormat = "MMMM YYYY";
            string monthName = dateFormat.ToString(startDate);

            monthText.Text          = monthName;
            monthText.TextColor     = UIColor.Black;
            monthText.TextAlignment = UITextAlignment.Left;
            moveToDate.AddSubview(image2);
            headerButton.AddSubview(image1);
            editorView.AddSubview(image3);

            string[] tableItems = new string[] { "Day", "Week", "WorkWeek", "Month" };
            TableView        = new UITableView();
            TableView.Frame  = new CGRect(0, 0, this.Frame.Size.Width / 2, 60.0f * 4);
            TableView.Hidden = true;
            TableView.Source = new ScheduleTableSource(tableItems);

            string deviceType = UIDevice.CurrentDevice.Model;

            if (deviceType == "iPhone" || deviceType == "iPod touch")
            {
                image1.Frame = new CGRect(0, 0, 60, 60);
                image1.Image = UIImage.FromFile("black-09.png");
                image2.Frame = new CGRect(0, 0, 60, 60);
                image2.Image = UIImage.FromFile("black-11.png");
                image3.Frame = new CGRect(0, 0, 60, 60);
                image3.Image = UIImage.FromFile("black-10.png");

                HeaderView.Frame   = new CGRect(0, 0, this.Frame.Size.Width, 50);
                moveToDate.Frame   = new CGRect((this.Frame.Size.Width / 6) + (this.Frame.Size.Width / 2), -10, this.Frame.Size.Width / 8, 50);
                editorView.Frame   = new CGRect((this.Frame.Size.Width / 6) + (this.Frame.Size.Width / 6) + (this.Frame.Size.Width / 2), -10, this.Frame.Size.Width / 8, 50);
                headerButton.Frame = new CGRect(-10, -10, this.Frame.Size.Width / 8, 50);
                monthText.Frame    = new CGRect(this.Frame.Size.Width / 8, -10, this.Frame.Size.Width / 2, 60);
                Schedule.Frame     = new CGRect(0, 50, this.Frame.Size.Width, this.Frame.Size.Height - 50);
            }
            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;

                image1.Frame = new CGRect(0, 0, 80, 80);
                image1.Image = UIImage.FromFile("black-09.png");
                image2.Frame = new CGRect(0, 0, 80, 80);
                image2.Image = UIImage.FromFile("black-11.png");
                image3.Frame = new CGRect(0, 0, 80, 80);
                image3.Image = UIImage.FromFile("black-10.png");

                HeaderView.Frame   = new CGRect(0, 0, this.Frame.Size.Width, 60);
                moveToDate.Frame   = new CGRect((this.Frame.Size.Width / 5) + (this.Frame.Size.Width / 2) + (this.Frame.Size.Width / 8), -10, this.Frame.Size.Width / 8, 50);
                editorView.Frame   = new CGRect((this.Frame.Size.Width / 5) + (this.Frame.Size.Width / 5) + (this.Frame.Size.Width / 2), -10, this.Frame.Size.Width / 8, 50);
                headerButton.Frame = new CGRect(0, -10, this.Frame.Size.Width / 8, 50);
                monthText.Frame    = new CGRect(this.Frame.Size.Width / 8, 5, this.Frame.Size.Width / 2, 50);
                Schedule.Frame     = new CGRect(0, 60, this.Frame.Size.Width, this.Frame.Size.Height - 60);
            }

            moveToDate.TouchUpInside   += MoveToDate_TouchUpInside;
            headerButton.TouchUpInside += HeaderButton_TouchUpInside;
            editorView.TouchUpInside   += EditorView_TouchUpInside;

            HeaderView.AddSubview(moveToDate);
            HeaderView.AddSubview(editorView);
            HeaderView.AddSubview(monthText);
            HeaderView.AddSubview(headerButton);
            this.AddSubview(Schedule);
            this.AddSubview(HeaderView);
            this.AddSubview(ScheduleEditor.Editor);
            this.AddSubview(TableView);
            base.LayoutSubviews();
        }