private void FileAddB_Click(object sender, RoutedEventArgs e) { if (FileT.Text.Length > 0) { char[] invalidChars = System.IO.Path.GetInvalidPathChars(); if (FileT.Text.IndexOfAny(invalidChars) < 0) { Page.Playlist.Playlist.PlaylistData.Path path = new Page.Playlist.Playlist.PlaylistData.Path(); path.IsFile = true; path.FilePath = FileT.Text; PlaylistItems.Items.Add(CreateSubItem(path)); FileT.Text = ""; } else { Utils.Notification not = new Utils.Notification(parent, Utils.Config.Language.Strings.ExceptionMessage.PathException.UsingInvalidChars, Utils.Config.Setting.Brushes.Notification.Error.Brush); not.ShowMessage(); } } else { Utils.Notification not = new Utils.Notification(parent, Utils.Config.Language.Strings.ExceptionMessage.PathException.IncorrectPath, Utils.Config.Setting.Brushes.Notification.Error.Brush); not.ShowMessage(); } }
private void DirectoryAddB_Click(object sender, RoutedEventArgs e) { if (DirectoryT.Text.Length > 0) { char[] invalidChars = System.IO.Path.GetInvalidPathChars(); if (DirectoryT.Text.IndexOfAny(invalidChars) < 0) { Page.Playlist.Playlist.PlaylistData.Path path = new Page.Playlist.Playlist.PlaylistData.Path(); path.IsFile = false; path.DirectoryPath = DirectoryT.Text; if (FilterT.Text.Length == 0) { Utils.Notification not = new Utils.Notification(parent, Utils.Config.Language.Strings.ExceptionMessage.PathException.SetToDefaultFilter, Utils.Config.Setting.Brushes.Notification.Message.Brush); not.ShowMessage(); path.Filter = new string[] { "*.*" }; } else { path.Filter = FilterT.Text.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries); } PlaylistItems.Items.Add(CreateSubItem(path)); DirectoryT.Text = ""; } else { Utils.Notification not = new Utils.Notification(parent, Utils.Config.Language.Strings.ExceptionMessage.PathException.UsingInvalidChars, Utils.Config.Setting.Brushes.Notification.Error.Brush); not.ShowMessage(); } } else { Utils.Notification not = new Utils.Notification(parent, Utils.Config.Language.Strings.ExceptionMessage.PathException.IncorrectPath, Utils.Config.Setting.Brushes.Notification.Error.Brush); not.ShowMessage(); } }
private ListItem CreateSubItem(Page.Playlist.Playlist.PlaylistData.Path Path) { ListAnimativeItem Lai = new ListAnimativeItem(true); Lai.DataType = typeof(Page.Playlist.Playlist.PlaylistData.Path); Lai.Data = Path; ListSubItem lsi = new ListSubItem(); Lai.ItemsHeight = lsi.Height; lsi.SubLabelVisibility = Visibility.Visible; lsi.SubLabelText = "Unknown"; switch (Path.IsFile) { case true: lsi.MainLabelText = System.IO.Path.GetFileName(Path.FilePath) + " - " + Utils.Config.Language.Strings.Path.File; lsi.SubLabelText = Path.FilePath; break; case false: lsi.MainLabelText = System.IO.Path.GetFileName(Path.DirectoryPath) + " - " + Utils.Config.Language.Strings.Path.Directory; lsi.SubLabelText = Path.DirectoryPath + " - Filter : " + string.Join(" , ", Path.Filter); break; } Lai.FirstItem = lsi; ListButtonsItem lbi = new ListButtonsItem(); ListButtonsItem.ListButton Remove = new ListButtonsItem.ListButton(Lai); Remove.Click += Remove_Click; Remove.Content = Utils.Config.Language.Strings.ContextMenu.Remove; lbi.Add(Remove); Lai.SecondItem = lbi; return(Lai); }
private void FileOpenB_Click(object sender, RoutedEventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Multiselect = true; if (ofd.ShowDialog() == true) { if (ofd.FileNames.Length > 1) { foreach (string p in ofd.FileNames) { Page.Playlist.Playlist.PlaylistData.Path path = new Page.Playlist.Playlist.PlaylistData.Path(); path.IsFile = true; path.FilePath = p; PlaylistItems.Items.Add(CreateSubItem(path)); } } else { FileT.Text = ofd.FileName; } } }