Beispiel #1
0
        private async void MyLoadButton_Click(object sender, RoutedEventArgs e)
        {
            //
            List <StorageFile> files = await InteractiveTools.GetFiles();

            if (files == null || files.Count == 0)
            {
                return;
            }

            //
            myImageFiles = new List <StorageFile>();
            foreach (StorageFile file in files)
            {
                string name = file.Name;
                if (name.EndsWith(".png") || name.EndsWith(".jpg") || name.EndsWith(".gif"))
                {
                    myImageFiles.Add(file);
                }
            }

            //
            ImageIndex = 0;
            InteractiveTools.SetImage(MyImage, myImageFiles[ImageIndex]);
            HasImages = true;
            MyBackButton.IsEnabled = false;
            if (myImageFiles.Count > 1)
            {
                MyNextButton.IsEnabled = true;
            }
            else
            {
                MyNextButton.IsEnabled = false;
            }
        }
Beispiel #2
0
        private void MyNextButton_Click(object sender, RoutedEventArgs e)
        {
            if (!HasImages)
            {
                return;
            }

            InteractiveTools.SetImage(MyImage, myImageFiles[++ImageIndex]);
            MyBackButton.IsEnabled = true;
            if (ImageIndex >= myImageFiles.Count - 1)
            {
                MyNextButton.IsEnabled = false;
            }
        }