コード例 #1
0
 public Settings()
 {
     InitializeComponent();
     this.Unloaded += new RoutedEventHandler(Settings_Unloaded);
     pcuc = PodcastUriCollection.LoadCollection();
     LayoutRoot.DataContext = pcuc;
 }
コード例 #2
0
 private void DeleteRow_Click(object sender, RoutedEventArgs e)
 {
     PodcastUriCollection _pcuc = new PodcastUriCollection();
     foreach (var item in dataGrid1.SelectedItems)
     {
         _pcuc.Add((PodcastUriItem)item);
     }
     foreach (PodcastUriItem pui in _pcuc)
     {
         pcuc.Remove(pui);
     }
 }
コード例 #3
0
        private void UploadSettings_Click(object sender, RoutedEventArgs e)
        {
            // Create an instance of the open file dialog box.
            OpenFileDialog textDialog = new OpenFileDialog();

            // Set filter options and filter index.
            textDialog.Filter = "XML Files (.xml)|*.xml|All Files (*.*)|*.*";
            textDialog.FilterIndex = 1;

            textDialog.Multiselect = false;

            // Call the ShowDialog method to show the dialog box.
            bool? userClickedOK = textDialog.ShowDialog();

            // Process input if the user clicked OK.
            if (userClickedOK == true)
            {
                // Open the selected file to read.
                System.IO.Stream fileStream = textDialog.File.OpenRead();
                PodcastUriCollection _pcuc = PodcastUriCollection.LoadCollection(fileStream);
                if (_pcuc != null)
                {
                    pcuc = _pcuc;
                    LayoutRoot.DataContext = pcuc;
                }

            }
        }