4444
4545namespace SmartImage
4646{
47+ // ____ _ ___
48+ // / ___| _ __ ___ __ _ _ __| |_|_ _|_ __ ___ __ _ __ _ ___
49+ // \___ \| '_ ` _ \ / _` | '__| __|| || '_ ` _ \ / _` |/ _` |/ _ \
50+ // ___) | | | | | | (_| | | | |_ | || | | | | | (_| | (_| | __/
51+ // |____/|_| |_| |_|\__,_|_| \__|___|_| |_| |_|\__,_|\__, |\___|
52+ // |___/
53+
4754 public static class Program
4855 {
49- // ____ _ ___
50- // / ___| _ __ ___ __ _ _ __| |_|_ _|_ __ ___ __ _ __ _ ___
51- // \___ \| '_ ` _ \ / _` | '__| __|| || '_ ` _ \ / _` |/ _` |/ _ \
52- // ___) | | | | | | (_| | | | |_ | || | | | | | (_| | (_| | __/
53- // |____/|_| |_| |_|\__,_|_| \__|___|_| |_| |_|\__,_|\__, |\___|
54- // |___/
55-
5656 #region Core fields
5757
5858 public static readonly SearchConfig Config = new ( ) ;
@@ -62,7 +62,7 @@ public static class Program
6262 public static readonly NConsoleDialog ResultDialog = new ( )
6363 {
6464 Options = new List < NConsoleOption > ( ) ,
65- Description = AppInterface . Description
65+ Description = InterfaceElements . Description
6666 } ;
6767
6868 #endregion
@@ -87,7 +87,7 @@ private static async Task Main(string[] args)
8787 * Register events
8888 */
8989
90- ToastNotificationManagerCompat . OnActivated += AppToast . OnActivated ;
90+ ToastNotificationManagerCompat . OnActivated += AppInterface . OnToastActivated ;
9191
9292 Native . SetConsoleOutputCP ( Native . CP_IBM437 ) ;
9393
@@ -114,8 +114,7 @@ private static async Task Main(string[] args)
114114 return ;
115115
116116
117- try
118- {
117+ try {
119118
120119 CancellationTokenSource cts = new ( ) ;
121120
@@ -126,22 +125,21 @@ private static async Task Main(string[] args)
126125
127126 Client . SearchCompleted += ( obj , eventArgs ) => OnSearchCompleted ( obj , eventArgs , cts ) ;
128127
129- Client . ExtraResults += AppToast . Show ;
128+ Client . ExtraResults += AppInterface . ShowToast ;
130129
131130 NConsoleProgress . Queue ( cts ) ;
132131
133132 // Show results
134133 var searchTask = Client . RunSearchAsync ( ) ;
135134
136135 // Add original image
137- ResultDialog . Options . Add ( AppInterface . CreateResultOption (
136+ ResultDialog . Options . Add ( InterfaceElements . CreateResultOption (
138137 Config . Query . GetImageResult ( ) , "(Original image)" ,
139- AppInterface . ColorMain , - 0.1f ) ) ;
138+ InterfaceElements . ColorMain , - 0.1f ) ) ;
140139
141140
142141 NConsole . ReadOptions ( ResultDialog ) ;
143142
144-
145143 await searchTask ;
146144 }
147145 catch ( Exception exception ) {
@@ -156,7 +154,7 @@ private static async Task Main(string[] args)
156154 private static bool HandleArguments ( string [ ] args )
157155 {
158156 if ( ! args . Any ( ) ) {
159- var options = NConsole . ReadOptions ( AppInterface . MainMenuDialog ) ;
157+ HashSet < object > options = NConsole . ReadOptions ( AppInterface . MainMenuDialog ) ;
160158
161159 if ( ! options . Any ( ) ) {
162160 return true ;
@@ -183,13 +181,13 @@ private static bool HandleArguments(string[] args)
183181
184182 var imageResults = directImages . Select ( ImageResult . FromDirectImage ) ;
185183
186- var directOptions = AppInterface . CreateResultOptions ( imageResults , "Image" ) ;
184+ var directOptions = InterfaceElements . CreateResultOptions ( imageResults , "Image" ) ;
187185
188186
189187 NConsole . ReadOptions ( new NConsoleDialog
190188 {
191189 Options = directOptions ,
192- Description = AppInterface . Description
190+ Description = InterfaceElements . Description
193191 } ) ;
194192
195193 return true ;
@@ -215,12 +213,11 @@ private static bool HandleArguments(string[] args)
215213
216214 private static void OnSearchCompleted ( object ? sender , List < SearchResult > eventArgs , CancellationTokenSource cts )
217215 {
218- AppInterface . FlashConsoleWindow ( ) ;
216+ Native . FlashConsoleWindow ( ) ;
219217
220218 cts . Cancel ( ) ;
221219 cts . Dispose ( ) ;
222220
223-
224221 SystemSounds . Exclamation . Play ( ) ;
225222
226223 }
@@ -230,7 +227,7 @@ private static void OnResultCompleted(object? sender, SearchResultEventArgs even
230227 {
231228 var result = eventArgs . Result ;
232229
233- var option = AppInterface . CreateResultOption ( result ) ;
230+ var option = InterfaceElements . CreateResultOption ( result ) ;
234231
235232 bool ? isFiltered = eventArgs . IsFiltered ;
236233
0 commit comments