Beispiel #1
0
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            MessageBoxResult result = MessageBoxResult.Yes;

            if (CollectionStore.Settings != null && CollectionStore.Settings.IsChanged)
            {
                result = Classes.UI.MessageBox.Show("Текущие изменения не сохранены, закрыть?", App.Name, MessageBoxButton.YesNo, MessageBoxImage.Warning);
            }
            else
            {
                foreach (string collectionName in CollectionStore.ActualCollections)
                {
                    if (CollectionStore.Get(collectionName).IsChanged)
                    {
                        result = Classes.UI.MessageBox.Show("Текущие изменения не сохранены, закрыть?", App.Name, MessageBoxButton.YesNo, MessageBoxImage.Warning);
                        break;
                    }
                }
            }
            if (result == MessageBoxResult.No)
            {
                e.Cancel = true;
            }
            else
            {
                ImageTaskStop();
                if (menuItem_ClearImageCache.IsChecked)
                {
                    TaskProgressWindow taskProgressWindow = new TaskProgressWindow(TaskType.СlearImageCache);
                    taskProgressWindow.ShowDialog();
                }
            }
        }
Beispiel #2
0
 private void MenuItem_DistributeFolders_Click(object sender, RoutedEventArgs e)
 {
     if (CollectionStore.Settings != null)
     {
         ImageTaskStop();
         TaskProgressWindow taskProgressWindow = new TaskProgressWindow(TaskType.Distribution);
         taskProgressWindow.ShowDialog();
         ComboBox_CollectionNames_SelectionChanged(null, null);
     }
 }
Beispiel #3
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            string[] args = Environment.GetCommandLineArgs();
            if (args.Length > 1)
            {
                if (!Directory.Exists(args[1]))
                {
                    Close();
                }

                if (args.Contains("-oc"))
                {
                    if (Directory.Exists($"{args[1]}\\{CollectionStore.DataDirectoryName}"))
                    {
                        TaskProgressWindow taskProgressWindow = new TaskProgressWindow(TaskType.OpenCollections, new object[] { args[1] });
                        taskProgressWindow.ShowDialog();
                        RefreshAfterOpening();
                    }
                    else
                    {
                        Classes.UI.MessageBox.Show("Папка, содержащая данные о коллекциях не обнаружена. Продолжение операции невозможно.",
                                                   App.Name, MessageBoxButton.OK, MessageBoxImage.Warning);

                        Close();
                    }
                }
                else
                {
                    OpenFolderShell(args[1]);
                }
            }
            else
            {
                StartWindow startWindow = new StartWindow();
                startWindow.ShowDialog();
                StartWork work = startWindow.StartWork;
                if (work == StartWork.OpenFolder)
                {
                    MenuItem_OpenFolder_Click(null, null);
                }
                else if (work == StartWork.OpenCollection)
                {
                    MenuItem_OpenCollections_Click(null, null);
                }
                else if (work == StartWork.LastOpenCollection)
                {
                    ProgramSettings settings = ProgramSettings.GetInstance();
                    OpenCollectionsShell(settings.LastOpenCollection);
                }
            }
        }
Beispiel #4
0
        private void OpenFolderShell(string folder = null)
        {
            SettingsOpenFolderWindow settingsOpenFolderWindow = new SettingsOpenFolderWindow(folder);

            settingsOpenFolderWindow.ShowDialog();
            OpenFolderArgs openFolderArgs = settingsOpenFolderWindow.GetArgs();

            if (openFolderArgs.ContinueExecution)
            {
                TaskProgressWindow progressWindow = new TaskProgressWindow(TaskType.OpenFolder, new object[] {
                    openFolderArgs.BaseDirectory, openFolderArgs.SearchOption, openFolderArgs.SearchMask, openFolderArgs.DistributionDirectory
                });
                progressWindow.ShowDialog();
                RefreshAfterOpening();
            }
        }
Beispiel #5
0
        private void OpenCollectionsShell(string baseDirectory)
        {
            string dataDirectory = Path.Combine(baseDirectory, CollectionStore.DataDirectoryName);
            string icdAllPath    = Path.Combine(dataDirectory, $"{CollectionStore.BaseCollectionId}.icd");

            if (Directory.Exists(dataDirectory) && File.Exists(icdAllPath))
            {
                TaskProgressWindow taskProgressWindow = new TaskProgressWindow(TaskType.OpenCollections, new object[] { baseDirectory });
                taskProgressWindow.ShowDialog();
                RefreshAfterOpening();
            }
            else
            {
                Classes.UI.MessageBox.Show("Данные о коллекциях не обнаружены. Продолжение операции невозможно.", App.Name, MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
Beispiel #6
0
 private void MenuItem_MergeCollections_Click(object sender, RoutedEventArgs e)
 {
     using (System.Windows.Forms.FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog {
         ShowNewFolderButton = false
     })
     {
         if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             if (File.Exists(Path.Combine(fbd.SelectedPath, CollectionStore.DataDirectoryName, $"{CollectionStore.BaseCollectionId}.icd")))
             {
                 TaskProgressWindow progressWindow = new TaskProgressWindow(TaskType.MergeCollections, new object[] { fbd.SelectedPath });
                 progressWindow.ShowDialog();
                 RefreshAfterOpening();
             }
             else
             {
                 Classes.UI.MessageBox.Show("Данные о коллекциях не обнаружены. Продолжение операции невозможно.", App.Name, MessageBoxButton.OK, MessageBoxImage.Warning);
             }
         }
     }
 }
Beispiel #7
0
        private void MenuItem_SaveCollections_Click(object sender, RoutedEventArgs e)
        {
            TaskProgressWindow taskProgressWindow = new TaskProgressWindow(TaskType.SaveCollections);

            taskProgressWindow.ShowDialog();
        }