Exemplo n.º 1
0
 /// <summary>
 /// User has changed their desired image source via changing the dropdown list on the GUI. Creates a new provider
 /// based on the value of the dropdown that they selected.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private async void ImageSourceDropDown_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     NextButton.IsEnabled = false;
     var providerName = e.AddedItems[0].ToString();
     var providerFactory = new ImageProviderFactory();
     // set the new imageprovider asynchronously since it requires downloading a page.
     await Task.Run(() => { this._imageLinkProvider = providerFactory.CreateProvider(providerName); });
     NextButton.IsEnabled = true;
 }
Exemplo n.º 2
0
        public MainWindow()
        {
            InitializeComponent();

          var providerFactory = new ImageProviderFactory();
          var defaultProvider = providerFactory.ProviderNames.First();
          ImageSourceDropDown.ItemsSource = providerFactory.ProviderNames;
          ImageSourceDropDown.SelectedValue = defaultProvider;
        }