Jelajahi Sumber

Fixed tab control selection double glitch.
Added EstimatedTime to TasksByStatus

Kenric Nugteren 1 tahun lalu
induk
melakukan
01b1297c8b

+ 1 - 1
prs.desktop/Panels/Tasks/TasksByStatusControl.xaml

@@ -25,7 +25,7 @@
                         Executed="SelectTask_Executed"
                         CanExecute="CommandBinding_CanExecute"/>
     </UserControl.CommandBindings>
-    <Grid>
+    <Grid x:Name="LayoutRoot">
         <Grid.ColumnDefinitions>
             <ColumnDefinition Width="Auto" x:Name="EmployeeListColumn" />
             <ColumnDefinition Width="*" />

+ 7 - 6
prs.desktop/Panels/Tasks/TasksByStatusControl.xaml.cs

@@ -730,9 +730,9 @@ public partial class TasksByStatusControl : UserControl, ITaskControl, INotifyPr
 
     #region Refresh
 
-    private static Columns<IKanban> GetKanbanColumns()
+    private static Columns<Kanban> GetKanbanColumns()
     {
-        return new Columns<IKanban>(
+        return new Columns<Kanban>(
             x => x.ID,
             x => x.DueDate,
             x => x.Completed,
@@ -749,6 +749,7 @@ public partial class TasksByStatusControl : UserControl, ITaskControl, INotifyPr
             x => x.Type.Code,
             x => x.Number,
             x => x.Attachments,
+            x => x.EstimatedTime,
             x => x.Locked);
     }
 
@@ -756,7 +757,7 @@ public partial class TasksByStatusControl : UserControl, ITaskControl, INotifyPr
     {
         using var cursor = new WaitCursor();
 
-        IEnumerable<IKanban> kanbans;
+        IEnumerable<Kanban> kanbans;
         if (SelectedEmployee.ID != CoreUtils.FullGuid && SelectedEmployee.ID != Guid.Empty)
         {
             kanbans = Client.Query(
@@ -777,7 +778,7 @@ public partial class TasksByStatusControl : UserControl, ITaskControl, INotifyPr
         AllTasks = CreateModels(kanbans).ToList();
         FilterKanbans();
     }
-    private IEnumerable<TaskModel> CreateModels(IEnumerable<IKanban> kanbans)
+    private IEnumerable<TaskModel> CreateModels(IEnumerable<Kanban> kanbans)
     {
         foreach(var kanban in kanbans)
         {
@@ -811,6 +812,7 @@ public partial class TasksByStatusControl : UserControl, ITaskControl, INotifyPr
                 model.DueDate = kanban.DueDate;
                 model.CompletedDate = kanban.Completed;
                 model.Locked = kanban.Locked;
+                model.EstimatedTime = kanban.EstimatedTime;
 
                 var notes = new List<List<string>> { new() };
                 if (kanban.Notes is not null)
@@ -911,7 +913,6 @@ public partial class TasksByStatusControl : UserControl, ITaskControl, INotifyPr
     /// </summary>
     private void FilterKanbans()
     {
-        Progress.Show("Loading");
         IEnumerable<TaskModel> filtered;
         if (JobFilterID == Guid.Empty)
         {
@@ -948,6 +949,7 @@ public partial class TasksByStatusControl : UserControl, ITaskControl, INotifyPr
         {
             column.Tasks.Clear();
         }
+
         foreach (var task in filtered)
         {
             var column = GetColumn(task.Category);
@@ -957,7 +959,6 @@ public partial class TasksByStatusControl : UserControl, ITaskControl, INotifyPr
                 SelectedTasks.Add(task);
             }
         }
-        Progress.Close();
     }
 
     #endregion

+ 5 - 3
prs.desktop/Panels/Tasks/TasksByUserControl.xaml

@@ -8,6 +8,7 @@
              xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
              xmlns:kanban="clr-namespace:Syncfusion.UI.Xaml.Kanban;assembly=Syncfusion.SfKanban.WPF"
              xmlns:local="clr-namespace:PRSDesktop"
+             d:DataContext="{d:DesignInstance Type=local:TasksByStatusControl}"
              mc:Ignorable="d"
              x:Name="Control"
              d:DesignHeight="450" d:DesignWidth="800">
@@ -30,7 +31,8 @@
                         CanExecute="CommandBinding_CanExecute"/>
     </UserControl.CommandBindings>
     <dynamicgrid:DynamicSplitPanel x:Name="SplitPanel" View="Combined" AnchorWidth="100" AllowableViews="Combined"
-                                   OnChanged="SplitPanel_OnChanged">
+                                   OnChanged="SplitPanel_OnChanged"
+                                   DataContext="{Binding ElementName=Control}">
 
         <dynamicgrid:DynamicSplitPanel.Master>
 
@@ -155,7 +157,7 @@
                     </DockPanel>
                 </Border>
 
-                <ItemsControl Grid.Row="1" ItemsSource="{Binding ElementName=Control,Path=Model.SectionHeaders}">
+                <ItemsControl Grid.Row="1" ItemsSource="{Binding Model.SectionHeaders}">
                     <ItemsControl.ItemsPanel>
                         <ItemsPanelTemplate>
                             <UniformGrid Rows="1"/>
@@ -195,7 +197,7 @@
                     </ItemsControl.ItemTemplate>
                 </ItemsControl>
                 <ScrollViewer Grid.Row="2">
-                    <ItemsControl ItemsSource="{Binding ElementName=Control,Path=Model.Categories}">
+                    <ItemsControl ItemsSource="{Binding Path=Model.Categories}">
                         <ItemsControl.ItemTemplate>
                             <DataTemplate DataType="local:TasksByUserCategory">
                                 <Grid>

+ 6 - 0
prs.desktop/Panels/Tasks/TasksByUserControl.xaml.cs

@@ -11,6 +11,7 @@ using System.Windows.Controls;
 using System.Windows.Data;
 using System.Windows.Input;
 using System.Windows.Media.Imaging;
+using AvalonDock.Layout;
 using Comal.Classes;
 using InABox.Clients;
 using InABox.Core;
@@ -287,6 +288,8 @@ public partial class TasksByUserControl : UserControl, INotifyPropertyChanged, I
 
     private void TaskType_SelectionChanged(object sender, SelectionChangedEventArgs e)
     {
+        if (!IsReady)
+            return;
         FilterKanbans();
     }
 
@@ -803,6 +806,9 @@ public partial class TasksByUserControl : UserControl, INotifyPropertyChanged, I
 
     private void ViewType_SelectionChanged(object sender, SelectionChangedEventArgs e)
     {
+        if (!IsReady)
+            return;
+
         Mode = ViewType.SelectedIndex switch
         {
             0 => KanbanViewMode.Full,