public MultimediaImage(MultimediaElement mme) { this.mme = mme; InitializeComponent(); this.FileSave = MainWindow.MulimediaPath + this.mme.name; DownloadImage(); }
public MultimediaVideo(MultimediaElement mme) { this.mme = mme; if (Environment.Is64BitOperatingSystem) { VlcContext.LibVlcDllsPath = CommonStrings.LIBVLC_DLLS_PATH_DEFAULT_VALUE_AMD64; VlcContext.LibVlcPluginsPath = CommonStrings.PLUGINS_PATH_DEFAULT_VALUE_AMD64; } else { VlcContext.LibVlcDllsPath = CommonStrings.LIBVLC_DLLS_PATH_DEFAULT_VALUE_X86; VlcContext.LibVlcPluginsPath = CommonStrings.PLUGINS_PATH_DEFAULT_VALUE_X86; } VlcContext.StartupOptions.IgnoreConfig = true; VlcContext.StartupOptions.LogOptions.LogInFile = false; VlcContext.StartupOptions.LogOptions.ShowLoggerConsole = false; VlcContext.StartupOptions.AddOption("--no-video-title-show"); try { VlcContext.Initialize(); } catch (DirectoryNotFoundException) { MessageBox.Show(WpfsAppStrings.error_vlc_path + "\n" + VlcContext.LibVlcDllsPath, "WpfsApp", MessageBoxButton.OK, MessageBoxImage.Error); return; } InitializeComponent(); myVlcControl.PositionChanged += VlcControlOnPositionChanged; myVlcControl.TimeChanged += VlcControlOnTimeChanged; this.FileSave = MainWindow.MulimediaPath + this.mme.name; if (File.Exists(this.FileSave) && new FileInfo(this.FileSave).Length > 0) { this.txtLoad.Text = ""; ShowVideo(); } else { this.Client = new WebClient(); this.Client.DownloadFileCompleted += new AsyncCompletedEventHandler(Client_DownloadFileCompleted); this.Client.DownloadProgressChanged += Client_DownloadProgressChanged; this.Client.DownloadFileAsync(new Uri(this.mme.url), this.FileSave); } this.DisableControls(); this.IsInit = true; }
private void Window_Closed(object sender, EventArgs e) { this.ReleaseClient(); this.mme = null; this.imgMain = null; }
private void Window_Closed(object sender, EventArgs e) { this.mme = null; VlcContext.CloseAll(); if (this.Client != null && this.Client.IsBusy) { this.Client.CancelAsync(); } this.Client = null; }