Ejemplo n.º 1
0
        protected override void OnSizeAllocated(double width, double height)
        {
            base.OnSizeAllocated(width, height);
            if (width != this.width || height != this.height)
            {
                this.width  = width;
                this.height = height;
                if (width > height)
                {
                    Debug.WriteLine("Horizontal");
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        /* Switching to Week View
                         *
                         * Current Bug on Week View: All Day Events show up as an extra day long.
                         * Should not be programmed to subtract a day in datetime because the overall standard
                         * is that all day events are from one day at 0:0:0 to the next day at 0:0:0.
                         *
                         * SyncFusion says this bug should be fixed in their update at the end of May 2018 so
                         * please update the NuGet package then.
                         *
                         * https://www.syncfusion.com/forums/137099/all-day-event-rendering-as-two-days-in-week-view
                         *
                         */

                        cal.ScheduleView       = ScheduleView.WeekView;
                        cal.TimeIntervalHeight = 50;
                        cal.ViewHeaderHeight   = 55;

                        //Creating new instance of WeekViewSettings
                        WeekViewSettings weekViewSettings = new WeekViewSettings();
                        //Creating new instance of WeekLabelSettings
                        WeekLabelSettings weekLabelSettings = new WeekLabelSettings();

                        //custom UI
                        weekLabelSettings.DateFormat       = "dd";
                        weekViewSettings.WeekLabelSettings = weekLabelSettings;
                        weekViewSettings.ShowAllDay        = true;
                        weekViewSettings.StartHour         = 05;
                        cal.WeekViewSettings = weekViewSettings;

                        ViewHeaderStyle viewHeaderStyle = new ViewHeaderStyle();
                        viewHeaderStyle.DateFontSize    = 15;
                        cal.ViewHeaderStyle             = viewHeaderStyle;
                    });
                }
                else
                {
                    Debug.WriteLine("Vertical");
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        cal.ScheduleView = ScheduleView.MonthView;
                    });
                }
            }
        }
Ejemplo n.º 2
0
        public override View GetSampleContent(Context context)
        {
            this.mContext = context;
            LinearLayout linearLayout = new LinearLayout(context);

            linearLayout.Orientation = Orientation.Vertical;
            //creating instance for Schedule
            sfSchedule = new SfSchedule(context);
            HeaderStyle headerStyle = new HeaderStyle();

            headerStyle.BackgroundColor = Color.Argb(255, 214, 214, 214);
            headerStyle.TextColor       = Color.Black;

            ViewHeaderStyle viewHeader = new ViewHeaderStyle();

            viewHeader.BackgroundColor = Color.Argb(255, 28, 28, 28);
            viewHeader.DayTextColor    = Color.Argb(255, 238, 199, 43);
            viewHeader.DateTextColor   = Color.Argb(255, 238, 199, 43);

            sfSchedule.HeaderStyle = headerStyle;
            //sfSchedule.ViewHeaderStyle = viewHeader;

            DayViewSettings dayViewSettings = new DayViewSettings();

            dayViewSettings.TimeSlotBorderStrokeWidth          = 2;
            dayViewSettings.VerticalLineStrokeWidth            = 0;
            dayViewSettings.VerticalLineColor                  = Color.Transparent;
            dayViewSettings.TimeSlotBorderColor                = Color.LightGray;
            dayViewSettings.NonWorkingHoursTimeSlotBorderColor = Color.LightGray;
            sfSchedule.DayViewSettings = dayViewSettings;

            Button button = new Button(context);

            button.Text = "+ New event";
            button.SetTextColor(Color.White);
            button.Gravity = GravityFlags.Left;
            button.SetBackgroundColor(Color.Rgb(0, 122, 255));
            button.Click            += Button_Click;
            sfSchedule.SelectionView = button;

            //set the appointment collection
            getAppointments();
            sfSchedule.Appointments          = appointmentCollection;
            sfSchedule.AppointmentViewLayout = ViewLayoutOptions.Overlay;
            sfSchedule.MonthCellLoaded      += SfSchedule_MonthCellLoaded;
            sfSchedule.LayoutParameters      = new FrameLayout.LayoutParams(
                LinearLayout.LayoutParams.MatchParent,
                LinearLayout.LayoutParams.MatchParent);
            sfSchedule.AppointmentLoaded += SfSchedule_AppointmentLoaded;
            sfSchedule.CellTapped        += sfSchedule_ScheduleTapped;
            linearLayout.AddView(sfSchedule);
            return(linearLayout);
        }
Ejemplo n.º 3
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);
        }