Esempio n. 1
0
        public uc_Calendar()
        {
            InitializeComponent();
            _list = new AppointmentBOList();

            Language  = System.Windows.Markup.XmlLanguage.GetLanguage(System.Globalization.CultureInfo.CurrentCulture.Name);
            Unloaded += OnUnload;

            scheduler1.LayoutUpdated              += new EventHandler(scheduler1_LayoutUpdated);
            scheduler1.VisualIntervalScale         = TimeSpan.FromMinutes(30);
            scheduler1.CalendarHelper.StartDayTime = TimeSpan.Parse("09:00:00");
            scheduler1.Settings.FirstVisibleTime   = TimeSpan.Parse("09:00:00");

            scheduler1.CalendarHelper.EndDayTime = TimeSpan.Parse("18:00:00");

            scheduler1.BeginUpdate();
            scheduler1.Theme = C1SchedulerResources.Office2010Blue;
            scheduler1_LayoutUpdated(null, null);

            scheduler1.EndUpdate();
        }
Esempio n. 2
0
        private void EditAppointmentControl_Loaded(object sender, RoutedEventArgs e)
        {
            if (!_isLoaded)
            {
                _appointment = DataContext as Appointment;

                _defaultStart    = _appointment.AllDayEvent ? TimeSpan.FromHours(8) : _appointment.Start.TimeOfDay;
                _defaultDuration = _appointment.AllDayEvent ? TimeSpan.FromMinutes(30) : _appointment.Duration;
                if (!System.Windows.Interop.BrowserInteropHelper.IsBrowserHosted)
                {
                    _parentWindow = (ContentControl)VTreeHelper.GetParentOfType(this, typeof(Window));
                }
                else
                {
                    _parentWindow = (ContentControl)VTreeHelper.GetParentOfType(this, typeof(C1Window));
                }
                if (_parentWindow != null)
                {
                    Binding bnd = new Binding("Header");
                    bnd.Source = this;
                    if (_parentWindow is Window)
                    {
                        _parentWindow.SetBinding(Window.TitleProperty, bnd);
                    }
                    else
                    {
                        _parentWindow.SetBinding(C1Window.HeaderProperty, bnd);
                    }

                    if (_parentWindow is Window)
                    {
                        ((Window)_parentWindow).Closed += new EventHandler(_parentWindow_Closed);
                    }
                    else
                    {
                        ((C1Window)_parentWindow).Closed += new EventHandler(_parentWindow_Closed);
                    }
                }
                if (_appointment != null)
                {
                    ((System.ComponentModel.INotifyPropertyChanged)_appointment).PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(appointment_PropertyChanged);
                    if (_appointment.ParentCollection != null)
                    {
                        _scheduler = ((C1ScheduleStorage)_appointment.ParentCollection.ParentStorage.ScheduleStorage).Scheduler;

                        AppointmentBOList _os = (AppointmentBOList)_scheduler.DataStorage.AppointmentStorage.List;
                        var _list             = _os.Where(w => w.Id.Equals(_appointment.Key[0])).ToList();

                        foreach (AppointmentBusinessObject _item in _list)
                        {
                            _hidid.Text = _item.BOProperty1.ToString();
                        }

                        if (_appointment.AllDayEvent)
                        {
                            _defaultStart    = _scheduler.CalendarHelper.StartDayTime;
                            _defaultDuration = _scheduler.CalendarHelper.Info.TimeScale;
                        }
                    }
                    UpdateWindowHeader();
                    UpdateRecurrenceState();
                    UpdateCollections();
                    UpdateEndCalendar();
                    if (_appointment.AllDayEvent)
                    {
                        startCalendar.EditMode = endCalendar.EditMode = C1DateTimePickerEditMode.Date;
                    }
                    else
                    {
                        startCalendar.EditMode = endCalendar.EditMode = C1DateTimePickerEditMode.DateTime;
                    }
                    UpdateEditingControls();
                }
                if (_parentWindow != null && _appointment != null)
                {
                    _isLoaded = true;
                }
            }
            subject.Focus();
        }