Răsfoiți Sursa

Changed open dialog type to images

flabbet 4 ani în urmă
părinte
comite
97060b8a13

+ 1 - 1
PixiEditor/Helpers/Converters/EmptyStringToVisibiltyConverter.cs → PixiEditor/Helpers/Converters/EmptyStringToVisibilityConverter.cs

@@ -9,7 +9,7 @@ using System.Windows.Data;
 
 namespace PixiEditor.Helpers.Converters
 {
-    class EmptyStringToVisibilityConverter : IValueConverter
+    public class EmptyStringToVisibilityConverter : IValueConverter
     {
         public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
         {

+ 3 - 3
PixiEditor/Views/UserControls/Layers/LayerGroupControl.xaml.cs

@@ -22,9 +22,6 @@ namespace PixiEditor.Views.UserControls.Layers
             set { SetValue(GroupGuidProperty, value); }
         }
 
-        public static string LayerGroupControlDataName = typeof(LayerGroupControl).FullName;
-        public static string LayerContainerDataName = typeof(LayerStructureItemContainer).FullName;
-
         public static readonly DependencyProperty GroupGuidProperty =
             DependencyProperty.Register("GroupGuid", typeof(Guid), typeof(LayerGroupControl), new PropertyMetadata(Guid.NewGuid()));
 
@@ -56,6 +53,9 @@ namespace PixiEditor.Views.UserControls.Layers
             DependencyProperty.Register("GroupOpacity", typeof(float), typeof(LayerGroupControl), new PropertyMetadata(1f));
 
 
+        public static string LayerGroupControlDataName = typeof(LayerGroupControl).FullName;
+        public static string LayerContainerDataName = typeof(LayerStructureItemContainer).FullName;
+
         private static void LayersViewModelCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
         {
             LayerGroupControl control = (LayerGroupControl)d;

+ 6 - 8
PixiEditor/Views/UserControls/Layers/ReferenceLayer.xaml.cs

@@ -51,17 +51,15 @@ namespace PixiEditor.Views.UserControls.Layers
 
         private string OpenFilePicker()
         {
-            OpenFileDialog dialog = new OpenFileDialog()
+
+            OpenFileDialog dialog = new OpenFileDialog
             {
-                Filter = "PNG Files|*.png|JPEG Files|*.jpg;*.jpeg",
-                CheckFileExists = true
+                Title = "Reference layer path",
+                CheckPathExists = true,
+                Filter = "Image Files|*.png;*.jpeg;*.jpg|PNG Files|*.png|JPG Files|*.jpeg;*.jpg"
             };
 
-            if ((bool)dialog.ShowDialog())
-            {
-                return dialog.FileName;
-            }
-            return null;
+            return (bool)dialog.ShowDialog() ? dialog.FileName : null;
         }
 
         private void TrashButton_Click(object sender, RoutedEventArgs e)

+ 1 - 1
PixiEditorTests/ModelsTests/DataHoldersTests/DocumentTests.cs

@@ -301,7 +301,7 @@ namespace PixiEditorTests.ModelsTests.DataHoldersTests
         [StaFact]
         public void TestThatDocumentGetsAddedToRecentlyOpenedList()
         {
-            ViewModelMain viewModel = Helpers.MockedViewModelMain();
+            ViewModelMain viewModel = TestHelpers.MockedViewModelMain();
 
             Document document = new Document(1, 1)
             {

+ 1 - 1
PixiEditorTests/Helpers.cs → PixiEditorTests/TestHelpers.cs

@@ -5,7 +5,7 @@ using PixiEditor.ViewModels;
 
 namespace PixiEditorTests
 {
-    public static class Helpers
+    public static class TestHelpers
     {
         public static ViewModelMain MockedViewModelMain()
         {

+ 4 - 2
PixiEditorTests/ViewModelsTests/ViewModelMainTests.cs

@@ -18,8 +18,10 @@ namespace PixiEditorTests.ViewModelsTests
     [Collection("Application collection")]
     public class ViewModelMainTests
     {
-        public static IServiceProvider Services;
-
+        private static IServiceProvider services;
+
+        public static IServiceProvider Services { get => services; set => services = value; }
+
         public ViewModelMainTests()
         {
             Services = new ServiceCollection()