diff --git a/EventLook/EventLook.csproj b/EventLook/EventLook.csproj index 4df039c..9de56c0 100644 --- a/EventLook/EventLook.csproj +++ b/EventLook/EventLook.csproj @@ -9,7 +9,7 @@ A fast & handy Event Viewer - 1.6.3.0 + 1.6.4.0 $(AssemblyTitle) Copyright (C) K. Maki EventLook @@ -49,8 +49,8 @@ - - + + diff --git a/EventLook/Model/FilterBase.cs b/EventLook/Model/FilterBase.cs index 8789c31..d6d99b7 100644 --- a/EventLook/Model/FilterBase.cs +++ b/EventLook/Model/FilterBase.cs @@ -20,12 +20,13 @@ public void SetCvs(CollectionViewSource cvs) this.cvs.Filter += DoFilter; } /// - /// Refreshes filter UI (e.g. populate filter items in a drop down) by loaded events, + /// For filters with checkboxes, populates the list of checkboxes by the loaded events. + /// This will do nothing for text-based filters. /// If reset is true, all filters will be cancelled (e.g. checkboxes all checked). /// Otherwise, it'll try to carry over filters user specified (except newly populated checkboxes). /// /// Loaded event items - public virtual void Refresh(IEnumerable events, bool reset) { } + public virtual void Populate(IEnumerable events, bool reset) { } /// /// Removes filter, but keeps the filter items in the dropdown (if available). diff --git a/EventLook/Model/IdFilter.cs b/EventLook/Model/IdFilter.cs index e1d1d21..127b6cf 100644 --- a/EventLook/Model/IdFilter.cs +++ b/EventLook/Model/IdFilter.cs @@ -51,11 +51,6 @@ public void AddFilterId(int id, bool isExclude) + (isExclude ? $"-{id}" : $"{id}"); } - public override void Refresh(IEnumerable events, bool reset) - { - if (reset) - Clear(); - } public override void Clear() { FilterText = ""; diff --git a/EventLook/Model/LevelFilter.cs b/EventLook/Model/LevelFilter.cs index fa44c6e..a1907a5 100644 --- a/EventLook/Model/LevelFilter.cs +++ b/EventLook/Model/LevelFilter.cs @@ -25,7 +25,7 @@ public ReadOnlyObservableCollection LevelFilters private set; } - public override void Refresh(IEnumerable events, bool reset) + public override void Populate(IEnumerable events, bool reset) { // Remember filters and their selections before clearing (needs ToList) var prevFilters = reset ? null : levelFilters.Select(f => new { f.Level, f.Selected }).ToList(); diff --git a/EventLook/Model/MessageFilter.cs b/EventLook/Model/MessageFilter.cs index 4cefd21..3d1aac6 100644 --- a/EventLook/Model/MessageFilter.cs +++ b/EventLook/Model/MessageFilter.cs @@ -40,11 +40,6 @@ public string MessageFilterText } } - public override void Refresh(IEnumerable events, bool reset) - { - if (reset) - Clear(); - } public override void Clear() { MessageFilterText = ""; diff --git a/EventLook/Model/ProcessHelper.cs b/EventLook/Model/ProcessHelper.cs index 2f81ea2..747319c 100644 --- a/EventLook/Model/ProcessHelper.cs +++ b/EventLook/Model/ProcessHelper.cs @@ -36,4 +36,18 @@ public static void LaunchEventViewer(LogSource logSource) Arguments = arg, }); } + + /// + /// Launches the associated app with shell for the supplied URI . + /// + /// + public static void OpenUri(string uri) + { + try + { + Process.Start(new ProcessStartInfo(uri) { UseShellExecute = true }); + } + catch (Exception) + { } + } } diff --git a/EventLook/Model/SourceFilter.cs b/EventLook/Model/SourceFilter.cs index 1dad920..484e795 100644 --- a/EventLook/Model/SourceFilter.cs +++ b/EventLook/Model/SourceFilter.cs @@ -27,7 +27,7 @@ public ReadOnlyObservableCollection SourceFilters private set; } - public override void Refresh(IEnumerable events, bool reset) + public override void Populate(IEnumerable events, bool reset) { // Remember filters and their selections before clearing (needs ToList) var prevFilters = reset ? null : sourceFilters.Select(f => new { f.Name, f.Selected }).ToList(); diff --git a/EventLook/View/MainWindow.xaml b/EventLook/View/MainWindow.xaml index f84b341..27b12ce 100644 --- a/EventLook/View/MainWindow.xaml +++ b/EventLook/View/MainWindow.xaml @@ -51,6 +51,12 @@ + + + + + + @@ -76,8 +82,13 @@ - - + + + + + + + @@ -172,13 +183,13 @@ @@ -202,14 +213,18 @@ + Command="{Binding DataContext.FilterToSelectedSourceCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" + IsEnabled="{Binding DataContext.IsUpdating, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}, Converter={StaticResource InverseBooleanConverter}}"/> + Command="{Binding DataContext.ExcludeSelectedSourceCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" + IsEnabled="{Binding DataContext.IsUpdating, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}, Converter={StaticResource InverseBooleanConverter}}"/> + Command="{Binding DataContext.FilterToSelectedLevelCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" + IsEnabled="{Binding DataContext.IsUpdating, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}, Converter={StaticResource InverseBooleanConverter}}"/> + Command="{Binding DataContext.ExcludeSelectedLevelCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" + IsEnabled="{Binding DataContext.IsUpdating, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}, Converter={StaticResource InverseBooleanConverter}}"/> diff --git a/EventLook/ViewModel/MainViewModel.cs b/EventLook/ViewModel/MainViewModel.cs index 11ade64..7dd9e95 100644 --- a/EventLook/ViewModel/MainViewModel.cs +++ b/EventLook/ViewModel/MainViewModel.cs @@ -257,7 +257,7 @@ private async void Refresh(bool reset, bool append = false) // If the log source selection is changed before completing loading events, we don't want to enumerate // the source filter items with the previous log source. if (!IsUpdating) - filters.ForEach(f => f.Refresh(Events, reset)); + filters.ForEach(f => f.Populate(Events, reset)); Refreshed?.Invoke(); } @@ -359,6 +359,8 @@ private void OnFilterUpdated(object sender, EventArgs e) public ICommand CopyMessageTextCommand { get; private set; } public ICommand ExportToCsvCommand { get; private set; } public ICommand RunAsAdminCommand { get; private set; } + public ICommand OpenStoreCommand { get; private set; } + public ICommand OpenGitHubCommand { get; private set; } private void InitializeCommands() { @@ -382,6 +384,8 @@ private void InitializeCommands() CopyMessageTextCommand = new RelayCommand(CopyMessageText); ExportToCsvCommand = new RelayCommand(ExportToCsv); RunAsAdminCommand = new RelayCommand(RunAsAdmin); + OpenStoreCommand = new RelayCommand(OpenStore); + OpenGitHubCommand = new RelayCommand(OpenGitHub); } #endregion @@ -483,7 +487,7 @@ private void AutoRefreshCallback(ProgressInfo progressInfo) { InsertEvents(progressInfo.LoadedEvents); // Single event should be loaded at a time. LoadedEventCount = Events.Count; - filters.ForEach(f => f.Refresh(Events, reset: false)); + filters.ForEach(f => f.Populate(Events, reset: false)); // If the range is like "Last x days", just adjust appearance of the date time picker. if (!SelectedRange.IsCustom && SelectedRange.DaysFromNow != 0) ToDateTime = DateTime.Now; @@ -752,4 +756,12 @@ private void RunAsAdmin() MessageBox.Show("Failed to restart as administrator.", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } } + private void OpenStore() + { + ProcessHelper.OpenUri("ms-windows-store://pdp/?productid=9NJV5FQ089Z0"); + } + private void OpenGitHub() + { + ProcessHelper.OpenUri("https://github.com/kmaki565/EventLook"); + } } \ No newline at end of file diff --git a/EventLookPackage/Package.appxmanifest b/EventLookPackage/Package.appxmanifest index abeae66..da334b7 100644 --- a/EventLookPackage/Package.appxmanifest +++ b/EventLookPackage/Package.appxmanifest @@ -9,7 +9,7 @@ + Version="1.6.4.0" /> EventLook