Skip to content

Commit

Permalink
Ver 1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Jycjmf committed May 26, 2022
1 parent 4bb0a3f commit 1087f6a
Show file tree
Hide file tree
Showing 11 changed files with 82 additions and 41 deletions.
31 changes: 13 additions & 18 deletions SearchEverywhere/Converter/StatusIconWidthConventer.cs
Original file line number Diff line number Diff line change
@@ -1,26 +1,21 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace SearchEverywhere.Converter
namespace SearchEverywhere.Converter;

public class StatusIconWidthConventer : IValueConverter
{
public class StatusIconWidthConventer : IValueConverter
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{

if (value == null)
return 20;
return long.Parse(value.ToString()) * (double.Parse(parameter.ToString())/10);
}
if (value == null || parameter == null)
return 20;
return System.Convert.ToInt64(Math.Round(System.Convert.ToDouble(value))) *
(double.Parse(parameter.ToString()) / 10);
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
35 changes: 17 additions & 18 deletions SearchEverywhere/Converter/WidthConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,26 @@
using System.Globalization;
using System.Windows.Data;

namespace SearchEverywhere.Converter
namespace SearchEverywhere.Converter;

public class WidthConverter : IValueConverter
{
public class WidthConverter : IValueConverter
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
if (value != null)
{
if (value != null)
{
var res = int.Parse(value.ToString());
if (parameter == null)
parameter = 0;
if (res - long.Parse(parameter.ToString()) <= 10) return 90;
return res - long.Parse(parameter.ToString());
}

return 100;
var res = System.Convert.ToInt32(Math.Round(System.Convert.ToDouble(value)));
if (parameter == null)
parameter = 0;
if (res - long.Parse(parameter.ToString()) <= 10) return 90;
return res - long.Parse(parameter.ToString());
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
return 100;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
Binary file removed SearchEverywhere/SearchEverywhere-源代码.zip
Binary file not shown.
28 changes: 27 additions & 1 deletion SearchEverywhere/SearchEverywhere.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,21 @@
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand Down Expand Up @@ -576,7 +591,18 @@
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.7.2">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.7.2 %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<Content Include="img\about.svg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
Expand Down
11 changes: 11 additions & 0 deletions SearchEverywhere/Utility/ProcessUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,24 @@ private async void NewProcessEvent(object sender, EventArrivedEventArgs e)
if (processList.Exists(x => x.ProcessId == ProcessId))
return;
var tempProcess = Process.GetProcessById(ProcessId);
var count = 0;
while (tempProcess.MainWindowTitle.Length <= 0 && count < 3)
{
tempProcess = Process.GetProcessById(ProcessId);
count++;
await Task.Delay(500);
}

if (tempProcess.MainWindowTitle.Length > 0)
{
var processInfo = await GetProcessInfo(tempProcess);
processList.Add(processInfo);
WeakReferenceMessenger.Default.Send(new RefreshProcessModel(true, processInfo), "RefreshApplistToken");
}
}
catch (ArgumentException exp)
{
}
catch (Exception exception)
{
}
Expand Down
5 changes: 4 additions & 1 deletion SearchEverywhere/View/AboutView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@
<StackPanel Grid.Row="0" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center"
Margin="0 50 0 0">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<TextBlock FontSize="50" VerticalAlignment="Center" FontWeight="Bold">SearchEverywhere</TextBlock>
<Image Source="/img/logo.png" Width="60" RenderOptions.BitmapScalingMode="HighQuality" />
<TextBlock FontSize="50" VerticalAlignment="Center" FontWeight="Bold">SearchEverywhere</TextBlock>
<TextBlock VerticalAlignment="Bottom" FontSize="12" Margin="5 0 0 10">
Ver 1.3
</TextBlock>
</StackPanel>
<TextBlock FontSize="20" Margin="0 10 0 0">快速多任务切换 | 毫秒级文件搜索 | 常用格式预览 | 遵循MVVM模式</TextBlock>
<Button Style="{DynamicResource ButtonInfo}" Background="{DynamicResource SecondaryBorderBrush}"
Expand Down
2 changes: 1 addition & 1 deletion SearchEverywhere/View/SearchView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@
<!--搜索结果-->
<ListView Grid.Row="3" ItemsSource="{Binding SearchResultList,Mode=OneWay}" Grid.Column="0"
ItemContainerStyle="{StaticResource ItemStyle}" SelectedIndex="{Binding SelectIndex}"
BorderThickness="0" Margin="30 10 30 0" Background="White" Name="ResultListView">
BorderThickness="0" Margin="30 10 30 0" Background="White" Name="ResultListView" PreviewKeyDown="ResultListView_OnPreviewKeyDown">
<ListView.View>
<GridView ColumnHeaderContainerStyle="{StaticResource HeaderStyle}">
<GridViewColumn />
Expand Down
7 changes: 7 additions & 0 deletions SearchEverywhere/View/SearchView.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using HandyControl.Controls;
using Microsoft.Toolkit.Mvvm.Messaging;

Expand Down Expand Up @@ -40,4 +41,10 @@ private void SearchView_OnLoaded(object sender, RoutedEventArgs e)
private void SearchView_OnIsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
{
}

private void ResultListView_OnPreviewKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Up || e.Key == Key.Down)
e.Handled = true;
}
}
2 changes: 1 addition & 1 deletion SearchEverywhere/View/WizardView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
xf:Animations.PrimaryBinding="{Binding CurrentWizardModel.EnvironmentError,Converter={StaticResource ReverseBooleanConverter}}"
xf:Animations.Secondary="{xf:Animate BasedOn={StaticResource FadeIn},Event=None}"
xf:Animations.SecondaryBinding="{Binding CurrentWizardModel.EnvironmentError}"
Visibility="{Binding CurrentWizardModel.ExitButtonVisibility}" Command="hc:ControlCommands.CloseWindow">
Visibility="{Binding CurrentWizardModel.ExitButtonVisibility}" Command="{Binding CloseCommand}">
退出
</Button>
<TextBlock HorizontalAlignment="Center" FontSize="20"
Expand Down
2 changes: 1 addition & 1 deletion SearchEverywhere/ViewModel/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public int SelectIndex
set
{
SetProperty(ref selectIndex, value);
if (searchResultList.Count != 0 && value != -1)
if (searchResultList.Count != 0 && value >= 0)
CurrentApp = searchResultList[value];
else
CurrentApp = null;
Expand Down
Binary file added SearchEverywhere/源代码 Ver1.3.zip
Binary file not shown.

0 comments on commit 1087f6a

Please sign in to comment.