locked
Display image from website RRS feed

  • Question

  • Hi.

    I wonder what i can use to display a image from a given URL.
    I have a animation that i want to be displayed every 1 hour and i want the animation to hold for 30 sec and then dissapear.


    Friday, September 18, 2009 3:16 AM

Answers

  • Hello Alcstudio,

      First question.

      We can set the the Image Control's Source property.

      Create the Uri object which is accepted by Source property from the URL.

      Here is a sample code.

      Xaml and C#
    <Image Source="http://www.ooo.com/Picture.jpg" />
    
    Uri uri = new Uri("http://www.ooo.com/Picture.jpg");
    

    Second question.

     You can use the System.Windows.Threading.DispatcherTimer

    A timer that is integrated into the Dispatcher queue which is processed at a specified interval of time and at a specified priority. 

     More in http://msdn.microsoft.com/en-us/library/system.windows.threading.dispatchertimer.aspx
     
    Good luck


    Please mark the replies as answers if they help and unmark them if they provide no help
    • Marked as answer by Hua Chen Thursday, September 24, 2009 6:46 AM
    Friday, September 18, 2009 8:25 AM

All replies

  • Hello Alcstudio,

      First question.

      We can set the the Image Control's Source property.

      Create the Uri object which is accepted by Source property from the URL.

      Here is a sample code.

      Xaml and C#
    <Image Source="http://www.ooo.com/Picture.jpg" />
    
    Uri uri = new Uri("http://www.ooo.com/Picture.jpg");
    

    Second question.

     You can use the System.Windows.Threading.DispatcherTimer

    A timer that is integrated into the Dispatcher queue which is processed at a specified interval of time and at a specified priority. 

     More in http://msdn.microsoft.com/en-us/library/system.windows.threading.dispatchertimer.aspx
     
    Good luck


    Please mark the replies as answers if they help and unmark them if they provide no help
    • Marked as answer by Hua Chen Thursday, September 24, 2009 6:46 AM
    Friday, September 18, 2009 8:25 AM
  • My class looks like this:

            public sealed class Dispatcher
            {
            }

    What should i put in the class? this code?

    public delegate void NextPrimeDelegate();
    
    C#
    startStopButton.Dispatcher.BeginInvoke(
        DispatcherPriority.Normal,
        new NextPrimeDelegate(CheckNextNumber));
    Friday, September 18, 2009 11:04 AM
  • Hello Alcstudio,
     
      You can use the DispatcherTimer class.
     
      There is a sample from http://msdn.microsoft.com/en-us/library/system.windows.threading.dispatchertimer.aspx

      It has a similar usage with other type Timers

     Good luck.
    Please mark the replies as answers if they help and unmark them if they provide no help
    Saturday, September 19, 2009 8:18 AM