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();
            }
        }
示例#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.label_subject.Text  = selectedAppointment.Subject;
         scheduleEditor.label_location.Text = selectedAppointment.Location;
         String _sDate = DateTime.Parse((selectedAppointment.StartTime.ToString())).ToString();
         scheduleEditor.button_startDate.SetTitle(_sDate, UIControlState.Normal);
         scheduleEditor.picker_startDate.SetDate(selectedAppointment.StartTime, true);
         String _eDate = DateTime.Parse((selectedAppointment.EndTime.ToString())).ToString();
         scheduleEditor.button_endDate.SetTitle(_eDate, UIControlState.Normal);
         scheduleEditor.picker_endDate.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.label_subject.Text  = "Subject";
         scheduleEditor.label_location.Text = "Location";
         String _sDate = DateTime.Parse((e.Date.ToString())).ToString();
         scheduleEditor.picker_startDate.SetDate(e.Date, true);
         scheduleEditor.button_startDate.SetTitle(_sDate, UIControlState.Normal);
         String _eDate = DateTime.Parse((e.Date.AddSeconds(3600).ToString())).ToString();
         scheduleEditor.picker_endDate.SetDate(e.Date.AddSeconds(3600), true);
         scheduleEditor.button_endDate.SetTitle(_eDate, UIControlState.Normal);
         scheduleEditor.allDaySwitch.On = false;
         this.scheduleEditor.EnableChild();
     }
 }