|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.IO;
namespace OfflineVideos.UI
{
public partial class MainAppView : UserControl
{
public MainAppView()
{
InitializeComponent();
Loaded += new RoutedEventHandler(MainAppView_Loaded);
}
void MainAppView_Loaded(object sender, RoutedEventArgs e)
{
Button_Click(null, null);
}
private void Button_Click(object sender, RoutedEventArgs e)
{
var ofd = new OpenFileDialog();
ofd.Filter = "Media Files |*.wmv;*.wma;*.mp3";
ofd.Multiselect = false;
if((bool)ofd.ShowDialog())
{
if(File.Exists(ofd.File.FullName))
{
LoadMedia(ofd.File.OpenRead());
}
}
}
void LoadMedia(Stream file)
{
player.SetSource(file);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.