1- using System . Diagnostics ;
1+ using ImgurSniper . UI . Properties ;
2+ using System . Diagnostics ;
23using System . Windows ;
34using System . Windows . Controls ;
45using System . Windows . Input ;
5- using ImgurSniper . UI . Properties ;
66using Application = System . Windows . Application ;
77
88namespace ImgurSniper . UI . Pages . SettingsPages {
@@ -20,10 +20,10 @@ public OtherPage() {
2020 }
2121
2222 private async void Load ( ) {
23- _window . ShowProgressIndicator ( ) ;
23+ _window ? . ShowProgressIndicator ( ) ;
2424
2525 //Update Loading Indicator
26- _window . SetProgressStatus ( strings . loadConf ) ;
26+ _window ? . SetProgressStatus ( strings . loadConf ) ;
2727
2828 try {
2929 Settings settings = ConfigHelper . JsonConfig ;
@@ -71,16 +71,18 @@ await Dialog.ShowOkDialog(strings.couldNotLoad,
7171 }
7272
7373 //Search for Updates
74- _window . SetProgressStatus ( strings . checkingUpdate ) ;
75- BtnUpdate . IsEnabled = await InstallerHelper . CheckForUpdates ( _window , false ) ;
74+ if ( _window != null ) {
75+ _window . SetProgressStatus ( strings . checkingUpdate ) ;
76+ BtnUpdate . IsEnabled = await InstallerHelper . CheckForUpdates ( _window , false ) ;
77+ }
7678
7779 //Remove Loading Indicator
78- _window . HideProgressIndicator ( ) ;
80+ _window ? . HideProgressIndicator ( ) ;
7981 }
8082
8183
8284 #region UI
83- private void Update ( object sender , RoutedEventArgs e ) { _window . Update ( sender , e ) ; }
85+ private void Update ( object sender , RoutedEventArgs e ) { _window ? . Update ( sender , e ) ; }
8486
8587 private async void RunOnBoot_Checkbox ( object sender , RoutedEventArgs e ) {
8688 if ( sender is CheckBox box ) {
@@ -110,12 +112,12 @@ private async void Btn_SearchUpdates(object sender, RoutedEventArgs e) {
110112 }
111113
112114 //Show Progress Indicator
113- _window . ShowProgressIndicator ( ) ;
115+ _window ? . ShowProgressIndicator ( ) ;
114116
115117 BtnUpdate . IsEnabled = await InstallerHelper . CheckForUpdates ( _window , true ) ;
116118
117119 //Hide Progress Indicator
118- _window . HideProgressIndicator ( ) ;
120+ _window ? . HideProgressIndicator ( ) ;
119121
120122 if ( btn != null ) {
121123 btn . IsEnabled = true ;
@@ -255,7 +257,7 @@ private async void LanguageBox_SelectionChanged(object sender, SelectionChangedE
255257
256258 private void EnableSave ( ) {
257259 try {
258- _window . EnableSave ( ) ;
260+ _window ? . EnableSave ( ) ;
259261 } catch {
260262 // no parent found
261263 }
0 commit comments