Example #1
0
        private async void AddSeries_MouseUp(object sender, MouseButtonEventArgs e)
        {
            VistaFolderBrowserDialog fbd = new VistaFolderBrowserDialog();

            if ((bool)fbd.ShowDialog())
            {
                if (Path.GetDirectoryName(fbd.SelectedPath) == library)
                {
                    Series show = await MainWindow.SearchShow();

                    if (show.seriesName != null)
                    {
                        Storyboard       sb  = (Storyboard)FindResource("OpacityUp");
                        SeriesWithFolder swf = new SeriesWithFolder(show.id);
                        swf.Height              = 65;
                        swf.SeriesName.Text     = show.seriesName;
                        swf.Opacity             = 0;
                        swf.Remove.MouseUp     += (sen, ev) => { panel.Children.Remove(swf); };
                        swf.FolderLocation.Text = fbd.SelectedPath;
                        panel.Children.Add(swf);
                        sb.Begin(swf);
                    }
                }
                else
                {
                    await MessageBox.Show("Directory is not in previously selected path");
                }
            }
        }
Example #2
0
        private void RemoveResult(SeriesWithFolder swf)
        {
            Storyboard sb   = (Storyboard)FindResource("OpacityDown");
            Storyboard temp = sb.Clone();

            temp.Completed += (s, e) => panel.Children.Remove(swf);
            temp.Begin(swf);
        }
Example #3
0
        private async void Confirm_MouseUp(object sender, MouseButtonEventArgs e)
        {
            List <Tuple <int, string> > ids = new List <Tuple <int, string> >();

            foreach (var element in panel.Children)
            {
                SeriesWithFolder swf = (SeriesWithFolder)element;
                ids.Add(new Tuple <int, string>(swf.id, swf.FolderLocation.Text));
            }
            Settings.Library = SelectFolderText.Text;
            await MainWindow.CreateDatabase(ids);

            MainWindow.RemoveAllPages();
        }
Example #4
0
 /// <summary>
 /// Searches for Series by directory name and renders the result
 /// </summary>
 /// <param name="path">Which directory to scan</param>
 private void ScanAndRenderDirsBackgroundTask(string path)
 {
     if (Directory.Exists(path))
     {
         try {
             library = path;
             List <string> directories = Directory.GetDirectories(path).ToList();
             Task.Delay(250);
             foreach (string directory in directories)
             {
                 string name = Path.GetFileName(directory);
                 Series s    = Series.SearchSingle(name);
                 if (s != null)
                 {
                     Dispatcher.Invoke(new Action(() => {
                         Storyboard sb           = (Storyboard)FindResource("OpacityUp");
                         SeriesWithFolder swf    = new SeriesWithFolder(s.id);
                         swf.Height              = 65;
                         swf.SeriesName.Text     = s.seriesName;
                         swf.Opacity             = 0;
                         swf.Remove.MouseUp     += (sen, ev) => RemoveResult(swf);
                         swf.FolderLocation.Text = directory;
                         panel.Children.Add(swf);
                         sb.Begin(swf);
                     }), DispatcherPriority.Send);
                 }
             }
         } catch (ThreadAbortException) { }
         Dispatcher.Invoke(new Action(() => {
             if (panel.Children.Count > 0)
             {
                 ShowBar();
             }
             else
             {
                 HideBar();
             }
         }), DispatcherPriority.Send);
     }
     else
     {
         Dispatcher.Invoke(new Action(() => {
             HideBar();
         }), DispatcherPriority.Send);
     }
 }