3
Reply

How to Display image from network in wpf

muhsin muhsin

muhsin muhsin

13y
5.5k
0
Reply

    Thank you all for trying to help ------

    I solved the problem and  Here is my final code

    try

    {

    LoginPage login=new LoginPage();

    BitmapImage DriverPhoto=new BitmapImage();

    DriverPhoto.BeginInit();

    DriverPhoto.UriSource =new Uri(@"\\"+login.ServerName+"\\Photos\\MyPhoto.jpg");

    DriverPhoto.EndInit();

    DriverImageControl.Source=DriverPhoto;

    }

    catch(System.Exception ex)

    {

    System.Windows.MessageBox.Show(ex.Message);

    }

    Check you path which you are sharing first. If are using peer to peer network then should not have any problem.Then check you code. Try Msdn library. Type your answer then see answer you I get most of answer either from or Msdn library. Also try  microsoft technet for developer.

     

    Hi.....

    I have two  computers connected in peer to peer

    one computer named 'City' has a shared folder called 'Photos'

    I was able to send Image from another computer to city using

     

    File.copy("MyPhoto.jpg","\\City\Photos\MyPhoto.jpg",true);

    I tried to display this image From Photos folder as follow

    BitmapImage DriverPhoto=new BitmapImage();

    DriverPhoto.BeginInit();

    DriverPhoto.UriSource =new Uri("\\City\Photos\MyPhoto.jpg");   /////// I get Exception Here

    DriverPhoto.EndInit();

    DriverImageControl.Source=DriverPhoto;

    can anyone explain to me how to set Uri path correctly?

    thanks