diff --git a/XLAB/MainWindow.xaml b/XLAB/MainWindow.xaml
index 8e70539..1dcf9ea 100644
--- a/XLAB/MainWindow.xaml
+++ b/XLAB/MainWindow.xaml
@@ -192,15 +192,33 @@
SelectedItem="{Binding SelectedDocumentGroup, Mode=TwoWay}"
AutoGenerateColumns="False"
CanUserAddRows="False"
- IsReadOnly="True"
+ IsReadOnly="False"
HeadersVisibility="Column">
-
+
+
+
+
+
+
+
+
+
+
+
@@ -268,6 +286,16 @@
+
+
+
+
+
+
+
diff --git a/XLAB/MainWindow.xaml.cs b/XLAB/MainWindow.xaml.cs
index 28750d7..20c7621 100644
--- a/XLAB/MainWindow.xaml.cs
+++ b/XLAB/MainWindow.xaml.cs
@@ -35,6 +35,16 @@ namespace XLAB
}
}
+ private void DocumentGroupRow_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
+ {
+ var row = sender as DataGridRow;
+ if (row != null)
+ {
+ row.IsSelected = true;
+ row.Focus();
+ }
+ }
+
private async void Window_Loaded(object sender, RoutedEventArgs e)
{
await _viewModel.InitializeAsync();
diff --git a/XLAB/MainWindowViewModel.cs b/XLAB/MainWindowViewModel.cs
index 7ff1c31..c75341f 100644
--- a/XLAB/MainWindowViewModel.cs
+++ b/XLAB/MainWindowViewModel.cs
@@ -49,6 +49,7 @@ namespace XLAB
AddDocumentCommand = new RelayCommand(delegate { AddDocument(); }, delegate { return !IsBusy; });
DeleteDocumentCommand = new RelayCommand(delegate { DeleteDocumentAsync(); }, delegate { return !IsBusy && SelectedDocument != null; });
+ DeleteSelectedGroupsCommand = new RelayCommand(delegate { DeleteSelectedGroupsAsync(); }, delegate { return CanDeleteSelectedGroups(); });
MarkLinePassedCommand = new RelayCommand(delegate { EditLineVerificationAsync(true); }, delegate { return CanEditSelectedLineVerification(); });
MarkLineRejectedCommand = new RelayCommand(delegate { EditLineVerificationAsync(false); }, delegate { return CanEditSelectedLineVerification(); });
OpenInstrumentPickerCommand = new RelayCommand(delegate { OpenInstrumentPickerAsync(); }, delegate { return !IsBusy && SelectedDocument != null && SelectedDocument.CustomerId.HasValue; });
@@ -100,6 +101,8 @@ namespace XLAB
public ICommand DeleteDocumentCommand { get; private set; }
+ public ICommand DeleteSelectedGroupsCommand { get; private set; }
+
public string GroupDetailFilterText
{
get { return _groupDetailFilterText; }
@@ -312,18 +315,27 @@ namespace XLAB
return GetPendingLines(SelectedDocument).Count > 0;
}
- private bool CanEditSelectedLineVerification()
+ private bool CanDeleteSelectedGroups()
{
return !IsBusy
- && SelectedDocumentLine != null
- && !HasVerificationData(SelectedDocumentLine);
+ && SelectedDocument != null
+ && GetDeleteTargetGroups().Count > 0;
+ }
+
+ private bool CanEditSelectedLineVerification()
+ {
+ var targetLines = GetVerificationTargetLines();
+ return !IsBusy
+ && targetLines.Count > 0
+ && targetLines.All(delegate(PsvDocumentLine line) { return !HasVerificationData(line); });
}
private bool CanResetSelectedLineVerification()
{
+ var targetLines = GetVerificationTargetLines();
return !IsBusy
- && SelectedDocumentLine != null
- && HasVerificationData(SelectedDocumentLine);
+ && targetLines.Count > 0
+ && targetLines.All(HasVerificationData);
}
private static bool HasVerificationData(PsvDocumentLine line)
@@ -340,11 +352,131 @@ namespace XLAB
|| !string.IsNullOrWhiteSpace(line.RejectionReason));
}
+ private List GetCheckedDocumentLines()
+ {
+ return DocumentLinesView.Cast