Skip to content

Commit ad8020a

Browse files
committed
Work on WPF
1 parent 8b2c333 commit ad8020a

File tree

7 files changed

+175
-25
lines changed

7 files changed

+175
-25
lines changed

SmartImage.UI/App.xaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Application x:Class="SmartImage.UI.App"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:local="clr-namespace:SmartImage.UI"
5+
StartupUri="MainWindow.xaml">
6+
<Application.Resources>
7+
8+
</Application.Resources>
9+
</Application>

SmartImage.UI/App.xaml.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Configuration;
4+
using System.Data;
5+
using System.Linq;
6+
using System.Threading.Tasks;
7+
using System.Windows;
8+
9+
namespace SmartImage.UI
10+
{
11+
/// <summary>
12+
/// Interaction logic for App.xaml
13+
/// </summary>
14+
public partial class App : Application
15+
{
16+
}
17+
}

SmartImage.UI/AssemblyInfo.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using System.Windows;
2+
3+
[assembly: ThemeInfo(
4+
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
5+
//(used if a resource is not found in the page,
6+
// or application resource dictionaries)
7+
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
8+
//(used if a resource is not found in the page,
9+
// app, or any theme specific resource dictionaries)
10+
)]

SmartImage.UI/MainWindow.xaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<Window x:Class="SmartImage.UI.MainWindow"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6+
xmlns:local="clr-namespace:SmartImage.UI"
7+
mc:Ignorable="d"
8+
Title="MainWindow" Height="450" Width="800">
9+
<Grid>
10+
<TextBox x:Name="Tb_Input" HorizontalAlignment="Left" Margin="10,34,0,0"
11+
TextWrapping="Wrap" VerticalAlignment="Top" Width="300" Height="20" TextChanged="Tb_Input_TextChanged"
12+
AllowDrop="True" Drop="Tb_Input_OnDrop" PreviewDrop="Grid_Drop" PreviewDragOver="Grid_DragOver"/>
13+
<Button x:Name="Btn_Run" Content="Run" HorizontalAlignment="Left" Margin="315,34,0,0" VerticalAlignment="Top" Width="40"/>
14+
<Button x:Name="Btn_Browse" Content="Browse" HorizontalAlignment="Left" Margin="360,34,0,0" VerticalAlignment="Top" Width="50"/>
15+
<ListBox d:ItemsSource="{d:SampleData ItemCount=5}" Height="NaN" Margin="0,256,0,0"/>
16+
<Image x:Name="Img_Query" HorizontalAlignment="Right" Height="120" Margin="0,10,10,0" VerticalAlignment="Top" Width="200"/>
17+
<Button x:Name="Btn_Clear" Content="Clear" HorizontalAlignment="Left" Margin="315,59,0,0" VerticalAlignment="Top" Width="40"/>
18+
<Label x:Name="Lbl_Input" Content="Input" HorizontalAlignment="Left" Margin="10,3,0,0" VerticalAlignment="Top" FontWeight="Bold"/>
19+
<ProgressBar x:Name="Pbr_Input" HorizontalAlignment="Left" Height="10" Margin="10,59,0,0" VerticalAlignment="Top" Width="100"/>
20+
21+
</Grid>
22+
</Window>

SmartImage.UI/MainWindow.xaml.cs

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using System.Windows;
7+
using System.Windows.Controls;
8+
using System.Windows.Data;
9+
using System.Windows.Documents;
10+
using System.Windows.Input;
11+
using System.Windows.Media;
12+
using System.Windows.Media.Animation;
13+
using System.Windows.Media.Imaging;
14+
using System.Windows.Navigation;
15+
using System.Windows.Shapes;
16+
using SmartImage.Lib;
17+
18+
namespace SmartImage.UI;
19+
20+
/// <summary>
21+
/// Interaction logic for MainWindow.xaml
22+
/// </summary>
23+
public partial class MainWindow : Window
24+
{
25+
public MainWindow()
26+
{
27+
InitializeComponent();
28+
// Tb_Input.AllowDrop = true;
29+
}
30+
31+
private SearchClient _searchClient;
32+
private SearchQuery _query;
33+
34+
private void Tb_Input_TextChanged(object sender, TextChangedEventArgs e) { }
35+
36+
private void Tb_Input_OnDrop(object sender, DragEventArgs e) { }
37+
38+
private void UIElement_OnDrop(object sender, DragEventArgs e) { }
39+
40+
private async void Grid_Drop(object sender, DragEventArgs e)
41+
{
42+
if (null != e.Data && e.Data.GetDataPresent(DataFormats.FileDrop)) {
43+
var data = e.Data.GetData(DataFormats.FileDrop) as string[];
44+
e.Handled = true;
45+
// handle the files here!
46+
47+
var v = data[0];
48+
49+
Tb_Input.Text = v;
50+
51+
var sq = await SearchQuery.TryCreateAsync(v);
52+
Img_Query.Source = new BitmapImage(new Uri(sq.Uni.Value.ToString()));
53+
}
54+
}
55+
56+
private void Grid_DragOver(object sender, DragEventArgs e)
57+
{
58+
if (e.Data.GetDataPresent(DataFormats.FileDrop)) {
59+
e.Effects = DragDropEffects.Copy;
60+
e.Handled = true;
61+
}
62+
else {
63+
e.Effects = DragDropEffects.None;
64+
}
65+
}
66+
}

SmartImage.UI/SmartImage.UI.csproj

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>WinExe</OutputType>
5+
<TargetFramework>net7.0-windows</TargetFramework>
6+
<Nullable>enable</Nullable>
7+
<UseWPF>true</UseWPF>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<ProjectReference Include="..\SmartImage.Lib 3\SmartImage.Lib.csproj" />
12+
</ItemGroup>
13+
14+
<ItemGroup>
15+
<Reference Include="Kantan">
16+
<HintPath>..\..\..\VSProjects\Kantan\Kantan\bin\Release\net7.0\Kantan.dll</HintPath>
17+
</Reference>
18+
<Reference Include="Kantan.Net">
19+
<HintPath>..\..\..\VSProjects\Kantan\Kantan.Net\bin\Release\net7.0\Kantan.Net.dll</HintPath>
20+
</Reference>
21+
<Reference Include="Novus">
22+
<HintPath>..\..\..\VSProjects\Novus\Novus\bin\Release\net7.0\Novus.dll</HintPath>
23+
</Reference>
24+
</ItemGroup>
25+
26+
</Project>

SmartImage.sln

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SmartImage.App.Mobile", "Sm
1919
EndProject
2020
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SmartImage.App.Windows", "SmartImage.App\SmartImage.App.Windows\SmartImage.App.Windows.csproj", "{72109028-3FC1-45B1-929C-035CD11FB1C8}"
2121
EndProject
22-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SmartImage.Web", "SmartImage.Web\SmartImage.Web.csproj", "{B013A814-2267-4C4F-BB31-17BC5E8ECDC9}"
22+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SmartImage.UI", "SmartImage.UI\SmartImage.UI.csproj", "{61B417BC-1690-44F5-B52C-16A511D180B0}"
2323
EndProject
2424
Global
2525
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -205,30 +205,30 @@ Global
205205
{72109028-3FC1-45B1-929C-035CD11FB1C8}.Test|x86.ActiveCfg = Debug|x86
206206
{72109028-3FC1-45B1-929C-035CD11FB1C8}.Test|x86.Build.0 = Debug|x86
207207
{72109028-3FC1-45B1-929C-035CD11FB1C8}.Test|x86.Deploy.0 = Debug|x86
208-
{B013A814-2267-4C4F-BB31-17BC5E8ECDC9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
209-
{B013A814-2267-4C4F-BB31-17BC5E8ECDC9}.Debug|Any CPU.Build.0 = Debug|Any CPU
210-
{B013A814-2267-4C4F-BB31-17BC5E8ECDC9}.Debug|arm64.ActiveCfg = Debug|Any CPU
211-
{B013A814-2267-4C4F-BB31-17BC5E8ECDC9}.Debug|arm64.Build.0 = Debug|Any CPU
212-
{B013A814-2267-4C4F-BB31-17BC5E8ECDC9}.Debug|x64.ActiveCfg = Debug|Any CPU
213-
{B013A814-2267-4C4F-BB31-17BC5E8ECDC9}.Debug|x64.Build.0 = Debug|Any CPU
214-
{B013A814-2267-4C4F-BB31-17BC5E8ECDC9}.Debug|x86.ActiveCfg = Debug|Any CPU
215-
{B013A814-2267-4C4F-BB31-17BC5E8ECDC9}.Debug|x86.Build.0 = Debug|Any CPU
216-
{B013A814-2267-4C4F-BB31-17BC5E8ECDC9}.Release|Any CPU.ActiveCfg = Release|Any CPU
217-
{B013A814-2267-4C4F-BB31-17BC5E8ECDC9}.Release|Any CPU.Build.0 = Release|Any CPU
218-
{B013A814-2267-4C4F-BB31-17BC5E8ECDC9}.Release|arm64.ActiveCfg = Release|Any CPU
219-
{B013A814-2267-4C4F-BB31-17BC5E8ECDC9}.Release|arm64.Build.0 = Release|Any CPU
220-
{B013A814-2267-4C4F-BB31-17BC5E8ECDC9}.Release|x64.ActiveCfg = Release|Any CPU
221-
{B013A814-2267-4C4F-BB31-17BC5E8ECDC9}.Release|x64.Build.0 = Release|Any CPU
222-
{B013A814-2267-4C4F-BB31-17BC5E8ECDC9}.Release|x86.ActiveCfg = Release|Any CPU
223-
{B013A814-2267-4C4F-BB31-17BC5E8ECDC9}.Release|x86.Build.0 = Release|Any CPU
224-
{B013A814-2267-4C4F-BB31-17BC5E8ECDC9}.Test|Any CPU.ActiveCfg = Debug|Any CPU
225-
{B013A814-2267-4C4F-BB31-17BC5E8ECDC9}.Test|Any CPU.Build.0 = Debug|Any CPU
226-
{B013A814-2267-4C4F-BB31-17BC5E8ECDC9}.Test|arm64.ActiveCfg = Debug|Any CPU
227-
{B013A814-2267-4C4F-BB31-17BC5E8ECDC9}.Test|arm64.Build.0 = Debug|Any CPU
228-
{B013A814-2267-4C4F-BB31-17BC5E8ECDC9}.Test|x64.ActiveCfg = Debug|Any CPU
229-
{B013A814-2267-4C4F-BB31-17BC5E8ECDC9}.Test|x64.Build.0 = Debug|Any CPU
230-
{B013A814-2267-4C4F-BB31-17BC5E8ECDC9}.Test|x86.ActiveCfg = Debug|Any CPU
231-
{B013A814-2267-4C4F-BB31-17BC5E8ECDC9}.Test|x86.Build.0 = Debug|Any CPU
208+
{61B417BC-1690-44F5-B52C-16A511D180B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
209+
{61B417BC-1690-44F5-B52C-16A511D180B0}.Debug|Any CPU.Build.0 = Debug|Any CPU
210+
{61B417BC-1690-44F5-B52C-16A511D180B0}.Debug|arm64.ActiveCfg = Debug|Any CPU
211+
{61B417BC-1690-44F5-B52C-16A511D180B0}.Debug|arm64.Build.0 = Debug|Any CPU
212+
{61B417BC-1690-44F5-B52C-16A511D180B0}.Debug|x64.ActiveCfg = Debug|Any CPU
213+
{61B417BC-1690-44F5-B52C-16A511D180B0}.Debug|x64.Build.0 = Debug|Any CPU
214+
{61B417BC-1690-44F5-B52C-16A511D180B0}.Debug|x86.ActiveCfg = Debug|Any CPU
215+
{61B417BC-1690-44F5-B52C-16A511D180B0}.Debug|x86.Build.0 = Debug|Any CPU
216+
{61B417BC-1690-44F5-B52C-16A511D180B0}.Release|Any CPU.ActiveCfg = Release|Any CPU
217+
{61B417BC-1690-44F5-B52C-16A511D180B0}.Release|Any CPU.Build.0 = Release|Any CPU
218+
{61B417BC-1690-44F5-B52C-16A511D180B0}.Release|arm64.ActiveCfg = Release|Any CPU
219+
{61B417BC-1690-44F5-B52C-16A511D180B0}.Release|arm64.Build.0 = Release|Any CPU
220+
{61B417BC-1690-44F5-B52C-16A511D180B0}.Release|x64.ActiveCfg = Release|Any CPU
221+
{61B417BC-1690-44F5-B52C-16A511D180B0}.Release|x64.Build.0 = Release|Any CPU
222+
{61B417BC-1690-44F5-B52C-16A511D180B0}.Release|x86.ActiveCfg = Release|Any CPU
223+
{61B417BC-1690-44F5-B52C-16A511D180B0}.Release|x86.Build.0 = Release|Any CPU
224+
{61B417BC-1690-44F5-B52C-16A511D180B0}.Test|Any CPU.ActiveCfg = Debug|Any CPU
225+
{61B417BC-1690-44F5-B52C-16A511D180B0}.Test|Any CPU.Build.0 = Debug|Any CPU
226+
{61B417BC-1690-44F5-B52C-16A511D180B0}.Test|arm64.ActiveCfg = Debug|Any CPU
227+
{61B417BC-1690-44F5-B52C-16A511D180B0}.Test|arm64.Build.0 = Debug|Any CPU
228+
{61B417BC-1690-44F5-B52C-16A511D180B0}.Test|x64.ActiveCfg = Debug|Any CPU
229+
{61B417BC-1690-44F5-B52C-16A511D180B0}.Test|x64.Build.0 = Debug|Any CPU
230+
{61B417BC-1690-44F5-B52C-16A511D180B0}.Test|x86.ActiveCfg = Debug|Any CPU
231+
{61B417BC-1690-44F5-B52C-16A511D180B0}.Test|x86.Build.0 = Debug|Any CPU
232232
EndGlobalSection
233233
GlobalSection(SolutionProperties) = preSolution
234234
HideSolutionNode = FALSE

0 commit comments

Comments
 (0)