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


  1. Posts : 7
    Windows 10 Desktop
       #1

    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 14:06. Reason: Text formatting
      My Computer

  2. Superfly's Avatar
    Posts : 3,337
       #2

    Post your project folder (zipped) - the code you posted has no reference to "buttons"
      My Computer


  3. Posts : 7
    Windows 10 Desktop
    Thread Starter
       #3

    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 Computer

  4. Superfly's Avatar
    Posts : 3,337
       #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 Computer


  5. Posts : 7
    Windows 10 Desktop
    Thread Starter
       #5

    Superfly said:
    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 Computer

  6. Superfly's Avatar
    Posts : 3,337
       #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 Computer


  7. Posts : 7
    Windows 10 Desktop
    Thread Starter
       #7

    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 Computer


  8. Posts : 7
    Windows 10 Desktop
    Thread Starter
       #8

    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 16:11. Reason: Formatted the sample code
      My Computer


 

  Related Discussions
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 03:29.
Find Us




Windows 10 Forums