Skip to content

Commit

Permalink
fixed images not loading when using startup arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
Henrik-Peters committed Jul 28, 2017
1 parent 05ca366 commit 0d0fbce
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions ActivFlex Media/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
// along with this program. If not, see<http://www.gnu.org/licenses/>.
#endregion
using System;
using System.Linq;
using System.Windows;
using System.Windows.Input;
using System.Diagnostics;
Expand Down Expand Up @@ -205,9 +206,17 @@ private void HandleStartupArguments()
ChangeFullscreenMode(true);
Window_StateChanged(this, null);

//Browse to the directory of the first image
vm.BrowseFileSystem.Execute(GetParentPath(StartupOptions.ImagePaths[0]));

if (StartupOptions.ImagePaths.Count == 1) {
//Single image provided
vm.PresentImage.Execute(new MediaImage(StartupOptions.ImagePaths[0]));
MediaImage firstImage = vm.FileSystemItems
.Where(item => item.Path == StartupOptions.ImagePaths[0])
.Cast<MediaImage>()
.First();

vm.LaunchPresenter.Execute(firstImage);

} else {
//Multiple images provided
Expand All @@ -220,9 +229,6 @@ private void HandleStartupArguments()
vm.PresentImage.Execute(new MediaImage(StartupOptions.ImagePaths[0]));
}

//Browse to the directory of the first image
vm.BrowseFileSystem.Execute(GetParentPath(StartupOptions.ImagePaths[0]));

} else if (StartupOptions.DirectoryPaths.Count == 1) {
//Single directory and no images provided
vm.BrowseFileSystem.Execute(StartupOptions.DirectoryPaths[0]);
Expand Down

0 comments on commit 0d0fbce

Please sign in to comment.