Exemplo n.º 1
0
        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();
            }
        }
Exemplo n.º 2
0
        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();
            }
        }