Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic How to delete item ? (Read 1103 times)
Mandy
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 47
Joined: Jun 3rd, 2020
How to delete item ?
Oct 26th, 2023 at 10:27am
Print Post  
Hi ,

I tried to remove the item in the editing window, but the item was not deleted.

What should I do?

Code
Select All
private void Create_Click(object sender, RoutedEventArgs e)
        {
            var item = new Appointment();
            item.Subject = "aaa";
            item.StartTime = new DateTime(2023, 10, 2);
            item.EndTime = new DateTime(2023, 10, 3);
            calendar.Schedule.Items.Add(item);
            appointment_id = item.Id;
            item.Recurrence = new Recurrence()
            {
                Pattern = RecurrencePattern.Weekly,
                DaysOfWeek = DaysOfWeek.Monday,
                StartDate = item.StartTime,
                DailyRecurrence = DailyRecurrence.ByDayInterval,
                NumOccurrences = 3,
                RecurrenceEnd = RecurrenceEnd.NumOccurrences,
            };
			item.Reminder = new Reminder()
			{
				Type = ReminderType.Leading,
				TimeInterval = TimeSpan.FromMinutes(15)
			};


            // Edit the clicked item
            var edititem = item.Recurrence.GetOccurrence(1);
            var editWindow = new EditWindow(calendar.Schedule);
            editWindow.SetAppointment(edititem);
            editWindow.Activate();
            editWindow.Show();
        }
 



Code
Select All
public partial class EditWindow : Window
    {
        MindFusion.Scheduling.Schedule schedule { get; set; }
        MindFusion.Scheduling.Item item { get; set; }

        public EditWindow(MindFusion.Scheduling.Schedule schedule)
        {
            InitializeComponent();

            this.schedule = schedule;
        }

        public void SetAppointment(Item item)
        {
            this.item = item;
        }

        private void Remove_Click(object sender, RoutedEventArgs e)
        {
            this.schedule.Items.Remove(this.item);

            //Dispatcher.InvokeAsync(() =>
            //{
            //
            //});
            this.Close();
        }
 

  
Back to top
 
IP Logged
 
Slavcho
God Member
*****
Offline


tech.support

Posts: 3253
Joined: Oct 19th, 2005
Re: How to delete item ?
Reply #1 - Oct 26th, 2023 at 3:38pm
Print Post  
Hi Mandy,

For recurrence instances you'll need to call recurrence.MarkException(item, true) instead of Items.Remove.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint