diff --git a/src/BuildVision.Contracts/Models/IBuildProgressViewModel.cs b/src/BuildVision.Contracts/Models/IBuildProgressViewModel.cs index 842d1f58..45f346e4 100644 --- a/src/BuildVision.Contracts/Models/IBuildProgressViewModel.cs +++ b/src/BuildVision.Contracts/Models/IBuildProgressViewModel.cs @@ -3,7 +3,6 @@ public interface IBuildProgressViewModel { bool ActionProgressIsPaused { get; set; } - bool ActionProgressIsVisible { get; set; } int CurrentQueuePosOfBuildingProject { get; } void OnBuildBegin(int projectsCount); diff --git a/src/BuildVision.UI/BuildVision.UI.csproj b/src/BuildVision.UI/BuildVision.UI.csproj index 5d725b9e..8a335f40 100644 --- a/src/BuildVision.UI/BuildVision.UI.csproj +++ b/src/BuildVision.UI/BuildVision.UI.csproj @@ -73,6 +73,9 @@ App.xaml Code + + ProjectGrid.xaml + BuildVisionProgressBar.xaml @@ -228,6 +231,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + MSBuild:Compile Designer diff --git a/src/BuildVision.UI/Components/ControlView.xaml b/src/BuildVision.UI/Components/ControlView.xaml index 925ea778..3cb87af2 100644 --- a/src/BuildVision.UI/Components/ControlView.xaml +++ b/src/BuildVision.UI/Components/ControlView.xaml @@ -12,6 +12,7 @@ xmlns:customButtons="clr-namespace:BuildVision.UI.Controls.Buttons" xmlns:indicators="clr-namespace:BuildVision.UI.Controls.Indicators" xmlns:controls="clr-namespace:BuildVision.UI.Controls" + xmlns:components="clr-namespace:BuildVision.UI.Components" mc:Ignorable="d" Name="OwnerUserControl" Background="{DynamicResource ToolWindowBackgroundKey}" @@ -31,70 +32,13 @@ + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -114,17 +58,17 @@ + Template="{StaticResource StandBy}" /> - - + + @@ -260,240 +204,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/src/BuildVision.UI/Components/ControlView.xaml.cs b/src/BuildVision.UI/Components/ControlView.xaml.cs index 1d4101ec..0e5a3029 100644 --- a/src/BuildVision.UI/Components/ControlView.xaml.cs +++ b/src/BuildVision.UI/Components/ControlView.xaml.cs @@ -37,31 +37,11 @@ public ControlView() //Grid.TargetUpdated += GridOnTargetUpdated; } - private void GridOnTargetUpdated(object sender, DataTransferEventArgs e) - { - if (e.Property.Name == "ItemsSource") - RefreshSortDirectionInGrid(); - } - - private void RefreshSortDirectionInGrid() - { - //DataGridColumn dataGridColumn = Grid.Columns.FirstOrDefault(col => col.GetBindedProperty() == _viewModel.GridSortDescription.Property); - //if (dataGridColumn != null) - // dataGridColumn.SortDirection = _viewModel.GridSortDescription.Order.ToSystem(); - } - - private void GridOnSorting(object sender, DataGridSortingEventArgs e) - { - if (_viewModel.GridSorting.CanExecute(e)) - _viewModel.GridSorting.Execute(e); - } - private void OnDataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { Debug.Assert(DataContext != null); - _viewModel = (BuildVisionPaneViewModel)DataContext; - //_viewModel.SetGridColumnsRef(Grid.Columns); + _viewModel = (BuildVisionPaneViewModel) DataContext; _viewModel.PropertyChanged += ViewModelOnPropertyChanged; } @@ -78,64 +58,5 @@ private void ViewModelOnPropertyChanged(object sender, PropertyChangedEventArgs //} } - private void DataGridExpanderOnExpanded(object sender, RoutedEventArgs e) - { - ExpanderIsExpandedConverter.SaveState( - (Expander)sender, - false, - _viewModel.ControlSettings.GridSettings.CollapsedGroups); - e.Handled = true; - } - - private void DataGridExpanderOnCollapsed(object sender, RoutedEventArgs e) - { - ExpanderIsExpandedConverter.SaveState( - (Expander)sender, - true, - _viewModel.ControlSettings.GridSettings.CollapsedGroups); - e.Handled = true; - } - - // Send scrolling to the DataGrid. - private void DataGridExpanderOnPreviewMouseWheel(object sender, MouseWheelEventArgs e) - { - e.Handled = true; - var eventArg = new MouseWheelEventArgs(e.MouseDevice, e.Timestamp, e.Delta) - { - RoutedEvent = MouseWheelEvent, - Source = sender - }; - - var parent = (UIElement)VisualTreeHelper.GetParent((DependencyObject)sender); - parent.RaiseEvent(eventArg); - } - - private void DataGridRowDetailsOnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) - { - // http://stackoverflow.com/questions/6279724/mousedoubleclick-events-dont-bubble/6326181#6326181) - if (e.ClickCount == 2) - e.Handled = true; - } - - // Autofocus for RowDetails (without extra mouse click). - private void DataGridRowOnPreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) - { - var row = (DataGridRow)sender; - if (!row.IsSelected && e.Source is DataGridDetailsPresenter) - { - row.Focusable = true; - row.Focus(); - - // Gets the element with keyboard focus. - var elementWithFocus = Keyboard.FocusedElement as UIElement; - - // Change keyboard focus. - if (elementWithFocus != null) - { - var request = new TraversalRequest(FocusNavigationDirection.Next); - elementWithFocus.MoveFocus(request); - } - } - } } } diff --git a/src/BuildVision.UI/Components/ProjectGrid.xaml b/src/BuildVision.UI/Components/ProjectGrid.xaml new file mode 100644 index 00000000..950e7741 --- /dev/null +++ b/src/BuildVision.UI/Components/ProjectGrid.xaml @@ -0,0 +1,333 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/BuildVision.UI/Components/ProjectGrid.xaml.cs b/src/BuildVision.UI/Components/ProjectGrid.xaml.cs new file mode 100644 index 00000000..54c595ba --- /dev/null +++ b/src/BuildVision.UI/Components/ProjectGrid.xaml.cs @@ -0,0 +1,136 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using BuildVision.UI.Converters; +using BuildVision.UI.ViewModels; + +namespace BuildVision.UI.Components +{ + /// + /// Interaction logic for ProjectGrid.xaml + /// + public partial class ProjectGrid : UserControl + { + private BuildVisionPaneViewModel _viewModel; + + public ProjectGrid() + { + InitializeComponent(); + } + + private void GridOnTargetUpdated(object sender, DataTransferEventArgs e) + { + if (e.Property.Name == "ItemsSource") + RefreshSortDirectionInGrid(); + } + + private void RefreshSortDirectionInGrid() + { + //DataGridColumn dataGridColumn = Grid.Columns.FirstOrDefault(col => col.GetBindedProperty() == _viewModel.GridSortDescription.Property); + //if (dataGridColumn != null) + // dataGridColumn.SortDirection = _viewModel.GridSortDescription.Order.ToSystem(); + } + + private void GridOnSorting(object sender, DataGridSortingEventArgs e) + { + if (_viewModel.GridSorting.CanExecute(e)) + _viewModel.GridSorting.Execute(e); + } + + private void OnDataContextChanged(object sender, DependencyPropertyChangedEventArgs e) + { + //Debug.Assert(DataContext != null); + + _viewModel = (BuildVisionPaneViewModel) DataContext; + //_viewModel.SetGridColumnsRef(Grid.Columns); + //_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); + //} + } + + private void DataGridExpanderOnExpanded(object sender, RoutedEventArgs e) + { + ExpanderIsExpandedConverter.SaveState( + (Expander) sender, + false, + _viewModel.ControlSettings.GridSettings.CollapsedGroups); + e.Handled = true; + } + + private void DataGridExpanderOnCollapsed(object sender, RoutedEventArgs e) + { + ExpanderIsExpandedConverter.SaveState( + (Expander) sender, + true, + _viewModel.ControlSettings.GridSettings.CollapsedGroups); + e.Handled = true; + } + + // Send scrolling to the DataGrid. + private void DataGridExpanderOnPreviewMouseWheel(object sender, MouseWheelEventArgs e) + { + e.Handled = true; + var eventArg = new MouseWheelEventArgs(e.MouseDevice, e.Timestamp, e.Delta) + { + RoutedEvent = MouseWheelEvent, + Source = sender + }; + + var parent = (UIElement) VisualTreeHelper.GetParent((DependencyObject) sender); + parent.RaiseEvent(eventArg); + } + + private void DataGridRowDetailsOnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + // http://stackoverflow.com/questions/6279724/mousedoubleclick-events-dont-bubble/6326181#6326181) + if (e.ClickCount == 2) + e.Handled = true; + } + + // Autofocus for RowDetails (without extra mouse click). + private void DataGridRowOnPreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + var row = (DataGridRow) sender; + if (!row.IsSelected && e.Source is DataGridDetailsPresenter) + { + row.Focusable = true; + row.Focus(); + + // Gets the element with keyboard focus. + var elementWithFocus = Keyboard.FocusedElement as UIElement; + + // Change keyboard focus. + if (elementWithFocus != null) + { + var request = new TraversalRequest(FocusNavigationDirection.Next); + elementWithFocus.MoveFocus(request); + } + } + } + } +} diff --git a/src/BuildVision.UI/Models/BuildInformationModel.cs b/src/BuildVision.UI/Models/BuildInformationModel.cs index 2dcf6b8e..72fbd072 100644 --- a/src/BuildVision.UI/Models/BuildInformationModel.cs +++ b/src/BuildVision.UI/Models/BuildInformationModel.cs @@ -56,7 +56,7 @@ public int WarnedProjectsCount set => SetProperty(ref _warnedProjectsCount, value); } - private string _stateMessage = ""; + private string _stateMessage = Resources.BuildDoneText_BuildNotStarted; public string StateMessage { get => _stateMessage; diff --git a/src/BuildVision.UI/Models/ProjectItem.cs b/src/BuildVision.UI/Models/ProjectItem.cs index 63212f1a..bbdfd149 100644 --- a/src/BuildVision.UI/Models/ProjectItem.cs +++ b/src/BuildVision.UI/Models/ProjectItem.cs @@ -172,11 +172,11 @@ public ErrorsBox ErrorsBox } } - [GridColumn("ProjectItemHeader_ErrorsCount", ColumnsOrder.ErrorsCount, true, ImageDictionaryUri = "Resources/ValueIndicator.Resources.xaml", ImageKey = "ErrorsIndicator", ExampleValue = 4)] + [GridColumn("ProjectItemHeader_ErrorsCount", ColumnsOrder.ErrorsCount, true, ImageDictionaryUri = "Resources/ValueIndicator.Resources.xaml", ImageKey = "ErrorsIndicatorIcon", ExampleValue = 4)] public int ErrorsCount => ErrorsBox.ErrorsCount; - [GridColumn("ProjectItemHeader_WarningsCount", ColumnsOrder.WarningsCount, true, ImageDictionaryUri = "Resources/ValueIndicator.Resources.xaml", ImageKey = "WarningsIndicator", ExampleValue = 1253)] + [GridColumn("ProjectItemHeader_WarningsCount", ColumnsOrder.WarningsCount, true, ImageDictionaryUri = "Resources/ValueIndicator.Resources.xaml", ImageKey = "WarningsIndicatorIcon", ExampleValue = 1253)] public int WarningsCount => ErrorsBox.WarningsCount; - [GridColumn("ProjectItemHeader_MessagesCount", ColumnsOrder.MessagesCount, false, ImageDictionaryUri = "Resources/ValueIndicator.Resources.xaml", ImageKey = "MessagesIndicator", ExampleValue = 2)] + [GridColumn("ProjectItemHeader_MessagesCount", ColumnsOrder.MessagesCount, false, ImageDictionaryUri = "Resources/ValueIndicator.Resources.xaml", ImageKey = "MessagesIndicatorIcon", ExampleValue = 2)] public int MessagesCount => ErrorsBox.MessagesCount; private string _framework; diff --git a/src/BuildVision.UI/Styles/ControlViewStyle.xaml b/src/BuildVision.UI/Styles/ControlViewStyle.xaml index 514fe5c3..5de91183 100644 --- a/src/BuildVision.UI/Styles/ControlViewStyle.xaml +++ b/src/BuildVision.UI/Styles/ControlViewStyle.xaml @@ -32,17 +32,8 @@ diff --git a/src/BuildVision.UI/Themes/Generic.xaml b/src/BuildVision.UI/Themes/Generic.xaml index 8c696e32..485f17df 100644 --- a/src/BuildVision.UI/Themes/Generic.xaml +++ b/src/BuildVision.UI/Themes/Generic.xaml @@ -64,6 +64,8 @@