public void RefreshFilter() { tbResult.Visibility = Visibility.Hidden; btFilter.IsEnabled = true; ListCollectionView view = defaultView; string nameFilter = filterName.Text.RemoveWhitespace().ToUpperInvariant(); string shFilter = filterSh.Text.RemoveWhitespace().ToUpperInvariant(); dgMainDataGrid.ItemsSource = view; if ((string.IsNullOrWhiteSpace(nameFilter) && string.IsNullOrWhiteSpace(shFilter)) || filterShown) { if (view.Filter != null) { view.Filter = null; } if (view.CustomSort != null) { view.CustomSort = null; } return; } BackgroundTaskManager.Tasks.Add(searchTask); if (cbRemove.IsChecked ?? true) { Predicate <object> filterPred = DataHelpers.GenerateDefaultNameFilter(nameFilter, shFilter); view.Filter = filterPred; } else { if (view.Filter != null) { view.Filter = null; } } if (!string.IsNullOrWhiteSpace(nameFilter)) { FilterComparer.Filter = nameFilter; view.CustomSort = FilterComparer; } BackgroundTaskManager.Tasks.Remove(searchTask); }
private void ExecuteDuplicateItem(object sender, ExecutedRoutedEventArgs e) { object item = dgMainDataGrid.SelectedItem; // duplicate item tab MainPage.NewTab(DataHelpers.GenerateItemTab(item, CommandType.copy), $"New {DataType.Name}"); }
private void ExecuteNewItem(object sender, ExecutedRoutedEventArgs e) { MainPage.NewTab(DataHelpers.GenerateItemTab(Activator.CreateInstance(DataType), CommandType.@new), $"New {DataType.Name}"); }
private void ExecuteEditItem(object sender, ExecutedRoutedEventArgs e) { object item = dgMainDataGrid.SelectedItem; // edit item tab MainPage.NewTab(DataHelpers.GenerateItemTab(item, CommandType.edit), $"Edit {DataType.Name}"); }
public override string ToString() { return($"{DataHelpers.WeekToString(Week)} {DataHelpers.DayToString(Week, Day)} {DataHelpers.PeriodToString(Week, Period)}"); }