2012-11-26 2 views
2

devExpress scheduler control을 사용하고 있습니다. 다음 코드에서 달성하려는 내용은 코드의 약속에 재주문을 추가하는 것입니다. 이 예에서는 새로운 약속을 만들 때이를 수행합니다.코드 숨김에 대한 약속에 대한 재발 적용 (DevExpress Scheduler Control)

<Window x:Class="WpfApplication1.MainWindow" 
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
     Title="MainWindow" Height="350" Width="525" 
     xmlns:dxsch="http://schemas.devexpress.com/winfx/2008/xaml/scheduler"> 

    <dxsch:SchedulerControl Name="schedulerControl1" /> 

</Window> 

을 그리고 코드 뒤에 구성 :

내 창은 스케줄러 컨트롤로 구성되어 내가 컨트롤의 재발 속성을 바인딩하지 않으

using System.Windows; 
using DevExpress.XtraScheduler; 

namespace WpfApplication1 
{ 
    public partial class MainWindow : Window 
    { 
     public MainWindow() // Constructor 
     { 
      InitializeComponent(); 
      this.Loaded += new RoutedEventHandler(MainWindow_Loaded); 
     } 

     void MainWindow_Loaded(object sender, RoutedEventArgs e) // Fires when window loads 
     { 
      schedulerControl1.Storage.AppointmentsInserted += new PersistentObjectsEventHandler(Storage_AppointmentsInserted); 
     } 

     void Storage_AppointmentsInserted(object sender, PersistentObjectsEventArgs e) // fires when a new appointment is added 
     { 
      Appointment addedAppointment = null; 
      foreach (Appointment item in e.Objects) 
       addedAppointment = item; 

      /* 
       I want to set the reinsurance info in here! 
       I cant because RecuranceInfo = null!     
      */ 
      addedAppointment.RecurrenceInfo.Type = RecurrenceType.Hourly; // <- App Crashes 
     }    
    } 
} 

.

다른 말로하면 오늘 오후 2시에 시작하는 약속을 만들 수 있으며 종료일없이 매일 반복 할 수 있습니다. 코드에서 그 약속을 어떻게 만들 수 있습니까?

답변

1

대답이 링크에 있습니다

 Appointment apt = schedulerControl1.Storage.CreateAppointment(AppointmentType.Pattern); 
     apt.Start = DateTime.Now; 
     apt.End = apt.Start.AddHours(2); 
     apt.Subject = "My Subject"; 
     apt.Location = "My Location"; 
     apt.Description = "My Description"; 

     apt.RecurrenceInfo.Type = RecurrenceType.Daily; 

     schedulerControl1.Storage.AppointmentStorage.Add(apt); 
:

http://documentation.devexpress.com/#WindowsForms/CustomDocument6201 기본적으로 내가해야 할 일을했을

관련 문제