Skip to content

Commit ed01192

Browse files
committed
...
1 parent 1b66bef commit ed01192

File tree

80 files changed

+51
-74450
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+51
-74450
lines changed

SmartImage.UI/MainWindow.xaml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,31 @@
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
44
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
55
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6-
xmlns:local="clr-namespace:SmartImage.UI"
6+
xmlns:local="clr-namespace:SmartImage.UI" xmlns:results="clr-namespace:SmartImage.Lib.Results;assembly=SmartImage.Lib" d:DataContext="{d:DesignInstance Type=results:SearchResult}"
77
mc:Ignorable="d"
88
Title="MainWindow" Height="450" Width="800">
99
<Grid>
1010
<TextBox x:Name="Tb_Input" HorizontalAlignment="Left" Margin="10,34,0,0"
1111
TextWrapping="Wrap" VerticalAlignment="Top" Width="300" Height="20" TextChanged="Tb_Input_TextChanged"
1212
AllowDrop="True" Drop="Tb_Input_OnDrop" PreviewDrop="Tb_Input_Drop" PreviewDragOver="Tb_Input_DragOver"/>
13-
<Button x:Name="Btn_Run" Content="Run" HorizontalAlignment="Left" Margin="315,34,0,0" VerticalAlignment="Top" Width="40"/>
13+
<Button x:Name="Btn_Run" Content="Run" HorizontalAlignment="Left" Margin="315,34,0,0" VerticalAlignment="Top" Width="40" Click="Btn_Run_Click"/>
1414
<Button x:Name="Btn_Browse" Content="Browse" HorizontalAlignment="Left" Margin="360,34,0,0" VerticalAlignment="Top" Width="50"/>
15-
<ListBox x:Name="Lb_Res" d:ItemsSource="{d:SampleData ItemCount=5}" Height="NaN" Margin="0,256,0,0"
16-
ItemsSource="{Binding }">
15+
<ListBox x:Name="Lb_Res" Height="NaN" Margin="0,256,0,0" ItemsSource="{Binding Results}">
1716
<ListBox.ItemTemplate>
1817
<DataTemplate>
19-
<TextBlock Text="{Binding Name}"/>
18+
<StackPanel>
19+
<TextBlock Text="{Binding Path=Url}" />
20+
<TextBlock Text="{Binding Path=Description}" />
21+
<TextBlock Text="{Binding Path=Source}" />
22+
</StackPanel>
2023
</DataTemplate>
2124
</ListBox.ItemTemplate>
22-
</ListBox>
25+
</ListBox>
2326
<Image x:Name="Img_Query" HorizontalAlignment="Right" Height="120" Margin="0,10,10,0" VerticalAlignment="Top" Width="200"/>
2427
<Button x:Name="Btn_Clear" Content="Clear" HorizontalAlignment="Left" Margin="315,59,0,0" VerticalAlignment="Top" Width="40" Click="Btn_Clear_Click"/>
2528
<Label x:Name="Lbl_Input" Content="Input" HorizontalAlignment="Left" Margin="10,3,0,0" VerticalAlignment="Top" FontWeight="Bold"/>
2629
<ProgressBar x:Name="Pbr_Input" HorizontalAlignment="Left" Height="10" Margin="10,59,0,0" VerticalAlignment="Top" Width="100"/>
2730

2831
</Grid>
32+
2933
</Window>

SmartImage.UI/MainWindow.xaml.cs

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Collections.ObjectModel;
34
using System.Linq;
45
using System.Text;
56
using System.Threading.Tasks;
@@ -14,6 +15,7 @@
1415
using System.Windows.Navigation;
1516
using System.Windows.Shapes;
1617
using SmartImage.Lib;
18+
using SmartImage.Lib.Results;
1719

1820
namespace SmartImage.UI;
1921

@@ -26,13 +28,29 @@ public MainWindow()
2628
{
2729
InitializeComponent();
2830
// Tb_Input.AllowDrop = true;
29-
m_sc = new SearchClient(SearchConfig.Default);
30-
m_query = SearchQuery.Null;
31+
m_sc = new SearchClient(SearchConfig.Default);
32+
m_query = SearchQuery.Null;
33+
m_result = new ResultItem();
3134

35+
m_sc.OnResult += (sender, result) =>
36+
{
37+
Results.Add(result);
38+
};
39+
40+
/*Binding binding = new Binding();
41+
binding.Source = this;
42+
PropertyPath path = new PropertyPath(nameof(Results));
43+
binding.Path = path;
44+
45+
// Setup binding:
46+
BindingOperations.SetBinding(this.Lb_Res, ListBox.ItemsSourceProperty, binding);*/
3247
}
3348

3449
private SearchClient m_sc;
3550
private SearchQuery m_query;
51+
private ResultItem m_result;
52+
53+
public static ObservableCollection<SearchResult> Results { get; set; } = new ObservableCollection<SearchResult>();
3654

3755
private void Tb_Input_TextChanged(object sender, TextChangedEventArgs e) { }
3856

@@ -51,11 +69,16 @@ private async void Tb_Input_Drop(object sender, DragEventArgs e)
5169

5270
private async Task SetInput(string v)
5371
{
54-
Tb_Input.Text = v;
72+
Tb_Input.Text = v;
73+
Btn_Run.IsEnabled = false;
5574

5675
m_query = await SearchQuery.TryCreateAsync(v);
5776

5877
Img_Query.Source = new BitmapImage(new Uri(m_query.Uni.Value.ToString()));
78+
79+
await m_query.UploadAsync();
80+
Btn_Run.IsEnabled = true;
81+
5982
}
6083

6184
private void Tb_Input_DragOver(object sender, DragEventArgs e)
@@ -76,28 +99,9 @@ private void Btn_Clear_Click(object sender, RoutedEventArgs e)
7699
m_query.Dispose();
77100
}
78101

79-
private void Btn_Run_Click(object sender, RoutedEventArgs e)
102+
private async void Btn_Run_Click(object sender, RoutedEventArgs e)
80103
{
81104
// Lb_Res.Items[0] = new Image();
82-
Lb_Res.Items[0] = new ListBoxItem()
83-
{ };
84-
}
85-
86-
public class MovieData
87-
{
88-
private string _Title;
89-
public string Title
90-
{
91-
get { return this._Title; }
92-
set { this._Title = value; }
93-
}
94-
95-
private BitmapImage _ImageData;
96-
public BitmapImage ImageData
97-
{
98-
get { return this._ImageData; }
99-
set { this._ImageData = value; }
100-
}
101-
105+
await m_sc.RunSearchAsync(m_query);
102106
}
103-
}
107+
}

SmartImage.UI/ResultItem.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Read ​​ SmartImage.UI ResultItem.cs
2+
// 2023-04-28 @ 6:49 PM
3+
4+
using System.Collections.ObjectModel;
5+
using System.Windows;
6+
using SmartImage.Lib.Results;
7+
8+
namespace SmartImage.UI;
9+
10+
public class ResultItem
11+
{
12+
}

SmartImage.Web/Models/ResultItem.cs

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

SmartImage.Web/Pages/Error.cshtml

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

SmartImage.Web/Pages/Error.cshtml.cs

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

SmartImage.Web/Pages/Index.cshtml

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

SmartImage.Web/Pages/Index.cshtml.cs

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

SmartImage.Web/Pages/Privacy.cshtml

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

SmartImage.Web/Pages/Privacy.cshtml.cs

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

0 commit comments

Comments
 (0)