Exemplo n.º 1
0
 internal override void AttachScheduler(C1Schedule owner)
 {
     base.AttachScheduler(owner);
     _start = owner.CalendarInfo.FirstDate;
     _end   = owner.CalendarInfo.LastDate;
     OnAppointmentsLoaded();
 }
Exemplo n.º 2
0
 internal virtual void AttachScheduler(C1Schedule owner)
 {
     _schedule = owner;
     _schedule.AppointmentAdded   += _schedule_AppointmentAdded;
     _schedule.AppointmentDeleted += _schedule_AppointmentDeleted;
     _schedule.AppointmentChanged += _schedule_AppointmentChanged;
     _schedule.AppointmentsLoaded += _schedule_AppointmentsLoaded;
 }
Exemplo n.º 3
0
        public override void ZoomBounds(Control control, ZoomBoundsInfo infos)
        {
            base.ZoomBounds(control, infos);
            C1Schedule schedule = control as C1Schedule;

            if (schedule.AppointmentHeight > 0)
            {
                schedule.AppointmentHeight = infos.Zoom(schedule.AppointmentHeight);
            }
            control.Refresh();
        }
Exemplo n.º 4
0
 internal virtual void DetachScheduler()
 {
     if (_schedule != null)
     {
         _schedule.AppointmentAdded   -= _schedule_AppointmentAdded;
         _schedule.AppointmentDeleted -= _schedule_AppointmentDeleted;
         _schedule.AppointmentChanged -= _schedule_AppointmentChanged;
         _schedule.AppointmentsLoaded -= _schedule_AppointmentsLoaded;
     }
     _schedule = null;
 }
Exemplo n.º 5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AppointmentForm"/> form.
        /// </summary>
        /// <param name="scheduler">Reference to the owning <see cref="C1Schedule"/> control.</param>
        /// <param name="appointment">The <see cref="Appointment"/> object for editing.</param>
        public AppointmentForm(C1Schedule scheduler, Appointment appointment)
        {
            _scheduler  = scheduler;
            Appointment = appointment;
            // work with appointment copy, so that don't change initial appointment
            // until end-user saves the changes
            _appEdited = appointment.Copy();
            _appEdited.BeginEdit();
            _defaultStart    = appointment.AllDayEvent ? _scheduler.CalendarInfo.StartDayTime : appointment.Start.TimeOfDay;
            _defaultDuration = appointment.AllDayEvent ? _scheduler.CalendarInfo.TimeScale : appointment.Duration;

            InitializeComponent();
            Initialize();
        }
Exemplo n.º 6
0
        //------------------------------------------------------------------------------------------
        #region ** ctor

        /// <summary>
        /// Initializes a new instance of the <see cref="ExerciseForm"/> form
        /// for editing of the specified <see cref="Appointment"/> object.
        /// </summary>
        /// <param name="schedule">The owning <see cref="C1Schedule"/> component.</param>
        /// <param name="appointment">The <see cref="Appointment"/> object.</param>
        public ExerciseForm(C1Schedule schedule, Appointment appointment)
        {
            // initialize private fields
            _schedule    = schedule;
            _appointment = appointment;

            // call BeginEdit in order to not refresh UI at changing properties of Appointment
            _appointment.BeginEdit();

            Font = SystemInformation.MenuFont;
            InitializeComponent();

            // initialize form controls
            Initialize();
        }
Exemplo n.º 7
0
 public CommonAppointmentMapping(BindingList <CommonResource> resources, C1Schedule owner)
     : base()
 {
     TaskResources                     = Add(typeof(Appointment), typeof(string), null, false, "");
     TaskResources.MappingName         = "Resources";
     Subject.MappingName               = "Name";
     Body.MappingName                  = "Notes";
     End.MappingName                   = "End";
     Location.MappingName              = "Location";
     AppointmentProperties.MappingName = "Properties";
     Start.MappingName                 = "Begin";
     _resources = resources;
     _owner     = owner;
     Collection = owner.DataStorage.AppointmentStorage.Appointments;
 }
Exemplo n.º 8
0
 public C1ScheduleOptions(
     C1Schedule schedule)
 {
     _schedule = schedule;
 }
Exemplo n.º 9
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            // create in-memory scheduler control for printing
            sched = new C1Schedule();
            sched.ShowReminderForm = false;
            // copy theme information
            sched.Theme.XmlDefinition = c1Schedule1.Theme.XmlDefinition;
            // copy time scale information
            sched.CalendarInfo.TimeScale = c1Schedule1.CalendarInfo.TimeScale;
            // copy week start
            sched.CalendarInfo.WeekStart = c1Schedule1.CalendarInfo.WeekStart;

            // copy view information
            sched.ViewType = c1Schedule1.ViewType;

            // customize theme for better print contrast
            // sched.Theme["DayViewDayName"].Format = "g";
            //sched.Theme["TimeRuler"].ForeColor = Color.Black;
            //sched.Theme["TimeRuler"].BorderColor = Color.Black;
            //sched.Theme["TimeRuler"].BackBrush = new SolidBrush(Color.White);

            // don't highlight day status for better contrast
            sched.Theme.HighlightDayStatus = false;

            // It's possible to change other appearance settings for printing version
            // To do so:
            // - create custom visual style in the smart designer;
            // - edit appearance of this visual style;
            // - save visual style to file;
            // - load saved xml definition into sched.Theme.XmlDefinition property.
            sched.Theme.ShowNavigationPanels = false;

            // hide title
            sched.ShowTitle = false;
            // hide free time

            using (MemoryStream stream = new MemoryStream())
            {
                // copy appointments from the displayed Scheduler
                c1Schedule1.DataStorage.Export(stream, FileFormatEnum.XML);
                stream.Position = 0;
                sched.DataStorage.Import(stream, FileFormatEnum.XML);
            }
            if (c1Schedule1.ViewType == ScheduleViewEnum.TimeLineView)
            {
                sched.Height = 800;
                sched.Width  = 1200;
            }
            else
            {
                // set large enough height, so that all day is visible without scrolling
                sched.Height = 1200;
                // use the same width as in displayed scheduler
                sched.Width = c1Schedule1.Width;
            }

            // end C1Schedule initialization
            ((ISupportInitialize)sched).EndInit();

            // set initial date range
            printRangeDialog1.StartDate = c1Schedule1.SelectedDates[0];
            if (c1Schedule1.SelectedDates.Length > 1)
            {
                printRangeDialog1.EndDate = c1Schedule1.SelectedDates[c1Schedule1.SelectedDates.Length - 1];
            }
            else
            {
                printRangeDialog1.EndDate = c1Schedule1.SelectedDates[0];
            }

            // show date range dialog
            if (printRangeDialog1.ShowDialog() == DialogResult.OK)
            {
                // go to desired date

                DateTime[] dates = printRangeDialog1.GetDateRange();
                sched.ShowDates(dates);
                // adjust intervals to don't hurt performance and get correct view for Month view
                sched.CalendarInfo.FirstDate = dates[0];
                sched.CalendarInfo.LastDate  = dates[dates.Length - 1];

                // initialize printing
                printPreviewDialog1.Document = printDocument1;
                printDocument1.DefaultPageSettings.Landscape = c1Schedule1.ViewType == ScheduleViewEnum.TimeLineView;
                printDocument1.PrintPage += new PrintPageEventHandler(printDocument1_PrintPage);
                // show print preview
                printPreviewDialog1.ShowDialog();
                printDocument1.PrintPage -= new PrintPageEventHandler(printDocument1_PrintPage);
            }
        }
Exemplo n.º 10
0
 internal override void AttachScheduler(C1Schedule owner)
 {
     base.AttachScheduler(owner);
     _days = new DayCollection(owner.CalendarInfo);
     RefreshView();
 }