Skip to content
This repository was archived by the owner on Sep 8, 2023. It is now read-only.

Commit 66b6ee7

Browse files
committed
Переделки UI. Обновил splashscreen
1 parent f4528f6 commit 66b6ee7

File tree

11 files changed

+50
-72
lines changed

11 files changed

+50
-72
lines changed

Library/Library.Client/Library.Client.csproj

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<WarningLevel>4</WarningLevel>
1515
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
1616
<LangVersion>8</LangVersion>
17+
<ApplicationIcon>Library.ico</ApplicationIcon>
1718
</PropertyGroup>
1819
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1920
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -82,12 +83,8 @@
8283
<Compile Include="View\HighlightsControl.xaml.cs">
8384
<DependentUpon>HighlightsControl.xaml</DependentUpon>
8485
</Compile>
85-
<Compile Include="View\MainControl.xaml.cs">
86-
<DependentUpon>MainControl.xaml</DependentUpon>
87-
<SubType>Code</SubType>
88-
</Compile>
89-
<Compile Include="View\SearchControl.xaml.cs">
90-
<DependentUpon>SearchControl.xaml</DependentUpon>
86+
<Compile Include="View\MainWindow.xaml.cs">
87+
<DependentUpon>MainWindow.xaml</DependentUpon>
9188
</Compile>
9289
</ItemGroup>
9390
<ItemGroup>
@@ -104,11 +101,7 @@
104101
</ItemGroup>
105102
<ItemGroup>
106103
<Page Include="View\HighlightsControl.xaml" />
107-
<Page Include="View\MainControl.xaml">
108-
<Generator>MSBuild:Compile</Generator>
109-
<SubType>Designer</SubType>
110-
</Page>
111-
<Page Include="View\SearchControl.xaml" />
104+
<Page Include="View\MainWindow.xaml" />
112105
</ItemGroup>
113106
<ItemGroup>
114107
<ProjectReference Include="..\Library\Library.csproj">
@@ -131,7 +124,12 @@
131124
<SplashScreen Include="splashscreen.png">
132125
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
133126
</SplashScreen>
127+
<Content Include="Library.ico">
128+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
129+
<CopyToPublishDirectory>Always</CopyToPublishDirectory>
130+
</Content>
134131
</ItemGroup>
132+
135133
<ItemGroup>
136134
<PackageReference Include="NLog" Version="4.7.2" />
137135
</ItemGroup>

Library/Library.Client/Library.ico

66.1 KB
Binary file not shown.

Library/Library.Client/View/App.xaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
Startup="App_OnStartup"
88
Exit="App_OnExit"
99
ShutdownMode="OnLastWindowClose">
10+
<Application.MainWindow>
11+
<view:MainWindow Visibility="Visible"/>
12+
</Application.MainWindow>
1013
<Application.Resources>
1114
<DataTemplate DataType="{x:Type viewModel:SearchViewModel}">
12-
<view:SearchControl/>
13-
</DataTemplate>
14-
<DataTemplate DataType="{x:Type viewModel:MainWindowViewModel}">
15-
<view:MainControl/>
15+
<view:MainWindow/>
1616
</DataTemplate>
1717
<DataTemplate DataType="{x:Type viewModel:HighlightsViewModel}">
1818
<view:HighlightsControl/>

Library/Library.Client/View/App.xaml.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,16 @@ public partial class App
3737
private void App_OnStartup(object sender, StartupEventArgs e)
3838
{
3939
ShowTransparentWindow();
40+
var splash = new SplashScreen("splashscreen.png");
41+
splash.Show(false);
4042
InitApplication();
4143

4244
ElasticProvider.Instance.Initialize();
4345
ElasticSynchronizer.SynchronizeWithDisk();
4446

45-
ViewService.OpenViewModel(new MainWindowViewModel());
4647
transparentWindow.Close();
4748
transparentWindow = null;
49+
splash.Close(TimeSpan.Zero);
4850
}
4951

5052
private void App_OnExit(object sender, ExitEventArgs e)

Library/Library.Client/View/MainControl.xaml

Lines changed: 0 additions & 13 deletions
This file was deleted.

Library/Library.Client/View/MainControl.xaml.cs

Lines changed: 0 additions & 18 deletions
This file was deleted.

Library/Library.Client/View/SearchControl.xaml renamed to Library/Library.Client/View/MainWindow.xaml

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1-
<UserControl x:Class="Library.Client.View.SearchControl"
2-
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4-
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5-
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6-
xmlns:view="clr-namespace:Library.Client.View"
7-
xmlns:viewModel="clr-namespace:Library.Client.ViewModel"
8-
mc:Ignorable="d" d:DataContext="{d:DesignInstance viewModel:SearchViewModel}">
9-
<UserControl.Resources>
10-
<view:IndexConverter x:Key="IndexConverter" />
11-
<view:PagesConverter x:Key="PagesConverter" />
12-
</UserControl.Resources>
1+
<Window x:Class="Library.Client.View.MainWindow"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:local="clr-namespace:Library.Client.View"
7+
mc:Ignorable="d"
8+
Title="Library"
9+
Width="640" Height="480"
10+
MinWidth="440" MinHeight="280"
11+
WindowStartupLocation="CenterScreen">
12+
<Window.Resources>
13+
<local:IndexConverter x:Key="IndexConverter" />
14+
<local:PagesConverter x:Key="PagesConverter" />
15+
</Window.Resources>
1316
<Grid>
1417
<Grid.RowDefinitions>
1518
<RowDefinition Height="40"/>
@@ -149,4 +152,4 @@
149152
Height="50"/>
150153
</ScrollViewer>
151154
</Grid>
152-
</UserControl>
155+
</Window>

Library/Library.Client/View/SearchControl.xaml.cs renamed to Library/Library.Client/View/MainWindow.xaml.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.Globalization;
4+
using System.Windows;
45
using System.Windows.Controls;
56
using System.Windows.Data;
7+
using Library.Client.ViewModel;
68

79
namespace Library.Client.View
810
{
9-
/// <summary>
10-
/// Логика взаимодействия для SearchControl.xaml.
11-
/// </summary>
12-
public partial class SearchControl : UserControl
11+
public partial class MainWindow : Window
1312
{
14-
public SearchControl()
13+
public MainWindow()
1514
{
1615
InitializeComponent();
16+
DataContext = new SearchViewModel();
1717
}
1818
}
19-
2019
/// <summary>
2120
/// Конвертер индексов.
2221
/// </summary>
@@ -57,4 +56,4 @@ public object ConvertBack(object value, Type targetType, object parameter, Cultu
5756
throw new NotImplementedException();
5857
}
5958
}
60-
}
59+
}
-95.4 KB
Loading

Library/Library/Utils/ElasticProvider.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Collections.Generic;
33
using System.IO;
44
using System.Linq;
5+
using Elasticsearch.Net;
56
using Library.Entity;
67
using Library.Resources;
78
using Nest;
@@ -322,13 +323,19 @@ public ISearchResponse<Page> Search(string searchPhrase)
322323
{
323324
_log.Debug($"Searching: {searchPhrase} in index: {PagesIndexName}");
324325
response = Client.Search<Page>(s => s.Index(Indices.Parse(PagesIndexName))
325-
.StoredFields(sf => sf.Field(f => f.BookId).Field(f => f.Number).Field(f => f.Attachment.Content))
326-
.Query(q => q.SimpleQueryString(sq => sq
326+
.StoredFields(sf => sf.Field(f => f.BookId).Field(f => f.Number).Field(f => f.Attachment.Content).Field("_score"))
327+
.Query(q => q
328+
.SimpleQueryString(sq => sq
327329
.Query(searchPhrase)
330+
.DefaultOperator(Operator.And)
328331
.Fields(f => f.Field(p => p.Attachment.Content))
329-
.Analyzer("my_russian_morphology")))
332+
.Analyzer("my_russian_morphology")
333+
.Flags(SimpleQueryStringFlags.Near |
334+
SimpleQueryStringFlags.Phrase |
335+
SimpleQueryStringFlags.Fuzzy)))
330336
.Sort(s => s
331-
.Ascending(f => f.BookId))
337+
.Ascending(f => f.BookId)
338+
.Field(f => f.Field("_score")))
332339
.Size(10000)
333340
.Highlight(h => h
334341
.Fields(f => f.Field(b => b.Attachment.Content))));

0 commit comments

Comments
 (0)