public object Convert(object[] value, Type targetType, object parameter, CultureInfo culture) { String name = value[0] as String; FrameworkElement element = value[1] as FrameworkElement; String param = null; if (value.Length > 2) { param = value[2] as string; } if (element == null) { return(false); } MediaLoader media = element.DataContext as MediaLoader; if (param == null) { return(!String.IsNullOrWhiteSpace(name) && !media.Sources.ContainsKey(name.TrimEnd().TrimStart())); } else { return(!String.IsNullOrWhiteSpace(name) && (name.TrimEnd().TrimStart().Equals(param) || !media.Sources.ContainsKey(name.TrimEnd().TrimStart()))); } }
public ExtensionDialog(MainWindow main, object media) { this.main = main; this.media = (MediaLoader)media; DataContext = media; InitializeComponent(); }
public PlaylistDialog(Object media) { this.media = (MediaLoader)media; files = new ObservableCollection <Media>(); DataContext = media; InitializeComponent(); FileList.ItemsSource = files; }
public EditPlaylist(object media, object files) { this.media = (MediaLoader)media; this.files = (KeyValuePair <String, ObservableCollection <Media> >)files; copy = new ObservableCollection <Media>(this.files.Value); this.DataContext = media; InitializeComponent(); FileList.ItemsSource = this.copy; Name.Content = this.files.Key; PName.Text = this.files.Key; }
public MainWindow() { inactivity = new DispatcherTimer(); animationen = new Animationen(); player = new DispatcherTimer(); player.Tick += new EventHandler(play_time); player.Interval = new TimeSpan(0, 0, 0, 0, 166); media = new MediaLoader(); DataContext = media; InitializeComponent(); player.Start(); }
private void OpenDirectoryDialog(object sender, RoutedEventArgs e) { using (var dialog = new System.Windows.Forms.FolderBrowserDialog()) { System.Windows.Forms.DialogResult result = dialog.ShowDialog(); String path = dialog.SelectedPath; if (result.ToString().Equals("OK")) { int idx = Sources.SelectedIndex; media.Sources.Remove("Path"); media.Sources["Path"] = MediaLoader.GetMediaENum(path, media.UsedExtensions); if (idx != Sources.SelectedIndex) { Sources.SelectedIndex = media.Sources.Count - 1; media.Media = media.Sources["Path"]; media.CMedia = null; } File.WriteAllText(media.path, path); } } }