瀏覽代碼

Fixed DynamicGridCheckBoxColumn and general warning fixes

Kenric Nugteren 1 年之前
父節點
當前提交
8d4ffaf12a

+ 1 - 1
InABox.Core/Configuration/GlobalConfiguration.cs

@@ -51,7 +51,7 @@ namespace InABox.Configuration
             return result ?? NewSettings();
             return result ?? NewSettings();
         }
         }
 
 
-        object IGlobalConfiguration.Load(bool useCache = true) => Load(useCache);
+        object IGlobalConfiguration.Load(bool useCache) => Load(useCache);
         
         
         public override T Load(bool useCache = true)
         public override T Load(bool useCache = true)
         {
         {

+ 0 - 1
InABox.Core/CoreExpression.cs

@@ -5,7 +5,6 @@ using InABox.Clients;
 using System.Diagnostics.CodeAnalysis;
 using System.Diagnostics.CodeAnalysis;
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
-using System.Diagnostics.CodeAnalysis;
 using System.Linq;
 using System.Linq;
 using System.Text;
 using System.Text;
 
 

+ 5 - 1
InABox.Core/CoreUtils.cs

@@ -13,7 +13,6 @@ using System.Net.Mail;
 using System.Reflection;
 using System.Reflection;
 using System.Text;
 using System.Text;
 using System.Text.RegularExpressions;
 using System.Text.RegularExpressions;
-using System.Diagnostics.CodeAnalysis;
 using Newtonsoft.Json;
 using Newtonsoft.Json;
 using Newtonsoft.Json.Linq;
 using Newtonsoft.Json.Linq;
 using System.Runtime.CompilerServices;
 using System.Runtime.CompilerServices;
@@ -277,6 +276,8 @@ namespace InABox.Core
             return result;
             return result;
         }
         }
 
 
+        #region Reflection
+
         public static bool HasInterface(this Type type, Type interfaceType)
         public static bool HasInterface(this Type type, Type interfaceType)
         {
         {
             return type.GetInterfaces(interfaceType).Any();
             return type.GetInterfaces(interfaceType).Any();
@@ -332,6 +333,9 @@ namespace InABox.Core
 
 
             return null;
             return null;
         }
         }
+
+        #endregion
+
         public static bool TryGetEntity(string entityname, [NotNullWhen(true)] out Type? type)
         public static bool TryGetEntity(string entityname, [NotNullWhen(true)] out Type? type)
         {
         {
             if (string.IsNullOrWhiteSpace(entityname))
             if (string.IsNullOrWhiteSpace(entityname))

+ 1 - 0
InABox.Core/DatabaseSchema/IProperty.cs

@@ -77,6 +77,7 @@ namespace InABox.Core
         {
         {
             return property.Parent != null && (property.Parent.HasEditor || property.Parent.HasParentEditor());
             return property.Parent != null && (property.Parent.HasEditor || property.Parent.HasParentEditor());
         }
         }
+
         public static bool HasParentEntityLink(this IProperty property)
         public static bool HasParentEntityLink(this IProperty property)
         {
         {
             return property.Parent != null && (property.Parent.IsEntityLink || property.Parent.HasParentEntityLink());
             return property.Parent != null && (property.Parent.IsEntityLink || property.Parent.HasParentEntityLink());

+ 1 - 1
InABox.Core/DigitalForms/DataModel/DigitalFormDataModel.cs

@@ -39,7 +39,7 @@ namespace InABox.Core
             {
             {
                 return CoreUtils.GetPropertyValue(Entity, name);
                 return CoreUtils.GetPropertyValue(Entity, name);
             }
             }
-            catch (Exception e)
+            catch
             {
             {
                 return null;
                 return null;
             }
             }

+ 1 - 1
InABox.Core/DigitalForms/Forms/DigitalFormLayout.cs

@@ -45,7 +45,7 @@ namespace InABox.Core
             return new Filter<DigitalFormLayout>(x => x.Form.ID).IsEqualTo(Form.ID);
             return new Filter<DigitalFormLayout>(x => x.Form.ID).IsEqualTo(Form.ID);
         }
         }
 
 
-        public string? AutoIncrementPrefix() => "L";
+        public string AutoIncrementPrefix() => "L";
 
 
         public string AutoIncrementFormat()
         public string AutoIncrementFormat()
         {
         {

+ 1 - 1
InABox.Core/DigitalForms/Forms/DigitalFormVariable.cs

@@ -108,7 +108,7 @@ namespace InABox.Core
             return new Filter<DigitalFormVariable>(x => x.Form.ID).IsEqualTo(Form.ID);
             return new Filter<DigitalFormVariable>(x => x.Form.ID).IsEqualTo(Form.ID);
         }
         }
 
 
-        public string? AutoIncrementPrefix() => "V";
+        public string AutoIncrementPrefix() => "V";
 
 
         public string AutoIncrementFormat()
         public string AutoIncrementFormat()
         {
         {

+ 2 - 2
InABox.Core/DigitalForms/Layouts/Fields/DFLayoutURLField/DFLayoutURLFieldProperties.cs

@@ -17,9 +17,9 @@
             entry.SetValue(value);
             entry.SetValue(value);
         }
         }
 
 
-        public override string GetValue(string value)
+        public override string GetValue(string? value)
         {
         {
-            return value;
+            return value ?? "";
         }
         }
     }
     }
 }
 }

+ 1 - 1
InABox.Core/DigitalForms/Obsolete/QAQuestion.cs

@@ -48,7 +48,7 @@ namespace InABox.Core
         [NullEditor]
         [NullEditor]
         public long Sequence { get; set; }
         public long Sequence { get; set; }
 
 
-        protected override void DoPropertyChanged(string name, object before, object after)
+        protected override void DoPropertyChanged(string name, object? before, object? after)
         {
         {
             base.DoPropertyChanged(name, before, after);
             base.DoPropertyChanged(name, before, after);
             if (name.Equals("Answer"))
             if (name.Equals("Answer"))

+ 1 - 1
InABox.Core/Editors/TextBoxEditor.cs

@@ -7,7 +7,7 @@
             Visible = Visible.Default;
             Visible = Visible.Default;
         }
         }
 
 
-        public EditorButton[] Buttons { get; set; }
+        public EditorButton[]? Buttons { get; set; }
 
 
         protected override BaseEditor DoClone()
         protected override BaseEditor DoClone()
         {
         {

+ 1 - 1
InABox.Core/EnclosedEntity.cs

@@ -26,7 +26,7 @@ namespace InABox.Core
             _linkedentity = entity;
             _linkedentity = entity;
         }
         }
         
         
-        protected override void DoPropertyChanged(string name, object before, object after)
+        protected override void DoPropertyChanged(string name, object? before, object? after)
         {
         {
             var le = LinkedEntity();
             var le = LinkedEntity();
             if (IsObserving() && le != null)
             if (IsObserving() && le != null)

+ 1 - 1
inabox.wpf/DynamicGrid/Columns/EditorColumns/DynamicGridCheckBoxColumn.cs

@@ -23,7 +23,7 @@ public class DynamicGridCheckBoxColumn<TEntity> : DynamicGridEditorColumn<TEntit
             () =>
             () =>
             {
             {
                 var result = new Image() { Source = tick, Margin = new Thickness(2) };
                 var result = new Image() { Source = tick, Margin = new Thickness(2) };
-                var binding = new Binding() { Path = new PropertyPath(MappingName) };
+                var binding = new Binding() { Path = new PropertyPath(MappingName), Converter = new BooleanToVisibilityConverter() };
                 result.SetBinding(UIElement.VisibilityProperty, binding);
                 result.SetBinding(UIElement.VisibilityProperty, binding);
                 return result;
                 return result;
             }
             }