Autor Beitrag
Kuehter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 30
Erhaltene Danke: 1



BeitragVerfasst: Mi 24.06.15 10:32 
ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
        private void btn_Activate_Click(object sender, RoutedEventArgs e)
        {
            Timer timer1 = new Timer(new TimerCallback(loadImage), null0100);
        }

        public void loadImage(object a)
        {
            BitmapImage bi3 = new BitmapImage();  <!--- //Fehler hier
            bi3.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
            bi3.UriSource = new Uri("smile.jpg", UriKind.RelativeOrAbsolute);
            Image1.Source = bi3;
        }


Weiter läuf er das nicht durch. Nur warum kommt da der Fehler?

Moderiert von user profile iconChristian S.: Quote- durch C#-Tags ersetzt
Kuehter Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 30
Erhaltene Danke: 1



BeitragVerfasst: Mi 24.06.15 13:58 
Lösung:
ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
private void btn_Activate_Click(object sender, RoutedEventArgs e)
{
    DispatcherTimer _Timer = new DispatcherTimer();
    _Timer.Interval = new TimeSpan(0,0,0,0,100);
    _Timer.Tick += (s, i) =>
        {
            BitmapImage bi3 = new BitmapImage();
            bi3.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
            bi3.UriSource = new Uri("smile.jpg", UriKind.RelativeOrAbsolute);
            Image1.Source = bi3;
        };
    _Timer.Start();
}


Moderiert von user profile iconTh69: Quote- durch C#-Tags ersetzt