Пример #1
0
        public override View GetSampleContent(Context context)
        {
            mainLayout = new FrameLayout(context);
            mContext   = context;
            mainLayout.LayoutParameters = new ViewGroup.LayoutParams(FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.MatchParent);
            density                       = mContext.Resources.DisplayMetrics;
            linearLayout                  = new LinearLayout(context);
            linearLayout.Orientation      = Orientation.Vertical;
            linearLayout.LayoutParameters = new ViewGroup.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.MatchParent);

            //creating instance for Schedule
            sfSchedule = new SfSchedule(context);
            sfSchedule.LayoutParameters = new ViewGroup.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.MatchParent);
            sfSchedule.ScheduleView     = ScheduleView.DayView;
            sfSchedule.HeaderHeight     = 0;
            scheduleCustomHeader        = new ScheduleCustomHeader(context);

            ViewHeaderStyle viewHeader = new ViewHeaderStyle();

            viewHeader.BackgroundColor = Color.Argb(255, 242, 242, 242);
            sfSchedule.ViewHeaderStyle = viewHeader;

            //set the appointment collection
            getAppointments();
            sfSchedule.ItemsSource = appointmentCollection;


            linearLayout.AddView(scheduleCustomHeader.HeaderLayout);
            linearLayout.AddView(sfSchedule);

            editor = new ScheduleAppointmentEditor(context, sfSchedule);
            editor.EditorLayout.LayoutParameters = new ViewGroup.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.MatchParent);

            viewOptionLayout = new ScheduleViewOptionLayout(mContext, sfSchedule);
            //viewOptionLayout.LayoutParameters = new ViewGroup.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.MatchParent);
            mainLayout.AddView(linearLayout);
            mainLayout.AddView(editor.EditorLayout);
            mainLayout.AddView(viewOptionLayout.OptionLayout);
            mainLayout.GetChildAt(2).SetY(density.HeightPixels / 14);
            editor.EditorLayout.Visibility           = ViewStates.Invisible;
            viewOptionLayout.OptionLayout.Visibility = ViewStates.Invisible;
            HookEvents();
            propertylayout = SetOptionPage(context);
            return(mainLayout);
        }
Пример #2
0
 public override void Destroy()
 {
     if (sfSchedule != null)
     {
         sfSchedule.CellDoubleTapped    -= SfSchedule_DoubleTapped;
         sfSchedule.CellTapped          -= SfSchedule_CellTapped;
         sfSchedule.VisibleDatesChanged -= SfSchedule_VisibleDatesChanged;
         sfSchedule.Dispose();
         sfSchedule = null;
     }
     if (scheduleCustomHeader != null)
     {
         if (scheduleCustomHeader.scheduleCalendar != null)
         {
             scheduleCustomHeader.scheduleCalendar.Click -= ScheduleCalendar_Click;
             scheduleCustomHeader.scheduleCalendar.Dispose();
             scheduleCustomHeader.scheduleCalendar = null;
         }
         if (scheduleCustomHeader.schedulePlus != null)
         {
             scheduleCustomHeader.schedulePlus.Click -= EditorLayout_Click;
             scheduleCustomHeader.schedulePlus.Dispose();
             scheduleCustomHeader.schedulePlus = null;
         }
         if (scheduleCustomHeader.scheduleOption != null)
         {
             scheduleCustomHeader.scheduleOption.Click -= ScheduleOption_Click;
             scheduleCustomHeader.scheduleOption.Dispose();
             scheduleCustomHeader.scheduleOption = null;
         }
         scheduleCustomHeader = null;
     }
     if (editor != null)
     {
         if (editor.saveButton != null)
         {
             editor.saveButton.Click -= SaveButton_Click;
             editor.saveButton.Dispose();
             editor.saveButton = null;
         }
         if (editor.cancelButton != null)
         {
             editor.cancelButton.Click -= CancelButton_Click;
             editor.cancelButton.Dispose();
             editor.cancelButton = null;
         }
     }
     if (viewOptionLayout != null)
     {
         if (viewOptionLayout.day != null)
         {
             viewOptionLayout.day.Click -= Day_Click;
             viewOptionLayout.day.Dispose();
             viewOptionLayout.day = null;
         }
         if (viewOptionLayout.week != null)
         {
             viewOptionLayout.week.Click -= Week_Click;
             viewOptionLayout.week.Dispose();
             viewOptionLayout.week = null;
         }
         if (viewOptionLayout.workweek != null)
         {
             viewOptionLayout.workweek.Click -= Workweek_Click;
             viewOptionLayout.workweek.Dispose();
             viewOptionLayout.workweek = null;
         }
         if (viewOptionLayout.month != null)
         {
             viewOptionLayout.month.Click -= Month_Click;
             viewOptionLayout.month.Dispose();
             viewOptionLayout = null;
         }
     }
     if (minTimeSubjectCollection != null)
     {
         minTimeSubjectCollection.Clear();
         minTimeSubjectCollection = null;
     }
     if (minStartTimeCollection != null)
     {
         minStartTimeCollection.Clear();
         minStartTimeCollection = null;
     }
     base.Destroy();
 }
Пример #3
0
        public void Dispose()
        {
            if (sfSchedule != null)
            {
                sfSchedule.CellTapped          -= SfSchedule_CellTapped;
                sfSchedule.CellDoubleTapped    -= SfSchedule_DoubleTapped;
                sfSchedule.VisibleDatesChanged -= SfSchedule_VisibleDatesChanged;
                sfSchedule.Dispose();
                sfSchedule = null;
            }

            if (mainLayout != null)
            {
                mainLayout.Dispose();
                mainLayout = null;
            }

            if (propertylayout != null)
            {
                propertylayout.Dispose();
                propertylayout = null;
            }

            if (linearLayout != null)
            {
                linearLayout.Dispose();
                linearLayout = null;
            }

            if (editor != null)
            {
                if (editor.SaveButton != null)
                {
                    editor.SaveButton.Click -= SaveButton_Click;
                    editor.SaveButton.Dispose();
                    editor.SaveButton = null;
                }

                if (editor.CancelButton != null)
                {
                    editor.CancelButton.Click -= CancelButton_Click;
                    editor.CancelButton.Dispose();
                    editor.CancelButton = null;
                }

                editor.Dispose();
                editor = null;
            }

            if (scheduleCustomHeader != null)
            {
                if (scheduleCustomHeader.ScheduleCalendar != null)
                {
                    scheduleCustomHeader.ScheduleCalendar.Click -= ScheduleCalendar_Click;
                    scheduleCustomHeader.ScheduleCalendar.Dispose();
                    scheduleCustomHeader.ScheduleCalendar = null;
                }

                if (scheduleCustomHeader.SchedulePlus != null)
                {
                    scheduleCustomHeader.SchedulePlus.Click -= EditorLayout_Click;
                    scheduleCustomHeader.SchedulePlus.Dispose();
                    scheduleCustomHeader.SchedulePlus = null;
                }

                if (scheduleCustomHeader.ScheduleOption != null)
                {
                    scheduleCustomHeader.ScheduleOption.Click -= ScheduleOption_Click;
                    scheduleCustomHeader.ScheduleOption.Dispose();
                    scheduleCustomHeader.ScheduleOption = null;
                }

                scheduleCustomHeader.Dispose();
                scheduleCustomHeader = null;
            }

            if (viewOptionLayout != null)
            {
                if (viewOptionLayout.Day != null)
                {
                    viewOptionLayout.Day.Click -= Day_Click;
                    viewOptionLayout.Day.Dispose();
                    viewOptionLayout.Day = null;
                }

                if (viewOptionLayout.Week != null)
                {
                    viewOptionLayout.Week.Click -= Week_Click;
                    viewOptionLayout.Week.Dispose();
                    viewOptionLayout.Week = null;
                }

                if (viewOptionLayout.Workweek != null)
                {
                    viewOptionLayout.Workweek.Click -= Workweek_Click;
                    viewOptionLayout.Workweek.Dispose();
                    viewOptionLayout.Workweek = null;
                }

                if (viewOptionLayout.Month != null)
                {
                    viewOptionLayout.Month.Click -= Month_Click;
                    viewOptionLayout.Month.Dispose();
                    viewOptionLayout.Month = null;
                }

                viewOptionLayout.Dispose();
                viewOptionLayout = null;
            }

            if (minTimeSubjectCollection != null)
            {
                minTimeSubjectCollection.Clear();
                minTimeSubjectCollection = null;
            }

            if (minStartTimeCollection != null)
            {
                minStartTimeCollection.Clear();
                minStartTimeCollection = null;
            }
        }