1.    13 Dec 2016 #1
    Join Date : Dec 2016
    Posts : 7
    Windows 10 Desktop

    C# opens a image in Windows 10 but NOT able to navigate to next image


    Hi All,
    Could you please help

    My Environment: Windows 10 Operating system in Desktop machine

    My purpose: I have a "Sample_Pictures" folder in "My Documents" folder, this "Sample_Pictures" folder contains 5 pictures. I need to open an image (using C# console application) and then navigate to Next and Previous image in "Sample_Pictures" folder

    Issue I am facing: I am able to open an image, but NOT able to navigate to Next and Previous pictures in folder. Both Next and Previous buttons are disabled. I mean the Next and Previous buttons present in image is NOT working in Windows 10 Photos. However If I open the same image separately in Windows Explorer, I am able to navigate to Next and Previous image.

    Sample Program:

    static void Main(string[] args)
    {
    OpenSamplePhoto();
    }

    private static void OpenSamplePhoto()
    {
    string samplePicturesPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Sample_Pictures");

    string picturePath = Path.Combine(samplePicturesPath,"sample1.JPG");

    ProcessStartInfo info = new ProcessStartInfo();

    info.FileName = picturePath;
    info.UseShellExecute = true;
    info.CreateNoWindow = true;
    info.Verb = string.Empty; Process.Start(info);
    }
    Last edited by Obuliraj; 13 Dec 2016 at 15:06. Reason: Text formatting
      My ComputerSystem Spec
  2.    13 Dec 2016 #2

    Post your project folder (zipped) - the code you posted has no reference to "buttons"
      My ComputerSystem Spec
  3.    13 Dec 2016 #3
    Join Date : Dec 2016
    Posts : 7
    Windows 10 Desktop
    Thread Starter

    Hi Superfly,
    Thanks for the quick reply.

    Issue I am facing: I am able to open an image, but NOT able to navigate to Next and Previous pictures in folder. Both Next and Previous buttons are disabled. I mean the Next and Previous buttons present in image is NOT working in Windows 10 Photos. However If I open the same image separately in Windows Explorer, I am able to navigate to Next and Previous image.

    I have also updated the post.
    Thanks
      My ComputerSystem Spec
  4.    13 Dec 2016 #4

    It won't as you are not opening the app from the shell which sets the picture folder as container- you are using the (default) app to open a single image.
      My ComputerSystem Spec
  5.    13 Dec 2016 #5
    Join Date : Dec 2016
    Posts : 7
    Windows 10 Desktop
    Thread Starter

    Quote Originally Posted by Superfly View Post
    It won't as you are not opening the app from the shell which sets the picture folder as container- you are using the (default) app to open a single image.
    ---------
    Could you please provide some sample C# code to launch picture in Shell.
    Thanks,
      My ComputerSystem Spec
  6.    13 Dec 2016 #6

    I'll look into it... with Win32 apps one would PInvoke the API and pass the file path to it to launch the app with the image as t would with explorer - but this UWP stuff is still new to me, so I'm not so sure...
      My ComputerSystem Spec
  7.    13 Dec 2016 #7
    Join Date : Dec 2016
    Posts : 7
    Windows 10 Desktop
    Thread Starter

    Hi Superfly,
    Thanks a lot for your time.

    I am also searching about Universal Windows Platform (UWP),

    If I find any solution, I will post immediately.

    Thanks again.
      My ComputerSystem Spec
  8.    13 Dec 2016 #8
    Join Date : Dec 2016
    Posts : 7
    Windows 10 Desktop
    Thread Starter

    ms-photos


    I found below code to open Photo App, however I am not able to open a specific image.
    I am working on to find a complete solution.

    private static void OpenSamplePhoto()
    {
    string samplePicturesPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Sample_Pictures");

    string picturePath = Path.Combine(samplePicturesPath, "sample1.JPG");


    ProcessStartInfo info = new ProcessStartInfo();
    info.FileName = @"ms-photos://";
    info.Arguments = picturePath;
    info.UseShellExecute = true;
    info.CreateNoWindow = true;
    info.Verb = string.Empty;


    Process.Start(info);
    }

    Reference:Open the photo with microsoft photos (Windows 10) in C #
    Last edited by Obuliraj; 13 Dec 2016 at 17:11. Reason: Formatted the sample code
      My ComputerSystem Spec

 


Similar Threads
Thread Forum
Installation & Upgrade System Image - Create Hardware Independent System Image
How to Create Hardware Independent System Image for Installing Windows 10 In this tutorial we will prepare a Windows 10 image customizing the default user profile and install software we want to include in a clean Windows installation. When...
Tutorials
Windows 10 image
Hi, I have been having terrible luck with computers the last couple of years. Had a great Asus zenbook, backing up all the time on an Iomega black belt, zenbook died, so did the Iomega. Lost everything...a lifetime of photos, docs, etc. The...
Backup and Restore
Name of image on lock screen image
Why doesn't Windows provide the location of the spotlight lock screen image? I really wish they would. Any one else see an image and wonder the physical location of the image?
General Support
Problems while selecting any image for background, user image etc.
Hi, Whenever I wanted to select any image for the background, user account etc., the file explorer window which opens up get hidden, before I can do anything and it don't even let me do anything where I was. It doesn't happen every time, but it's...
Customization
W10 Disk Image Utility Reports Error After Image Creation.
I installed the 32 bit version of W10 on an old Acer laptop to get back up to speed with developments, and one of the first questions or issues that cropped up is when using W10's disk image utility to make a system image. I deliberately wished to...
General Support
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 21:09.
Find Us
Twitter Facebook Google+ Ten Forums iOS App Ten Forums Android App



Windows 10 Forums