From 77e7aacab36b0d7862f7ca6ac6201cbead2921e3 Mon Sep 17 00:00:00 2001 From: Stefan Kert Date: Sun, 7 Apr 2019 21:56:21 +0200 Subject: [PATCH] Smaller cleanups and fixes to sorting --- src/BuildVision.UI/BuildVision.UI.csproj | 4 -- .../Components/ControlView.xaml | 2 - .../Components/ControlView.xaml.cs | 40 +---------- .../Components/ProjectGrid.xaml | 69 ++++++------------- .../Components/ProjectGrid.xaml.cs | 52 +++++++------- .../Components/UserControl_ForTesting.xaml | 38 ---------- .../Enums/BuildExtraMessageFormat.cs | 4 +- .../Enums/BuildMajorMessageFormat.cs | 2 +- .../NavigateToBuildFailureReasonCondition.cs | 2 +- src/BuildVision.UI/Enums/SortOrder.cs | 5 +- src/BuildVision.UI/Enums/WindowState.cs | 5 +- .../Extensions/BindingExtensions.cs | 1 - .../Extensions/DataGridColumnExtensions.cs | 2 +- .../Extensions/EnumerationExtension.cs | 4 +- .../Extensions/ProjectStateExtensions.cs | 4 +- .../Extensions/VectorResources.cs | 6 +- src/BuildVision.UI/Extensions/VisualHelper.cs | 2 +- src/BuildVision.UI/Helpers/BindingProxy.cs | 4 +- .../Helpers/BuildMessagesFactory.cs | 16 ++--- src/BuildVision.UI/Helpers/EnumExtensions.cs | 4 +- .../Helpers/ProjectItemColumnSorter.cs | 4 +- src/BuildVision.UI/Helpers/StyleConverting.cs | 6 +- .../Settings/Models/BaseGridColumnSettings.cs | 3 +- .../Settings/Models/BuildMessagesSettings.cs | 2 +- .../Settings/Models/BuildProgressSettings.cs | 1 - .../Settings/Models/ControlSettings.cs | 2 +- .../Settings/Models/GeneralSettings.cs | 2 +- .../Settings/Models/GridColumnSettings.cs | 2 +- .../Settings/Models/GridSettings.cs | 2 +- .../Settings/Models/WindowSettings.cs | 2 +- .../ViewModels/BuildVisionPaneViewModel.cs | 18 ++--- 31 files changed, 93 insertions(+), 217 deletions(-) delete mode 100644 src/BuildVision.UI/Components/UserControl_ForTesting.xaml diff --git a/src/BuildVision.UI/BuildVision.UI.csproj b/src/BuildVision.UI/BuildVision.UI.csproj index 837776af..8fb41c75 100644 --- a/src/BuildVision.UI/BuildVision.UI.csproj +++ b/src/BuildVision.UI/BuildVision.UI.csproj @@ -240,10 +240,6 @@ MSBuild:Compile Designer - - MSBuild:Compile - Designer - Designer MSBuild:Compile diff --git a/src/BuildVision.UI/Components/ControlView.xaml b/src/BuildVision.UI/Components/ControlView.xaml index 4f4d8e6c..edd21248 100644 --- a/src/BuildVision.UI/Components/ControlView.xaml +++ b/src/BuildVision.UI/Components/ControlView.xaml @@ -6,7 +6,6 @@ xmlns:viewModels="clr-namespace:BuildVision.UI.ViewModels" xmlns:extensions="clr-namespace:BuildVision.UI.Extensions" xmlns:helpers="clr-namespace:BuildVision.UI.Helpers" - xmlns:contracts="clr-namespace:BuildVision.Contracts;assembly=BuildVision.Contracts" xmlns:customButtons="clr-namespace:BuildVision.UI.Controls.Buttons" xmlns:indicators="clr-namespace:BuildVision.UI.Controls.Indicators" xmlns:controls="clr-namespace:BuildVision.UI.Controls" @@ -16,7 +15,6 @@ mc:Ignorable="d" Name="OwnerUserControl" Background="{DynamicResource ToolWindowBackgroundKey}" - DataContextChanged="OnDataContextChanged" SnapsToDevicePixels="True" UseLayoutRounding="True" d:DesignHeight="148" diff --git a/src/BuildVision.UI/Components/ControlView.xaml.cs b/src/BuildVision.UI/Components/ControlView.xaml.cs index a86bfc17..42e9aea6 100644 --- a/src/BuildVision.UI/Components/ControlView.xaml.cs +++ b/src/BuildVision.UI/Components/ControlView.xaml.cs @@ -1,21 +1,6 @@ -using BuildVision.UI.Converters; -using BuildVision.UI.DataGrid; -using BuildVision.UI.Helpers; -using BuildVision.UI.Models; -using BuildVision.UI.ViewModels; -using System.Collections.Generic; -using System.Collections.Specialized; -using System.ComponentModel; -using System.Diagnostics; -using System.Globalization; -using System.Linq; -using System.Windows; +using System.Globalization; using System.Windows.Controls; -using System.Windows.Controls.Primitives; -using System.Windows.Data; -using System.Windows.Input; using System.Windows.Markup; -using System.Windows.Media; namespace BuildVision.UI { @@ -24,8 +9,6 @@ namespace BuildVision.UI /// public partial class ControlView : UserControl { - private BuildVisionPaneViewModel _viewModel; - public ControlView() { InitializeComponent(); @@ -33,26 +16,5 @@ public ControlView() // By default, WPF uses en-US as the culture, regardless of the system settings. Language = XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag); } - - private void OnDataContextChanged(object sender, DependencyPropertyChangedEventArgs e) - { - Debug.Assert(DataContext != null); - - _viewModel = (BuildVisionPaneViewModel) DataContext; - _viewModel.PropertyChanged += ViewModelOnPropertyChanged; - } - - private void ViewModelOnPropertyChanged(object sender, PropertyChangedEventArgs e) - { - //TODO implement logic for scrolling tu currentproject - //if (_viewModel.CurrentProject != null && e.PropertyName == "CurrentProject") - //{ - // // TODO: Remove SelectedIndex = -1 and implement Unselect row feature by clicking on selected row. - // Grid.SelectedIndex = -1; - - // if (Grid.SelectedIndex == -1) - // Grid.ScrollIntoView(_viewModel.CurrentProject); - //} - } } } diff --git a/src/BuildVision.UI/Components/ProjectGrid.xaml b/src/BuildVision.UI/Components/ProjectGrid.xaml index 7985074c..03aa0ee2 100644 --- a/src/BuildVision.UI/Components/ProjectGrid.xaml +++ b/src/BuildVision.UI/Components/ProjectGrid.xaml @@ -118,7 +118,7 @@ ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.IsDeferredScrollingEnabled="False" ScrollViewer.VerticalScrollBarVisibility="Auto" - SelectedItem="{Binding SelectedProjectItem}" + SelectedItem="{Binding BuildInformationModel.CurrentProject}" SelectionMode="Single" SelectionUnit="FullRow" Sorting="GridOnSorting" @@ -172,21 +172,13 @@