Sfoglia il codice sorgente

Fix to default settings of combo boxes

Kenric Nugteren 2 settimane fa
parent
commit
80e85e0159

+ 3 - 3
prs.desktop/Components/Calendar/Calendar.xaml

@@ -280,7 +280,7 @@
                     x:Name="AssignmentTypeSelector" 
                     Grid.Row="4" 
                     Grid.Column="1"
-                    SelectedIndex="0" 
+                    SelectedIndex="1" 
                     Margin="5,5,0,0"
                     SelectionChanged="AssignmentTypeSelector_OnSelectionChanged"
                     VerticalContentAlignment="Center">
@@ -300,7 +300,7 @@
                     x:Name="BackgroundTypeSelector" 
                     Grid.Row="5" 
                     Grid.Column="1"
-                    SelectedIndex="0" 
+                    SelectedIndex="1" 
                     Margin="5,5,0,0"
                     SelectionChanged="BackgroundTypeSelector_OnSelectionChanged"
                     VerticalContentAlignment="Center">
@@ -320,7 +320,7 @@
                     x:Name="IntervalSelector" 
                     Grid.Row="6" 
                     Grid.Column="1"
-                    SelectedIndex="0" 
+                    SelectedIndex="3" 
                     Margin="5,5,0,0"
                     SelectionChanged="IntervalSelector_OnSelectionChanged"
                     VerticalContentAlignment="Center">

+ 1 - 38
prs.desktop/Components/Calendar/Calendar.xaml.cs

@@ -625,6 +625,7 @@ namespace PRSDesktop
                 EndHour = 24;
             }
 
+            CalendarControl.RowInterval = TimeIntervalToTimeSpan(TimeInterval);
             CalendarViewSelector.ItemsSource = new List<KeyValuePair<CalendarViewType, string>>
             {
                 new(CalendarViewType.Day, "Day"),
@@ -874,44 +875,6 @@ namespace PRSDesktop
             return _assignments.Where(a => (a.EmployeeLink.ID == employeeid) && (a.Date == date)).ToArray();
         }
         
-        // public void UpdateAssignment(Assignment assignment)
-        // {
-        //     
-        //     void UpdateCalendar<TEntity, TModel>(
-        //         TEntity entity, 
-        //         List<TModel> collection,
-        //         Action<TModel> refresh
-        //     ) where TEntity : Entity where TModel : class, IModel
-        //     {
-        //         
-        //         if (Calendar.ItemsSource is CalendarAppointments appointments)
-        //         {
-        //             var appointment = appointments.FirstOrDefault(x => (Guid)x.Id == entity.ID) as ScheduleAppointment;
-        //             if (appointment != null)
-        //             {
-        //                 appointments.Remove(appointment);
-        //                 var calappt = appointment as ICalendarAppointment<TModel>;
-        //                 if (calappt != null)
-        //                     collection.Remove(calappt.Model);
-        //             }
-
-        //             var table = new CoreTable();
-        //             table.LoadColumns(typeof(TEntity));
-        //             var row = table.NewRow();
-        //             table.FillRow(row, entity);
-        //             var model = (Activator.CreateInstance(typeof(TModel),row) as TModel)!;
-        //             collection.Add(model);
-        //             refresh(model);
-
-        //         }
-
-        //     }
-        //     
-        //     if (Calendar.ItemsSource is CalendarAppointments appointments)
-        //         UpdateCalendar(assignment, _assignments, (model) => LoadAssignment(model, appointments));
-        //     
-        // }
-        
         private void LoadBackground()
         {
             var regions = new ObservableCollection<CalendarRegion>();