Skip to content

Commit

Permalink
Fix Duplicated Refresh Bug
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeblevins committed May 11, 2019
1 parent a111058 commit 228b462
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 14 deletions.
4 changes: 3 additions & 1 deletion ExecutableLauncher/Program.cs
Expand Up @@ -13,9 +13,11 @@ private static void Main(string[] args)
var executable = (string)ApplicationData.Current.LocalSettings.Values["Application"];
Process.Start(executable);
}
catch (Exception e)
catch (System.ComponentModel.Win32Exception e)
{
Console.WriteLine("While most executables work now, UWP restrictions still prevent the execution of this file");
Console.WriteLine(e.Message);
Console.WriteLine(e.StackTrace);
Console.ReadLine();
}
}
Expand Down
12 changes: 2 additions & 10 deletions Files UWP/Filesystem/ItemViewModel.cs
Expand Up @@ -215,16 +215,8 @@ public async void AddItemsToCollectionAsync(string path, Page currentPage)

_cancellationTokenSource = new CancellationTokenSource();

if (typeof(PageType) == typeof(GenericFileBrowser))
{
(currentPage as GenericFileBrowser).emptyTextGFB.Visibility = Visibility.Collapsed;
_filesAndFolders.Clear();
}
else if (typeof(PageType) == typeof(PhotoAlbum))
{
(currentPage as PhotoAlbum).EmptyTextPA.Visibility = Visibility.Collapsed;
_filesAndFolders.Clear();
}
GetCurrentSelectedTabInstance<ProHome>().TextState.isVisible = Visibility.Collapsed;
_filesAndFolders.Clear();
Universal.path = path;

Stopwatch stopwatch = new Stopwatch();
Expand Down
1 change: 0 additions & 1 deletion Files UWP/GenericFileBrowser.xaml.cs
Expand Up @@ -105,7 +105,6 @@ protected override void OnNavigatedTo(NavigationEventArgs eventArgs)
var parameters = (string)eventArgs.Parameter;
instanceViewModel.CancelLoadAndClearFiles();
instanceViewModel.Universal.path = parameters;
CurrentInstance.RefreshButton.Click += NavigationActions.Refresh_Click;
CurrentInstance.AddItemButton.Click += AddItem_Click;
instanceViewModel.AddItemsToCollectionAsync(instanceViewModel.Universal.path, this);
TextState_PropertyChanged(null, null);
Expand Down
3 changes: 1 addition & 2 deletions Files UWP/ProHome.xaml.cs
Expand Up @@ -89,6 +89,7 @@ public ProHome()
PopulateNavViewWithExternalDrives();
BackButton.Click += NavigationActions.Back_Click;
ForwardButton.Click += NavigationActions.Forward_Click;
RefreshButton.Click += NavigationActions.Refresh_Click;
ribbonShadow.Receivers.Add(RibbonShadowSurface);
Ribbon.Translation += new System.Numerics.Vector3(0, 0, 4);

Expand Down Expand Up @@ -806,14 +807,12 @@ public async static void Refresh_Click(object sender, RoutedEventArgs e)
{
var ContentOwnedViewModelInstance = (ItemViewModel<ProHome>.GetCurrentSelectedTabInstance<ProHome>().accessibleContentFrame.Content as GenericFileBrowser).instanceViewModel;
ContentOwnedViewModelInstance.CancelLoadAndClearFiles();
(ItemViewModel<ProHome>.GetCurrentSelectedTabInstance<ProHome>().accessibleContentFrame.Content as GenericFileBrowser).emptyTextGFB.Visibility = Visibility.Collapsed;
ContentOwnedViewModelInstance.AddItemsToCollectionAsync(ContentOwnedViewModelInstance.Universal.path, (ItemViewModel<ProHome>.GetCurrentSelectedTabInstance<ProHome>().accessibleContentFrame.Content as GenericFileBrowser).GFBPageName);
}
else if ((ItemViewModel<ProHome>.GetCurrentSelectedTabInstance<ProHome>().accessibleContentFrame.Content as PhotoAlbum) != null)
{
var ContentOwnedViewModelInstance = (ItemViewModel<ProHome>.GetCurrentSelectedTabInstance<ProHome>().accessibleContentFrame.Content as PhotoAlbum).instanceViewModel;
ContentOwnedViewModelInstance.CancelLoadAndClearFiles();
(ItemViewModel<ProHome>.GetCurrentSelectedTabInstance<ProHome>().accessibleContentFrame.Content as PhotoAlbum).EmptyTextPA.Visibility = Visibility.Collapsed;
ContentOwnedViewModelInstance.AddItemsToCollectionAsync(ContentOwnedViewModelInstance.Universal.path, (ItemViewModel<ProHome>.GetCurrentSelectedTabInstance<ProHome>().accessibleContentFrame.Content as PhotoAlbum).PAPageName);
}
Expand Down

0 comments on commit 228b462

Please sign in to comment.