From b21d7249a2d0a7d8de4161ec30b0022832e170c4 Mon Sep 17 00:00:00 2001 From: Christian Date: Thu, 18 Jun 2026 16:17:39 +0200 Subject: [PATCH] =?UTF-8?q?Erg=C3=A4nzung=20zum=20Bugfix=20Cannot=20access?= =?UTF-8?q?=20the=20'CustomFields'=20property=20of=20a=20disposed=20object?= =?UTF-8?q?,=20wenn=20Termin=20im=20Kalender=20aus=20dem=20Startbildschirm?= =?UTF-8?q?=20ge=C3=B6ffnet=20werden=20SupportOID=3D165420?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BeWo/Scheduler/View/NewSchedulerView.xaml.cs | 107 ++++++++++--------- BeWo/View/Master/SchedulerMasterView.xaml.cs | 2 +- 2 files changed, 55 insertions(+), 54 deletions(-) diff --git a/BeWo/Scheduler/View/NewSchedulerView.xaml.cs b/BeWo/Scheduler/View/NewSchedulerView.xaml.cs index fa1977274..167ff8fc3 100644 --- a/BeWo/Scheduler/View/NewSchedulerView.xaml.cs +++ b/BeWo/Scheduler/View/NewSchedulerView.xaml.cs @@ -56,8 +56,6 @@ namespace BeWo.Scheduler.View private bool _IsEmployeeBrushVisible; - Appointment appointmentToOpenFormHomePanel = null; - public bool IsEmployeeBrushVisible { get => _IsEmployeeBrushVisible; @@ -422,13 +420,11 @@ namespace BeWo.Scheduler.View private DateTime? _SelectedAppointmentStartDate; - private readonly SchedulerAppointmentDC _SelectedAppointmentFromHomePanelView; - private bool _IsComingFromHomeDragPanel; - + private SchedulerAppointmentDC _SelectedAppointmentFromHomePanelView; + public NewSchedulerView(DateTime pIntervalStartDate, SchedulerAppointmentDC pAppointment) { - _IsComingFromHomeDragPanel = true; - + _SelectedAppointmentFromHomePanelView = pAppointment; _SelectedAppointmentStartDate = pIntervalStartDate; @@ -503,11 +499,14 @@ namespace BeWo.Scheduler.View if(_IstErsterAufruf) { - if(MainControl.HatNeueTermine && !_IsComingFromHomeDragPanel) + if(MainControl.HatNeueTermine && _SelectedAppointmentFromHomePanelView == null) { FensterOeffnen(); } - + else + { + OpenAppointmentFromHomePanel(); + } _IstErsterAufruf = false; } }); @@ -515,7 +514,7 @@ namespace BeWo.Scheduler.View private void InitScheduler() { - if(_IsComingFromHomeDragPanel && _SelectedAppointmentStartDate.HasValue) + if(_SelectedAppointmentFromHomePanelView != null && _SelectedAppointmentStartDate.HasValue) { var monday = _SelectedAppointmentStartDate.Value.FirstDateOfWeek(_SelectedAppointmentStartDate.Value.GetIso8601WeekOfYear()); @@ -533,7 +532,7 @@ namespace BeWo.Scheduler.View Scheduler.DayView.AppointmentDisplayOptions.ShowReminder = true; Scheduler.DayView.ResourcesPerPage = 1; - Scheduler.WorkWeekView.ShowFullWeek = _IsComingFromHomeDragPanel && Scheduler.Start.DayOfWeek.Equals(DayOfWeek.Saturday) || Scheduler.Start.DayOfWeek.Equals(DayOfWeek.Sunday); + Scheduler.WorkWeekView.ShowFullWeek = _SelectedAppointmentFromHomePanelView != null && (Scheduler.Start.DayOfWeek.Equals(DayOfWeek.Saturday) || Scheduler.Start.DayOfWeek.Equals(DayOfWeek.Sunday)); Scheduler.WorkWeekView.ShowWorkTimeOnly = false; Scheduler.WorkWeekView.NavigationButtonVisibility = NavigationButtonVisibility.Always; @@ -2227,6 +2226,8 @@ namespace BeWo.Scheduler.View //vm.Appointments.AddRange(ViewModel.ConvertAbsenceTimesToAppointments(employeeAbsenceTimes.Where(w => { return SelectedEmployees.Count == 0 || SelectedEmployees.Any(a => a.EmployeeOid == w.EmployeeOid); }), end, e, c)); } + Debug.WriteLine("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); + ViewModel.ActiveAppointmentViewModel = vm; ViewModel.SchedulerSettings = ViewModel.GetActiveSettings(); @@ -2253,41 +2254,6 @@ namespace BeWo.Scheduler.View Scheduler.Storage.RefreshData(); Scheduler.Storage.RefreshUI(); - if(_IsComingFromHomeDragPanel && _SelectedAppointmentFromHomePanelView != null) - { - var apps = Scheduler.ActiveView.GetAppointments().ToList(); - - var oid = _SelectedAppointmentFromHomePanelView.SchedulerAppointmentOid; - //Appointment appointmentToOpen; - - if(oid != null) - { - appointmentToOpenFormHomePanel = apps.FirstOrDefault(app => - { - var oidValue = app.CF_SchedulerAppointmentOid(); - - return oidValue.HasValue && oidValue.Value == oid; - }); - - - //if(appointmentToOpenFormHomePanel != null) - //{ - // Scheduler.ShowEditAppointmentForm(appointmentToOpenFormHomePanel); - //} - } - else if(_SelectedAppointmentFromHomePanelView.RecurrenceId != null && _SelectedAppointmentFromHomePanelView.RecurrenceIndex > 0) - { - appointmentToOpenFormHomePanel = apps.FirstOrDefault(appointment => appointment.RecurrenceInfo.Id.ToString().Equals(_SelectedAppointmentFromHomePanelView.RecurrenceId)); - - //if(appointmentToOpenFormHomePanel != null) - //{ - // Scheduler.ShowEditAppointmentForm(appointmentToOpenFormHomePanel); - //} - } - - _IsComingFromHomeDragPanel = false; - } - callback?.Invoke(); }); }); @@ -2303,16 +2269,51 @@ namespace BeWo.Scheduler.View } public void OpenAppointmentFromHomePanel() { - while (_IsComingFromHomeDragPanel) + if (_SelectedAppointmentFromHomePanelView != null) { - Thread.Sleep(100); - } - if (appointmentToOpenFormHomePanel != null) - { - Scheduler.ShowEditAppointmentForm(appointmentToOpenFormHomePanel); + var apps = Scheduler.ActiveView.GetAppointments().ToList(); - appointmentToOpenFormHomePanel = null; + var oid = _SelectedAppointmentFromHomePanelView.SchedulerAppointmentOid; + Appointment appointmentToOpen = null; + + if (oid != null) + { + appointmentToOpen = apps.FirstOrDefault(app => + { + var oidValue = app.CF_SchedulerAppointmentOid(); + + return oidValue.HasValue && oidValue.Value == oid; + }); + + + //if(appointmentToOpenFormHomePanel != null) + //{ + // Scheduler.ShowEditAppointmentForm(appointmentToOpenFormHomePanel); + //} + } + else if (_SelectedAppointmentFromHomePanelView.RecurrenceId != null && _SelectedAppointmentFromHomePanelView.RecurrenceIndex > 0) + { + appointmentToOpen = apps.FirstOrDefault(appointment => appointment.RecurrenceInfo.Id.ToString().Equals(_SelectedAppointmentFromHomePanelView.RecurrenceId)); + + //if(appointmentToOpenFormHomePanel != null) + //{ + // Scheduler.ShowEditAppointmentForm(appointmentToOpenFormHomePanel); + //} + } + + if (appointmentToOpen != null) + { + Scheduler.ShowEditAppointmentForm(appointmentToOpen); + + } + _SelectedAppointmentFromHomePanelView = null; } + + //while (_IsComingFromHomeDragPanel) + //{ + //Thread.Sleep(100); + //} + } private void ExportButton_OnClick(object sender, RoutedEventArgs e) diff --git a/BeWo/View/Master/SchedulerMasterView.xaml.cs b/BeWo/View/Master/SchedulerMasterView.xaml.cs index 3e88e8be3..64339c18f 100644 --- a/BeWo/View/Master/SchedulerMasterView.xaml.cs +++ b/BeWo/View/Master/SchedulerMasterView.xaml.cs @@ -21,7 +21,7 @@ namespace BeWo.View.Master grid_root.Children.Add(scheduler); - scheduler.OpenAppointmentFromHomePanel(); + //scheduler.OpenAppointmentFromHomePanel(); } } } \ No newline at end of file