示例#1
0
 /// <summary>
 /// Adds a folder to the grid using the default folder browser dialog
 /// </summary>
 private void AddFolder()
 {
     using (var folderBrowser = new FolderBrowserDialog())
     {
         folderBrowser.Description = Resources.SelectMediaLibraryFolder;
         DialogResult dialogResult = folderBrowser.ShowDialog();
         if (dialogResult == DialogResult.OK)
         {
             SelectedFolders.Add(folderBrowser.SelectedPath);
         }
     }
 }
示例#2
0
        public void UseStorage()
        {
            if (SelectedFolders.Count == 0 && DeselectedFolders.Count == 0)
            {
                Engine.IsBluetooth = false;
                var paths       = new List <string>(_searchPaths);
                var sourcePaths = new List <string>();
                while (paths.Count > 0)
                {
                    string path = paths[0];
                    paths.RemoveAt(0);

                    if (Directory.Exists(path))
                    {
                        SelectedFolders.Add(path);
                        var dirInfo = new DirectoryInfo(path);
                        try
                        {
                            foreach (DirectoryInfo subdirInfo in dirInfo.GetDirectories())
                            {
                                paths.Add(subdirInfo.FullName);
                            }
                        }
                        catch (System.Exception e)
                        {
                            ExecutionEngine.EventLogger.WriteExceptionInfo(e);
                        }
                    }
                }

                if (!ExecutionEngine.Config.EnableFolderSelection.Value || SelectedFolders.Count == 1)
                {
                    Engine.IsShowFolders = false;
                    SwitchToProcessScreen();
                }
                else
                {
                    Engine.IsShowFolders = true;
                    SwitchToSelectFoldersScreen();
                }
            }
            else if (Engine.IsShowFolders)
            {
                SwitchToSelectFoldersScreen();
            }
            else
            {
                SwitchToProcessScreen();
            }
        }
示例#3
0
 private void BtnAddFolder_OnClick(object sender, RoutedEventArgs e)
 {
     using (var dialog = new System.Windows.Forms.FolderBrowserDialog())
     {
         System.Windows.Forms.DialogResult result = dialog.ShowDialog();
         if (result == System.Windows.Forms.DialogResult.OK)
         {
             string path = dialog.SelectedPath;
             if (Directory.Exists(path) && !SelectedFolders.Any(x => NormalizePath(x.Folder) == NormalizePath(path)))
             {
                 SelectedFolders.Add(new FolderModel(path));
             }
         }
     }
 }