File tree 3 files changed +35
-11
lines changed
3 files changed +35
-11
lines changed Original file line number Diff line number Diff line change 2
2
// Licensed under the MIT License. See the LICENSE.
3
3
4
4
using Microsoft . UI . Xaml . Controls ;
5
+ using System . Runtime . InteropServices ;
5
6
using Windows . ApplicationModel . DataTransfer ;
6
7
7
8
namespace Files . App . Data . Models
@@ -35,11 +36,18 @@ public int TabStripSelectedIndex
35
36
{
36
37
SetProperty ( ref _TabStripSelectedIndex , value ) ;
37
38
38
- if ( value >= 0 && value < MainPageViewModel . AppInstances . Count )
39
+ try
39
40
{
40
- var rootFrame = ( Frame ) MainWindow . Instance . Content ;
41
- var mainView = ( MainPage ) rootFrame . Content ;
42
- mainView . ViewModel . SelectedTabItem = MainPageViewModel . AppInstances [ value ] ;
41
+ if ( value >= 0 && value < MainPageViewModel . AppInstances . Count )
42
+ {
43
+ var rootFrame = ( Frame ) MainWindow . Instance . Content ;
44
+ var mainView = ( MainPage ) rootFrame . Content ;
45
+ mainView . ViewModel . SelectedTabItem = MainPageViewModel . AppInstances [ value ] ;
46
+ }
47
+ }
48
+ catch ( COMException )
49
+ {
50
+
43
51
}
44
52
}
45
53
}
Original file line number Diff line number Diff line change 8
8
using Microsoft . UI . Xaml . Controls ;
9
9
using Microsoft . UI . Xaml . Controls . Primitives ;
10
10
using Microsoft . UI . Xaml . Input ;
11
+ using System . Runtime . InteropServices ;
11
12
using Windows . System ;
12
13
using Windows . UI . Core ;
13
14
using Windows . Win32 ;
@@ -276,12 +277,19 @@ protected virtual async Task CommitRenameAsync(TextBox textBox)
276
277
277
278
protected virtual async void RenameTextBox_LostFocus ( object sender , RoutedEventArgs e )
278
279
{
279
- // This check allows the user to use the text box context menu without ending the rename
280
- if ( ! ( FocusManager . GetFocusedElement ( MainWindow . Instance . Content . XamlRoot ) is AppBarButton or Popup ) )
280
+ try
281
281
{
282
- TextBox textBox = ( TextBox ) e . OriginalSource ;
283
- await CommitRenameAsync ( textBox ) ;
282
+ // This check allows the user to use the text box context menu without ending the rename
283
+ if ( ! ( FocusManager . GetFocusedElement ( MainWindow . Instance . Content . XamlRoot ) is AppBarButton or Popup ) )
284
+ {
285
+ TextBox textBox = ( TextBox ) e . OriginalSource ;
286
+ await CommitRenameAsync ( textBox ) ;
287
+ }
284
288
}
289
+ catch ( COMException )
290
+ {
291
+
292
+ }
285
293
}
286
294
287
295
// Methods
Original file line number Diff line number Diff line change 9
9
using Microsoft . UI . Xaml . Media . Animation ;
10
10
using Microsoft . UI . Xaml . Navigation ;
11
11
using System . Runtime . CompilerServices ;
12
+ using System . Runtime . InteropServices ;
12
13
using Windows . Foundation . Metadata ;
13
14
using Windows . System ;
14
15
using Windows . UI . Core ;
@@ -756,10 +757,17 @@ protected void SelectSidebarItemFromPath(Type incomingSourcePageType = null)
756
757
757
758
protected void SetLoadingIndicatorForTabs ( bool isLoading )
758
759
{
759
- var multitaskingControls = ( ( MainWindow . Instance . Content as Frame ) . Content as MainPage ) . ViewModel . MultitaskingControls ;
760
+ try
761
+ {
762
+ var multitaskingControls = ( ( MainWindow . Instance . Content as Frame ) . Content as MainPage ) . ViewModel . MultitaskingControls ;
760
763
761
- foreach ( var x in multitaskingControls )
762
- x . SetLoadingIndicatorStatus ( x . Items . FirstOrDefault ( x => x . TabItemContent == PaneHolder ) , isLoading ) ;
764
+ foreach ( var x in multitaskingControls )
765
+ x . SetLoadingIndicatorStatus ( x . Items . FirstOrDefault ( x => x . TabItemContent == PaneHolder ) , isLoading ) ;
766
+ }
767
+ catch ( COMException )
768
+ {
769
+
770
+ }
763
771
}
764
772
765
773
// WINUI3
You can’t perform that action at this time.
0 commit comments