Skip to content

Commit

Permalink
ver 1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Jycjmf committed May 16, 2022
1 parent 4f09831 commit 822c1d2
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 9 deletions.
2 changes: 1 addition & 1 deletion SearchEverywhere/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
mc:Ignorable="d"
DataContext="{Binding Source={StaticResource ViewModelLocator},Path=mainViewModel}"
Title="SearchEverywhere" Height="600" Width="960" Loaded="Window_Loaded" ShowNonClientArea="False"
Background="White">
Background="White" Closing="MainWindow_OnClosing">
<Window.Resources>
</Window.Resources>

Expand Down
6 changes: 6 additions & 0 deletions SearchEverywhere/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.ComponentModel;
using System.Windows;
using System.Windows.Input;
using Microsoft.Toolkit.Mvvm.DependencyInjection;
Expand Down Expand Up @@ -88,4 +89,9 @@ private void Window_Loaded(object sender, RoutedEventArgs e)
if (config.appSettings.SilentWindows) Visibility = Visibility.Hidden;
var hotkey = new HotKeyUtility();
}

private void MainWindow_OnClosing(object sender, CancelEventArgs e)
{
Environment.Exit(0);
}
}
Binary file added SearchEverywhere/SearchEverywhere-源代码.zip
Binary file not shown.
1 change: 1 addition & 0 deletions SearchEverywhere/SearchEverywhere.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<LangVersion>10</LangVersion>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
Expand Down
2 changes: 1 addition & 1 deletion SearchEverywhere/View/PreviewWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
xmlns:hc="https://handyorg.github.io/handycontrol"
mc:Ignorable="d"
Title="PreviewWindow" Height="450" Width="800"
DataContext="{Binding Source={StaticResource ViewModelLocator},Path=previewViewModel}">
DataContext="{Binding Source={StaticResource ViewModelLocator},Path=previewViewModel}" Closing="PreviewWindow_OnClosing">
<WindowChrome.WindowChrome>
<WindowChrome
CaptionHeight="40"
Expand Down
7 changes: 7 additions & 0 deletions SearchEverywhere/View/PreviewWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.ComponentModel;
using System.Windows;
using System.Windows.Input;
using Microsoft.Toolkit.Mvvm.Messaging;
Expand Down Expand Up @@ -52,6 +53,12 @@ private void RootGird_Loaded(object sender, RoutedEventArgs e)
//PreviewView.instance ??= new PreviewView();
//RootGird.Children.Add(PreviewView.instance);
}

private void PreviewWindow_OnClosing(object sender, CancelEventArgs e)
{
e.Cancel = true;
CloseWindowUtility();
}
}

public interface IView
Expand Down
8 changes: 4 additions & 4 deletions SearchEverywhere/View/SettingView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@
<StackPanel Orientation="Horizontal" Margin="0 20 0 0">
<svg:SvgViewbox Source="/img/auto start.svg" Width="25" Margin="5 0" />
<TextBlock FontSize="20" Text="开机自启动:" />
<ToggleButton Style="{StaticResource ToggleButtonSwitch }" IsChecked="{Binding AutoRun}"/>
<ToggleButton Style="{StaticResource ToggleButtonSwitch }" IsChecked="{Binding AutoRun}" />
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0 20 0 0">
<svg:SvgViewbox Source="/img/DND.svg" Width="25" Margin="5 0" />
<TextBlock FontSize="20" Text="静默启动:" />
<ToggleButton Style="{StaticResource ToggleButtonSwitch }" IsChecked="{Binding SlienceRun}"/>
<ToggleButton Style="{StaticResource ToggleButtonSwitch }" IsChecked="{Binding SlienceRun}" />
</StackPanel>
</UniformGrid>

Expand All @@ -83,7 +83,7 @@
</StackPanel>
<UniformGrid Columns="2" Margin="0 40 0 0">
<Button Style="{StaticResource ButtonDanger}" Content="重置" FontSize="20" Width="100"
Height="40" Cursor="Hand" Command="{Binding RestCommand}"/>
Height="40" Cursor="Hand" Command="{Binding RestCommand}" />
<Button Style="{StaticResource ButtonSuccess}" Background="{DynamicResource PrimaryBrush}"
Content="保存" FontSize="20" Width="100" Command="{Binding SaveCommand}"
Height="40" Cursor="Hand" />
Expand All @@ -109,7 +109,7 @@
<StackPanel Grid.Row="1" Orientation="Vertical" VerticalAlignment="Center">
<StackPanel Orientation="Horizontal" Margin="40 10 0 0">
<TextBlock FontSize="20" Text="开机自启动:" />
<svg:SvgViewbox Source="/img/success.svg" Width="20" />
<svg:SvgViewbox Source="{Binding AutoStartIcon}" Width="20" />
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="40 10 0 0">
<TextBlock FontSize="20" Text="LAVFilter服务:" />
Expand Down
7 changes: 4 additions & 3 deletions SearchEverywhere/ViewModel/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -321,15 +321,16 @@ private void StartProcessSearch(string keyword)
foreach (var each in runningAppsList) SearchResultList.Add(each);
SelectIndex = 0;
});
keyword = keyword?.Replace(@"\", @"\\").Replace(".", "\\.");
keyword = keyword?.Replace(@"\", @"\\").Replace(".", @"\.").Replace("|", "");
if (keyword == null) return;
var raw = runningAppsList
.Where(x => Regex.Matches(x.Title, keyword, RegexOptions.IgnoreCase).Count > 0)
.ToList();
var temp = new List<ListItemModel>();
foreach (var each in raw)
temp.Add(new ListItemModel(each.Icon,
Regex.Replace(each.Title, keyword, $"|~S~|{keyword}|~E~|", RegexOptions.IgnoreCase), each.Hwnd,
Regex.Replace(each.Title, keyword, $"|~S~|{keyword.Replace(@"\.", ".")}|~E~|",
RegexOptions.IgnoreCase), each.Hwnd,
each.CreateTime, each.Size, each.Path, each.Extension, each.SvgIcon, each.ProcessId));
Application.Current.Dispatcher.Invoke(() =>
{
Expand All @@ -348,7 +349,7 @@ private async Task StartFileSearch(string keyword)
{
if (string.IsNullOrWhiteSpace(keyword))
return;

Application.Current.Dispatcher.Invoke(() => SearchResultList.Clear());
var res = await everything.SearchFileAsync(keyword);
if (res?.Result.Count == 0)
return;
Expand Down
14 changes: 14 additions & 0 deletions SearchEverywhere/ViewModel/SettingViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class SettingViewModel : ObservableRecipient
{
private readonly ConfigurationUtility config = Ioc.Default.GetService<ConfigurationUtility>();
private bool autoRun;
private string autoStartIcon;
private Visibility colorPickerVisibility = Visibility.Hidden;
private int fontsize = 14;
private WhichColor preChangeColor;
Expand Down Expand Up @@ -66,6 +67,7 @@ public SettingViewModel()
auto.SetAutoStart();
else
auto.DeleteAutoStart();
AutoStartIcon = AutoRun ? "/img/success.svg" : "/img/error.svg";
}
catch (Exception e)
{
Expand All @@ -83,6 +85,16 @@ public SettingViewModel()
});
}

public string AutoStartIcon
{
get => autoStartIcon;
set
{
SetProperty(ref autoStartIcon, value);
OnPropertyChanged();
}
}

public ICommand RestCommand { get; }
public ICommand SaveCommand { get; }

Expand Down Expand Up @@ -139,6 +151,7 @@ public Visibility ColorPickerVisibility
}
}


public SolidColorBrush SelectedColorBrush
{
get => selectedColorBrush;
Expand All @@ -162,6 +175,7 @@ private void InitSetting()
Fontsize = config.appSettings.FontSize;
SearchDelay = config.appSettings.SearchDelay;
AutoRun = config.appSettings.StartWithWindows;
AutoStartIcon = autoRun ? "/img/success.svg" : "/img/error.svg";
SlienceRun = config.appSettings.SilentWindows;
}

Expand Down

0 comments on commit 822c1d2

Please sign in to comment.