예제 #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 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;
            }
        }