示例#1
0
 private void LoadSourcesThread()
 {
     try
     {
         RaiseStatusUpdatedEvent("Loading sources...");
         FileSystemHandler.LoadMetaDatabases(ObjectPool.Sources);
         RaiseDatabaseOperationCompletedEvent(OperationType.LoadSources);
     }
     catch (Exception ex)
     {
         CommonWorker.ShowError(ex);
     }
 }
示例#2
0
 public void RemoveSource(GallerySource source)
 {
     try
     {
         ObjectPool.RemoveSource(source);
         RegistryHandler.SaveSettings(SettingsType.GallerySource);
         RaiseSourceListUpdatedEvent(ObjectPool.Sources);
     }
     catch (Exception ex)
     {
         CommonWorker.ShowError(ex);
     }
 }
示例#3
0
 private void LoadThumbnailsThread(object data)
 {
     try
     {
         RaiseStatusUpdatedEvent("Loading thumbnails...");
         MediaFolder folder = (data as MediaFolder);
         if (folder != null)
         {
             FileSystemHandler.LoadThumbnails(folder);
         }
         RaiseDatabaseOperationCompletedEvent(OperationType.LoadThumbnails);
     }
     catch (Exception ex)
     {
         CommonWorker.ShowError(ex);
     }
 }
示例#4
0
 public void SetDatabaseLocation()
 {
     try
     {
         FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();
         folderBrowserDialog.Description  = "Please select a database root folder...";
         folderBrowserDialog.SelectedPath = ObjectPool.CompleteDatabaseLocation;
         if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
         {
             ObjectPool.SetDatabaseLocation(folderBrowserDialog.SelectedPath);
             RegistryHandler.SaveSettings(SettingsType.DatabaseLocation);
             RaiseDatabaseLocationUpdatedEvent(ObjectPool.DatabaseLocation);
         }
     }
     catch (Exception ex)
     {
         CommonWorker.ShowError(ex);
     }
 }
示例#5
0
 public void SetWorkingDirectory()
 {
     try
     {
         FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();
         folderBrowserDialog.Description  = "Please select a working directory...";
         folderBrowserDialog.SelectedPath = ObjectPool.CompleteWorkingDirectory;
         if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
         {
             ObjectPool.SetWorkingDirectory(folderBrowserDialog.SelectedPath);
             RegistryHandler.SaveSettings(SettingsType.WorkingDirectory);
             RaiseWorkingDirectoryUpdatedEvent(ObjectPool.WorkingDirectory);
         }
     }
     catch (Exception ex)
     {
         CommonWorker.ShowError(ex);
     }
 }
示例#6
0
 public void AddSource()
 {
     try
     {
         FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();
         folderBrowserDialog.Description  = "Please select a source root folder...";
         folderBrowserDialog.SelectedPath = ObjectPool.LastBrowsedPath;
         if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
         {
             ObjectPool.AddSource(new GallerySource(folderBrowserDialog.SelectedPath));
             RegistryHandler.SaveSettings(SettingsType.GallerySource);
             RaiseSourceListUpdatedEvent(ObjectPool.Sources);
         }
         ObjectPool.LastBrowsedPath = folderBrowserDialog.SelectedPath;
     }
     catch (Exception ex)
     {
         CommonWorker.ShowError(ex);
     }
 }
示例#7
0
 private void ScanSourceThread(object data)
 {
     try
     {
         object[] parameters = data as object[];
         if (parameters != null && parameters.Length == 2)
         {
             GallerySource source = (parameters[0] as GallerySource);
             if (source != null && parameters[1] is bool)
             {
                 FileSystemHandler.PrepareDirectories();
                 FileSystemHandler.InitializeImageProcessor(90L);
                 FileSystemHandler.ScanFolders(source, (bool)parameters[1]);
             }
         }
         RaiseDatabaseOperationCompletedEvent(OperationType.ScanSource);
     }
     catch (Exception ex)
     {
         CommonWorker.ShowError(ex);
     }
 }
示例#8
0
 public void SetVideoThumbnailsMakerPreset()
 {
     try
     {
         OpenFileDialog openFileDialog = new OpenFileDialog();
         openFileDialog.Title            = "Please select a Video Thumbnails Maker preset file...";
         openFileDialog.InitialDirectory = Path.GetDirectoryName(ObjectPool.CompleteVideoThumbnailsMakerPresetPath);
         openFileDialog.FileName         = Path.GetFileName(ObjectPool.CompleteVideoThumbnailsMakerPresetPath);
         openFileDialog.Filter           = "Video Thumbnails Maker presets (*.vtm)|*.vtm|All files (*.*)|*.*";
         openFileDialog.FilterIndex      = 0;
         if (openFileDialog.ShowDialog() == DialogResult.OK)
         {
             ObjectPool.SetVideoThumbnailsMakerPresetPath(openFileDialog.FileName);
             RegistryHandler.SaveSettings(SettingsType.VideoThumbnailsMakerPresetPath);
             RaiseVideoThumbnailsMakerPresetUpdatedEvent(ObjectPool.VideoThumbnailsMakerPresetPath);
         }
     }
     catch (Exception ex)
     {
         CommonWorker.ShowError(ex);
     }
 }