2323using System . Windows ;
2424using System . Windows . Input ;
2525using System . Windows . Media . Animation ;
26+ using Wpf . Ui . Violeta . Controls ;
2627using Brush = System . Windows . Media . Brush ;
2728using FontFamily = System . Windows . Media . FontFamily ;
2829using Size = System . Windows . Size ;
@@ -41,7 +42,7 @@ public partial class ViewerWindow : Window
4142 internal ViewerWindow ( )
4243 {
4344 // this object should be initialized before loading UI components, because many of which are binding to it.
44- ContextObject = new ContextObject ( ) ;
45+ ContextObject = new ContextObject ( ) { Source = this } ;
4546
4647 ContextObject . PropertyChanged += ContextObject_PropertyChanged ;
4748
@@ -53,49 +54,53 @@ internal ViewerWindow()
5354
5455 SizeChanged += SaveWindowSizeOnSizeChanged ;
5556
56- StateChanged += ( sender , e ) => _ignoreNextWindowSizeChange = true ;
57+ StateChanged += ( _ , _ ) => _ignoreNextWindowSizeChange = true ;
5758
5859 windowFrameContainer . PreviewMouseMove += ShowWindowCaptionContainer ;
5960
6061 Topmost = SettingHelper . Get ( "Topmost" , false ) ;
6162 buttonTop . Tag = Topmost ? "Top" : "Auto" ;
6263
63- buttonTop . Click += ( sender , e ) =>
64+ buttonTop . Click += ( _ , _ ) =>
6465 {
6566 Topmost = ! Topmost ;
6667 SettingHelper . Set ( "Topmost" , Topmost ) ;
6768 buttonTop . Tag = Topmost ? "Top" : "Auto" ;
6869 } ;
6970
70- buttonPin . Click += ( sender , e ) =>
71+ buttonPin . Click += ( _ , _ ) =>
7172 {
7273 if ( Pinned )
74+ {
75+ TranslationHelper . Get ( "Icon_Quit" ) ;
76+ Toast . Information ( "Cancellation of Prevent Closing is not supported" ) ;
7377 return ;
78+ }
7479
7580 ViewWindowManager . GetInstance ( ) . ForgetCurrentWindow ( ) ;
7681 } ;
7782
78- buttonCloseWindow . Click += ( sender , e ) =>
83+ buttonCloseWindow . Click += ( _ , _ ) =>
7984 {
8085 if ( Pinned )
8186 Close ( ) ;
8287 else
8388 ViewWindowManager . GetInstance ( ) . ClosePreview ( ) ;
8489 } ;
8590
86- buttonOpen . Click += ( sender , e ) =>
91+ buttonOpen . Click += ( _ , _ ) =>
8792 {
8893 if ( Pinned )
8994 RunAndClose ( ) ;
9095 else
9196 ViewWindowManager . GetInstance ( ) . RunAndClosePreview ( ) ;
9297 } ;
9398
94- buttonWindowStatus . Click += ( sender , e ) =>
99+ buttonWindowStatus . Click += ( _ , _ ) =>
95100 WindowState = WindowState == WindowState . Maximized ? WindowState . Normal : WindowState . Maximized ;
96101
97- buttonShare . Click += ( sender , e ) => ShareHelper . Share ( _path , this ) ;
98- buttonOpenWith . Click += ( sender , e ) => ShareHelper . Share ( _path , this , true ) ;
102+ buttonShare . Click += ( _ , _ ) => ShareHelper . Share ( _path , this ) ;
103+ buttonOpenWith . Click += ( _ , _ ) => ShareHelper . Share ( _path , this , true ) ;
99104
100105 // Set UI translations
101106 buttonTop . ToolTip = TranslationHelper . Get ( "MW_StayTop" ) ;
0 commit comments