Пример #1
0
        private async void SaveAll_Click(object sender, RoutedEventArgs e)
        {
            for (int i = 0; i < filePaths.Length; i++)
            {
                //save all BWs in one Folder
                DirectoryInfo   dir   = Directory.CreateDirectory(filePaths[i].Remove(filePaths[i].LastIndexOf('.')));
                string          path  = Path.Combine(dir.FullName, Path.GetFileName(filePaths[i]));
                Task <Bitmap>[] tasks = BW_Handler.ConvertWithAllAlgorithms(bwHandlers[i].Image);
                SaveImage(await tasks[0], path.Insert(path.LastIndexOf('.'), "_average"));
                SaveImage(await tasks[1], path.Insert(path.LastIndexOf('.'), "_luminosity"));
                SaveImage(await tasks[2], path.Insert(path.LastIndexOf('.'), "_lightness"));
            }

            MessageBox.Show("Alle gespeichert", "Erfolgreich", MessageBoxButton.OK);
        }
Пример #2
0
        private void OpenBtn_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog fileDialog = new OpenFileDialog
            {
                Filter      = FILTER_STRING,
                Multiselect = true
            };

            if (fileDialog.ShowDialog(this) == true)
            {
                filePaths  = fileDialog.FileNames;
                Title      = fileDialog.SafeFileName;
                bwHandlers = new BW_Handler[filePaths.Length];
                for (var i = 0; i < filePaths.Length; i++)
                {
                    bwHandlers[i] = new BW_Handler(filePaths[i]);
                }
                img.Source = bwHandlers[0].GetBitmapSource();
            }
        }