summaryrefslogtreecommitdiff
path: root/Gestor.Common/Gestor.Common.Helpers
diff options
context:
space:
mode:
Diffstat (limited to 'Gestor.Common/Gestor.Common.Helpers')
-rw-r--r--Gestor.Common/Gestor.Common.Helpers/DataBaseParameters.cs6
-rw-r--r--Gestor.Common/Gestor.Common.Helpers/DefaultAttribute.cs13
-rw-r--r--Gestor.Common/Gestor.Common.Helpers/EncryptionHelper.cs77
-rw-r--r--Gestor.Common/Gestor.Common.Helpers/EnumBindingSourceExtension.cs54
-rw-r--r--Gestor.Common/Gestor.Common.Helpers/EnumHelper.cs115
-rw-r--r--Gestor.Common/Gestor.Common.Helpers/FindVisualChild.cs25
-rw-r--r--Gestor.Common/Gestor.Common.Helpers/FindVisualChildren.cs195
-rw-r--r--Gestor.Common/Gestor.Common.Helpers/Functions.cs102
-rw-r--r--Gestor.Common/Gestor.Common.Helpers/HiddenAttribute.cs8
-rw-r--r--Gestor.Common/Gestor.Common.Helpers/HttpHelper.cs31
-rw-r--r--Gestor.Common/Gestor.Common.Helpers/OrderAttribute.cs14
-rw-r--r--Gestor.Common/Gestor.Common.Helpers/ScrollAnimationBehavior.cs131
12 files changed, 771 insertions, 0 deletions
diff --git a/Gestor.Common/Gestor.Common.Helpers/DataBaseParameters.cs b/Gestor.Common/Gestor.Common.Helpers/DataBaseParameters.cs
new file mode 100644
index 0000000..3f5c61a
--- /dev/null
+++ b/Gestor.Common/Gestor.Common.Helpers/DataBaseParameters.cs
@@ -0,0 +1,6 @@
+namespace Gestor.Common.Helpers;
+
+public static class DataBaseParameters
+{
+ public static bool NovoGestor { get; set; }
+}
diff --git a/Gestor.Common/Gestor.Common.Helpers/DefaultAttribute.cs b/Gestor.Common/Gestor.Common.Helpers/DefaultAttribute.cs
new file mode 100644
index 0000000..552ec99
--- /dev/null
+++ b/Gestor.Common/Gestor.Common.Helpers/DefaultAttribute.cs
@@ -0,0 +1,13 @@
+using System;
+
+namespace Gestor.Common.Helpers;
+
+public class DefaultAttribute : Attribute
+{
+ public bool DefaultProperty { get; private set; }
+
+ public DefaultAttribute(bool defaultProperty)
+ {
+ DefaultProperty = defaultProperty;
+ }
+}
diff --git a/Gestor.Common/Gestor.Common.Helpers/EncryptionHelper.cs b/Gestor.Common/Gestor.Common.Helpers/EncryptionHelper.cs
new file mode 100644
index 0000000..5b982d0
--- /dev/null
+++ b/Gestor.Common/Gestor.Common.Helpers/EncryptionHelper.cs
@@ -0,0 +1,77 @@
+using System;
+using System.IO;
+using System.Security.Cryptography;
+using System.Text;
+
+namespace Gestor.Common.Helpers;
+
+public static class EncryptionHelper
+{
+ private static readonly byte[] Salt = new byte[16]
+ {
+ 38, 220, 255, 0, 173, 237, 122, 238, 197, 254,
+ 7, 175, 77, 8, 34, 60
+ };
+
+ private static readonly string EncryptionKey = $"aGG3r{1012}#w3BDz$";
+
+ public static string Encrypt(this string plain)
+ {
+ return Convert.ToBase64String(Encoding.UTF8.GetBytes(plain).EncryptBytes());
+ }
+
+ public static byte[] EncryptBytes(this byte[] plainTextBytes)
+ {
+ using Rfc2898DeriveBytes rfc2898DeriveBytes = new Rfc2898DeriveBytes(EncryptionKey, Salt);
+ using Rijndael rijndael = Rijndael.Create();
+ rijndael.Key = rfc2898DeriveBytes.GetBytes(32);
+ rijndael.IV = rfc2898DeriveBytes.GetBytes(16);
+ using MemoryStream memoryStream = new MemoryStream();
+ using CryptoStream cryptoStream = new CryptoStream(memoryStream, rijndael.CreateEncryptor(), CryptoStreamMode.Write);
+ cryptoStream.Write(plainTextBytes, 0, plainTextBytes.Length);
+ cryptoStream.FlushFinalBlock();
+ return memoryStream.ToArray();
+ }
+
+ public static string Decrypt(this string cipher)
+ {
+ if (string.IsNullOrEmpty(cipher))
+ {
+ return null;
+ }
+ try
+ {
+ byte[] array = Convert.FromBase64String(cipher);
+ if (array.Length < 16)
+ {
+ return cipher;
+ }
+ byte[] array2 = array.DecryptBytes();
+ return (array2 == null) ? cipher : Encoding.UTF8.GetString(array2);
+ }
+ catch (Exception)
+ {
+ return cipher;
+ }
+ }
+
+ public static byte[] DecryptBytes(this byte[] plainTextBytes)
+ {
+ try
+ {
+ using Rfc2898DeriveBytes rfc2898DeriveBytes = new Rfc2898DeriveBytes(EncryptionKey, Salt);
+ using Rijndael rijndael = Rijndael.Create();
+ rijndael.Key = rfc2898DeriveBytes.GetBytes(32);
+ rijndael.IV = rfc2898DeriveBytes.GetBytes(16);
+ using MemoryStream memoryStream = new MemoryStream();
+ using CryptoStream cryptoStream = new CryptoStream(memoryStream, rijndael.CreateDecryptor(), CryptoStreamMode.Write);
+ cryptoStream.Write(plainTextBytes, 0, plainTextBytes.Length);
+ cryptoStream.FlushFinalBlock();
+ return memoryStream.ToArray();
+ }
+ catch (Exception)
+ {
+ return null;
+ }
+ }
+}
diff --git a/Gestor.Common/Gestor.Common.Helpers/EnumBindingSourceExtension.cs b/Gestor.Common/Gestor.Common.Helpers/EnumBindingSourceExtension.cs
new file mode 100644
index 0000000..67981a6
--- /dev/null
+++ b/Gestor.Common/Gestor.Common.Helpers/EnumBindingSourceExtension.cs
@@ -0,0 +1,54 @@
+using System;
+using System.Windows.Markup;
+
+namespace Gestor.Common.Helpers;
+
+public class EnumBindingSourceExtension : MarkupExtension
+{
+ private Type _enumType;
+
+ public Type EnumType
+ {
+ get
+ {
+ return _enumType;
+ }
+ set
+ {
+ if (!(value == _enumType))
+ {
+ if (null != value && !(Nullable.GetUnderlyingType(value) ?? value).IsEnum)
+ {
+ throw new ArgumentException("Type must be for an Enum.");
+ }
+ _enumType = value;
+ }
+ }
+ }
+
+ public EnumBindingSourceExtension()
+ {
+ }
+
+ public EnumBindingSourceExtension(Type enumType)
+ {
+ EnumType = enumType;
+ }
+
+ public override object ProvideValue(IServiceProvider serviceProvider)
+ {
+ if (null == _enumType)
+ {
+ throw new InvalidOperationException("The EnumType must be specified.");
+ }
+ Type type = Nullable.GetUnderlyingType(_enumType) ?? _enumType;
+ Array values = Enum.GetValues(type);
+ if (type == _enumType)
+ {
+ return values;
+ }
+ Array array = Array.CreateInstance(type, values.Length + 1);
+ values.CopyTo(array, 1);
+ return array;
+ }
+}
diff --git a/Gestor.Common/Gestor.Common.Helpers/EnumHelper.cs b/Gestor.Common/Gestor.Common.Helpers/EnumHelper.cs
new file mode 100644
index 0000000..8b5879c
--- /dev/null
+++ b/Gestor.Common/Gestor.Common.Helpers/EnumHelper.cs
@@ -0,0 +1,115 @@
+using System;
+using System.ComponentModel;
+using System.Reflection;
+using Gestor.Model.Attributes;
+
+namespace Gestor.Common.Helpers;
+
+public static class EnumHelper
+{
+ public static T2 GetAttribute<T, T2>(this T enumValue) where T2 : class
+ {
+ string name = Enum.GetName(enumValue.GetType(), enumValue);
+ try
+ {
+ FieldInfo? field = enumValue.GetType().GetField(name);
+ Type typeFromHandle = typeof(T2);
+ return Attribute.GetCustomAttribute(field, typeFromHandle) as T2;
+ }
+ catch (Exception)
+ {
+ return null;
+ }
+ }
+
+ public static T ToEnumByOldValue<T>(this string oldValue)
+ {
+ Type typeFromHandle = typeof(T);
+ Type typeFromHandle2 = typeof(OldValueAttribute);
+ FieldInfo[] fields = typeFromHandle.GetFields();
+ foreach (FieldInfo fieldInfo in fields)
+ {
+ Attribute? customAttribute = Attribute.GetCustomAttribute(fieldInfo, typeFromHandle2);
+ OldValueAttribute val = (OldValueAttribute)(object)((customAttribute is OldValueAttribute) ? customAttribute : null);
+ if (val != null && val.OldValue == oldValue)
+ {
+ return (T)fieldInfo.GetValue(null);
+ }
+ }
+ return default(T);
+ }
+
+ public static string GetOldValue<T>(this T enumValue)
+ {
+ OldValueAttribute attribute = enumValue.GetAttribute<T, OldValueAttribute>();
+ if (attribute == null)
+ {
+ return null;
+ }
+ return attribute.OldValue;
+ }
+
+ public static T ToEnumByOldValue2<T>(this string oldValue)
+ {
+ Type typeFromHandle = typeof(T);
+ Type typeFromHandle2 = typeof(OldValue2Attribute);
+ FieldInfo[] fields = typeFromHandle.GetFields();
+ foreach (FieldInfo fieldInfo in fields)
+ {
+ Attribute? customAttribute = Attribute.GetCustomAttribute(fieldInfo, typeFromHandle2);
+ OldValue2Attribute val = (OldValue2Attribute)(object)((customAttribute is OldValue2Attribute) ? customAttribute : null);
+ if (val != null && val.OldValue2 == oldValue)
+ {
+ return (T)fieldInfo.GetValue(null);
+ }
+ }
+ return default(T);
+ }
+
+ public static string GetOldValue2<T>(this T enumValue)
+ {
+ OldValue2Attribute attribute = enumValue.GetAttribute<T, OldValue2Attribute>();
+ if (attribute == null)
+ {
+ return null;
+ }
+ return attribute.OldValue2;
+ }
+
+ public static bool? GetDefault<T>(this T enumValue)
+ {
+ string name = Enum.GetName(enumValue.GetType(), enumValue);
+ FieldInfo field = enumValue.GetType().GetField(name);
+ return ((field == null) ? null : (Attribute.GetCustomAttribute(field, typeof(DefaultAttribute)) as DefaultAttribute))?.DefaultProperty;
+ }
+
+ public static bool GetHidden<T>(this T enumValue)
+ {
+ string name = Enum.GetName(enumValue.GetType(), enumValue);
+ FieldInfo field = enumValue.GetType().GetField(name);
+ return ((field == null) ? null : (Attribute.GetCustomAttribute(field, typeof(HiddenAttribute)) as HiddenAttribute)) != null;
+ }
+
+ public static string Value<T>(this T enumValue)
+ {
+ return Convert.ToInt32(enumValue).ToString();
+ }
+
+ public static string GetDescription<T>(this T enumValue)
+ {
+ string name = Enum.GetName(enumValue.GetType(), enumValue);
+ if (name == null)
+ {
+ return null;
+ }
+ FieldInfo field = enumValue.GetType().GetField(name);
+ return ((field == null) ? null : (Attribute.GetCustomAttribute(field, typeof(DescriptionAttribute)) as DescriptionAttribute))?.Description;
+ }
+
+ public static int? GetOrder<T>(this T enumValue)
+ {
+ string name = Enum.GetName(enumValue.GetType(), enumValue);
+ FieldInfo field = enumValue.GetType().GetField(name);
+ return ((field == null) ? null : (Attribute.GetCustomAttribute(field, typeof(OrderAttribute)) as OrderAttribute))?.OrderProperty;
+ }
+}
diff --git a/Gestor.Common/Gestor.Common.Helpers/FindVisualChild.cs b/Gestor.Common/Gestor.Common.Helpers/FindVisualChild.cs
new file mode 100644
index 0000000..f47fea1
--- /dev/null
+++ b/Gestor.Common/Gestor.Common.Helpers/FindVisualChild.cs
@@ -0,0 +1,25 @@
+using System.Windows;
+using System.Windows.Media;
+
+namespace Gestor.Common.Helpers;
+
+public class FindVisualChild
+{
+ public static childItem Find<childItem>(DependencyObject obj) where childItem : DependencyObject
+ {
+ for (int i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++)
+ {
+ DependencyObject child = VisualTreeHelper.GetChild(obj, i);
+ if (child != null && child is childItem)
+ {
+ return (childItem)(object)child;
+ }
+ childItem val = Find<childItem>(child);
+ if (val != null)
+ {
+ return val;
+ }
+ }
+ return default(childItem);
+ }
+}
diff --git a/Gestor.Common/Gestor.Common.Helpers/FindVisualChildren.cs b/Gestor.Common/Gestor.Common.Helpers/FindVisualChildren.cs
new file mode 100644
index 0000000..5b88c0d
--- /dev/null
+++ b/Gestor.Common/Gestor.Common.Helpers/FindVisualChildren.cs
@@ -0,0 +1,195 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Runtime.CompilerServices;
+using System.Windows;
+using System.Windows.Media;
+
+namespace Gestor.Common.Helpers;
+
+public class FindVisualChildren
+{
+ [CompilerGenerated]
+ private sealed class _003CFind_003Ed__0<T> : IEnumerable<T>, IEnumerable, IEnumerator<T>, IDisposable, IEnumerator where T : DependencyObject
+ {
+ private int _003C_003E1__state;
+
+ private T _003C_003E2__current;
+
+ private int _003C_003El__initialThreadId;
+
+ private DependencyObject depObj;
+
+ public DependencyObject _003C_003E3__depObj;
+
+ private int _003Ci_003E5__2;
+
+ private DependencyObject _003Cchild_003E5__3;
+
+ private IEnumerator<T> _003C_003E7__wrap3;
+
+ T IEnumerator<T>.Current
+ {
+ [DebuggerHidden]
+ get
+ {
+ return _003C_003E2__current;
+ }
+ }
+
+ object IEnumerator.Current
+ {
+ [DebuggerHidden]
+ get
+ {
+ return _003C_003E2__current;
+ }
+ }
+
+ [DebuggerHidden]
+ public _003CFind_003Ed__0(int _003C_003E1__state)
+ {
+ this._003C_003E1__state = _003C_003E1__state;
+ _003C_003El__initialThreadId = Environment.CurrentManagedThreadId;
+ }
+
+ [DebuggerHidden]
+ void IDisposable.Dispose()
+ {
+ int num = _003C_003E1__state;
+ if (num == -3 || num == 2)
+ {
+ try
+ {
+ }
+ finally
+ {
+ _003C_003Em__Finally1();
+ }
+ }
+ _003Cchild_003E5__3 = null;
+ _003C_003E7__wrap3 = null;
+ _003C_003E1__state = -2;
+ }
+
+ private bool MoveNext()
+ {
+ try
+ {
+ switch (_003C_003E1__state)
+ {
+ default:
+ return false;
+ case 0:
+ _003C_003E1__state = -1;
+ if (depObj == null)
+ {
+ break;
+ }
+ _003Ci_003E5__2 = 0;
+ goto IL_0107;
+ case 1:
+ _003C_003E1__state = -1;
+ goto IL_0090;
+ case 2:
+ {
+ _003C_003E1__state = -3;
+ goto IL_00d6;
+ }
+ IL_0107:
+ if (_003Ci_003E5__2 >= VisualTreeHelper.GetChildrenCount(depObj))
+ {
+ break;
+ }
+ _003Cchild_003E5__3 = VisualTreeHelper.GetChild(depObj, _003Ci_003E5__2);
+ if (_003Cchild_003E5__3 != null && _003Cchild_003E5__3 is T)
+ {
+ _003C_003E2__current = (T)(object)_003Cchild_003E5__3;
+ _003C_003E1__state = 1;
+ return true;
+ }
+ goto IL_0090;
+ IL_0090:
+ _003C_003E7__wrap3 = Find<T>(_003Cchild_003E5__3).GetEnumerator();
+ _003C_003E1__state = -3;
+ goto IL_00d6;
+ IL_00d6:
+ if (_003C_003E7__wrap3.MoveNext())
+ {
+ T current = _003C_003E7__wrap3.Current;
+ _003C_003E2__current = current;
+ _003C_003E1__state = 2;
+ return true;
+ }
+ _003C_003Em__Finally1();
+ _003C_003E7__wrap3 = null;
+ _003Cchild_003E5__3 = null;
+ _003Ci_003E5__2++;
+ goto IL_0107;
+ }
+ return false;
+ }
+ catch
+ {
+ //try-fault
+ ((IDisposable)this).Dispose();
+ throw;
+ }
+ }
+
+ bool IEnumerator.MoveNext()
+ {
+ //ILSpy generated this explicit interface implementation from .override directive in MoveNext
+ return this.MoveNext();
+ }
+
+ private void _003C_003Em__Finally1()
+ {
+ _003C_003E1__state = -1;
+ if (_003C_003E7__wrap3 != null)
+ {
+ _003C_003E7__wrap3.Dispose();
+ }
+ }
+
+ [DebuggerHidden]
+ void IEnumerator.Reset()
+ {
+ throw new NotSupportedException();
+ }
+
+ [DebuggerHidden]
+ IEnumerator<T> IEnumerable<T>.GetEnumerator()
+ {
+ _003CFind_003Ed__0<T> _003CFind_003Ed__;
+ if (_003C_003E1__state == -2 && _003C_003El__initialThreadId == Environment.CurrentManagedThreadId)
+ {
+ _003C_003E1__state = 0;
+ _003CFind_003Ed__ = this;
+ }
+ else
+ {
+ _003CFind_003Ed__ = new _003CFind_003Ed__0<T>(0);
+ }
+ _003CFind_003Ed__.depObj = _003C_003E3__depObj;
+ return _003CFind_003Ed__;
+ }
+
+ [DebuggerHidden]
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return ((IEnumerable<T>)this).GetEnumerator();
+ }
+ }
+
+ [IteratorStateMachine(typeof(_003CFind_003Ed__0<>))]
+ public static IEnumerable<T> Find<T>(DependencyObject depObj) where T : DependencyObject
+ {
+ //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
+ return new _003CFind_003Ed__0<T>(-2)
+ {
+ _003C_003E3__depObj = depObj
+ };
+ }
+}
diff --git a/Gestor.Common/Gestor.Common.Helpers/Functions.cs b/Gestor.Common/Gestor.Common.Helpers/Functions.cs
new file mode 100644
index 0000000..b9f88cf
--- /dev/null
+++ b/Gestor.Common/Gestor.Common.Helpers/Functions.cs
@@ -0,0 +1,102 @@
+using System;
+using System.Diagnostics;
+using System.Linq;
+using System.Net;
+using System.Net.Sockets;
+using Gestor.Common.Validation;
+
+namespace Gestor.Common.Helpers;
+
+public class Functions
+{
+ public static Stopwatch Stopwatch;
+
+ public static DateTime? StartTime;
+
+ public static int Compare(string original, string modified)
+ {
+ if (original == null)
+ {
+ original = "";
+ }
+ if (modified == null)
+ {
+ modified = "";
+ }
+ string text = original.ToLongNullable().ToString();
+ if (!string.IsNullOrWhiteSpace(text))
+ {
+ original = text;
+ }
+ text = modified.ToLongNullable().ToString();
+ if (!string.IsNullOrWhiteSpace(text))
+ {
+ modified = text;
+ }
+ int length = original.Length;
+ int length2 = modified.Length;
+ int[,] array = new int[length + 1, length2 + 1];
+ for (int i = 0; i <= length; i++)
+ {
+ array[i, 0] = i;
+ }
+ for (int j = 0; j <= length2; j++)
+ {
+ array[0, j] = j;
+ }
+ for (int k = 1; k <= length; k++)
+ {
+ for (int l = 1; l <= length2; l++)
+ {
+ int num = ((modified[l - 1] != original[k - 1]) ? 1 : 0);
+ int[] source = new int[3]
+ {
+ array[k - 1, l] + 1,
+ array[k, l - 1] + 1,
+ array[k - 1, l - 1] + num
+ };
+ array[k, l] = source.Min();
+ if (k > 1 && l > 1 && original[k - 1] == modified[l - 2] && original[k - 2] == modified[l - 1])
+ {
+ array[k, l] = Math.Min(array[k, l], array[k - 2, l - 2] + num);
+ }
+ }
+ }
+ return array[length, length2];
+ }
+
+ public static DateTime GetNetworkTime()
+ {
+ try
+ {
+ if (StartTime.HasValue)
+ {
+ return StartTime.Value.AddMilliseconds(Stopwatch.ElapsedMilliseconds);
+ }
+ byte[] array = new byte[48];
+ array[0] = 27;
+ IPEndPoint remoteEP = new IPEndPoint(Dns.GetHostEntry("time.google.com").AddressList.First((IPAddress a) => a.AddressFamily == AddressFamily.InterNetwork), 123);
+ using (Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp))
+ {
+ socket.Connect(remoteEP);
+ socket.ReceiveTimeout = 3000;
+ socket.Send(array);
+ socket.Receive(array);
+ socket.Close();
+ }
+ ulong num = ((ulong)array[40] << 24) | ((ulong)array[41] << 16) | ((ulong)array[42] << 8) | array[43];
+ ulong num2 = ((ulong)array[44] << 24) | ((ulong)array[45] << 16) | ((ulong)array[46] << 8) | array[47];
+ ulong num3 = num * 1000 + num2 * 1000 / 4294967296L;
+ DateTime value = new DateTime(1900, 1, 1).AddMilliseconds((long)num3).ToLocalTime();
+ StartTime = value;
+ Stopwatch = Stopwatch.StartNew();
+ return StartTime.Value;
+ }
+ catch (Exception)
+ {
+ StartTime = DateTime.Now;
+ Stopwatch = Stopwatch.StartNew();
+ return StartTime.Value;
+ }
+ }
+}
diff --git a/Gestor.Common/Gestor.Common.Helpers/HiddenAttribute.cs b/Gestor.Common/Gestor.Common.Helpers/HiddenAttribute.cs
new file mode 100644
index 0000000..c664526
--- /dev/null
+++ b/Gestor.Common/Gestor.Common.Helpers/HiddenAttribute.cs
@@ -0,0 +1,8 @@
+using System;
+
+namespace Gestor.Common.Helpers;
+
+[AttributeUsage(AttributeTargets.All)]
+public class HiddenAttribute : Attribute
+{
+}
diff --git a/Gestor.Common/Gestor.Common.Helpers/HttpHelper.cs b/Gestor.Common/Gestor.Common.Helpers/HttpHelper.cs
new file mode 100644
index 0000000..de15cd1
--- /dev/null
+++ b/Gestor.Common/Gestor.Common.Helpers/HttpHelper.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Net;
+using System.Net.Http;
+
+namespace Gestor.Common.Helpers;
+
+public static class HttpHelper
+{
+ public static HttpRequestMessage CreateRequest(this Uri requestUri, HttpMethod httpMethod, Version httpVersion = null)
+ {
+ //IL_0000: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0005: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0015: Unknown result type (might be due to invalid IL or missing references)
+ //IL_001c: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0024: Expected O, but got Unknown
+ return new HttpRequestMessage
+ {
+ Version = (httpVersion ?? HttpVersion.Version11),
+ RequestUri = requestUri,
+ Method = httpMethod
+ };
+ }
+
+ public static FormUrlEncodedContent Encode(this List<KeyValuePair<string, string>> keyValuePairs)
+ {
+ //IL_0001: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0007: Expected O, but got Unknown
+ return new FormUrlEncodedContent((IEnumerable<KeyValuePair<string, string>>)keyValuePairs);
+ }
+}
diff --git a/Gestor.Common/Gestor.Common.Helpers/OrderAttribute.cs b/Gestor.Common/Gestor.Common.Helpers/OrderAttribute.cs
new file mode 100644
index 0000000..e72f517
--- /dev/null
+++ b/Gestor.Common/Gestor.Common.Helpers/OrderAttribute.cs
@@ -0,0 +1,14 @@
+using System;
+
+namespace Gestor.Common.Helpers;
+
+[AttributeUsage(AttributeTargets.All)]
+public class OrderAttribute : Attribute
+{
+ public int OrderProperty { get; private set; }
+
+ public OrderAttribute(int orderProperty)
+ {
+ OrderProperty = orderProperty;
+ }
+}
diff --git a/Gestor.Common/Gestor.Common.Helpers/ScrollAnimationBehavior.cs b/Gestor.Common/Gestor.Common.Helpers/ScrollAnimationBehavior.cs
new file mode 100644
index 0000000..3af3b0d
--- /dev/null
+++ b/Gestor.Common/Gestor.Common.Helpers/ScrollAnimationBehavior.cs
@@ -0,0 +1,131 @@
+using System;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Input;
+using System.Windows.Media.Animation;
+
+namespace Gestor.Common.Helpers;
+
+public static class ScrollAnimationBehavior
+{
+ public static DependencyProperty VerticalOffsetProperty = DependencyProperty.RegisterAttached("VerticalOffset", typeof(double), typeof(ScrollAnimationBehavior), (PropertyMetadata)new UIPropertyMetadata((object)0.0, new PropertyChangedCallback(OnVerticalOffsetChanged)));
+
+ public static DependencyProperty TimeDurationProperty = DependencyProperty.RegisterAttached("TimeDuration", typeof(TimeSpan), typeof(ScrollAnimationBehavior), new PropertyMetadata((object)new TimeSpan(0, 0, 0, 0, 0)));
+
+ public static DependencyProperty PointsToScrollProperty = DependencyProperty.RegisterAttached("PointsToScroll", typeof(double), typeof(ScrollAnimationBehavior), new PropertyMetadata((object)0.0));
+
+ public static DependencyProperty IsEnabledProperty = DependencyProperty.RegisterAttached("IsEnabled", typeof(bool), typeof(ScrollAnimationBehavior), (PropertyMetadata)new UIPropertyMetadata((object)false, new PropertyChangedCallback(OnIsEnabledChanged)));
+
+ private static double _currentToValue;
+
+ private static Storyboard _storyboard;
+
+ public static void SetTimeDuration(FrameworkElement target, TimeSpan value)
+ {
+ ((DependencyObject)target).SetValue(TimeDurationProperty, (object)value);
+ }
+
+ public static TimeSpan GetTimeDuration(FrameworkElement target)
+ {
+ return (TimeSpan)((DependencyObject)target).GetValue(TimeDurationProperty);
+ }
+
+ public static void SetPointsToScroll(FrameworkElement target, double value)
+ {
+ ((DependencyObject)target).SetValue(PointsToScrollProperty, (object)value);
+ }
+
+ private static void OnVerticalOffsetChanged(DependencyObject target, DependencyPropertyChangedEventArgs e)
+ {
+ ScrollViewer val = (ScrollViewer)(object)((target is ScrollViewer) ? target : null);
+ if (val != null)
+ {
+ val.ScrollToVerticalOffset((double)e.NewValue);
+ }
+ }
+
+ public static void SetIsEnabled(FrameworkElement target, bool value)
+ {
+ ((DependencyObject)target).SetValue(IsEnabledProperty, (object)value);
+ }
+
+ private static void OnIsEnabledChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
+ {
+ //IL_0012: Unknown result type (might be due to invalid IL or missing references)
+ //IL_001c: Expected O, but got Unknown
+ ScrollViewer val = (ScrollViewer)(object)((sender is ScrollViewer) ? sender : null);
+ if (val != null)
+ {
+ ((FrameworkElement)val).Loaded += new RoutedEventHandler(ScrollerLoaded);
+ }
+ }
+
+ private static void AnimateScroll(ScrollViewer scrollViewer)
+ {
+ //IL_0000: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0005: Unknown result type (might be due to invalid IL or missing references)
+ //IL_000c: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0017: Expected O, but got Unknown
+ //IL_002c: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0031: Unknown result type (might be due to invalid IL or missing references)
+ //IL_003b: Expected O, but got Unknown
+ //IL_0050: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0055: Unknown result type (might be due to invalid IL or missing references)
+ //IL_005a: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0066: Expected O, but got Unknown
+ //IL_0061: Unknown result type (might be due to invalid IL or missing references)
+ //IL_006b: Expected O, but got Unknown
+ //IL_006c: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0076: Expected O, but got Unknown
+ //IL_0093: Unknown result type (might be due to invalid IL or missing references)
+ //IL_009d: Expected O, but got Unknown
+ DoubleAnimationUsingKeyFrames val = new DoubleAnimationUsingKeyFrames
+ {
+ Duration = new Duration(GetTimeDuration((FrameworkElement)(object)scrollViewer))
+ };
+ val.KeyFrames.Add((DoubleKeyFrame)new EasingDoubleKeyFrame(scrollViewer.VerticalOffset, KeyTime.FromPercent(0.0)));
+ val.KeyFrames.Add((DoubleKeyFrame)new EasingDoubleKeyFrame(_currentToValue, KeyTime.FromPercent(1.0), (IEasingFunction)new SineEase
+ {
+ EasingMode = (EasingMode)1
+ }));
+ _storyboard = new Storyboard();
+ ((TimelineGroup)_storyboard).Children.Add((Timeline)(object)val);
+ Storyboard.SetTarget((DependencyObject)(object)val, (DependencyObject)(object)scrollViewer);
+ Storyboard.SetTargetProperty((DependencyObject)(object)val, new PropertyPath((object)VerticalOffsetProperty));
+ _storyboard.Begin();
+ }
+
+ private static void SetEventHandlersForScrollViewer(ScrollViewer scroller)
+ {
+ //IL_0008: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0012: Expected O, but got Unknown
+ ((UIElement)scroller).PreviewMouseWheel += new MouseWheelEventHandler(ScrollViewerPreviewMouseWheel);
+ }
+
+ private static void ScrollerLoaded(object sender, RoutedEventArgs e)
+ {
+ SetEventHandlersForScrollViewer((ScrollViewer)((sender is ScrollViewer) ? sender : null));
+ }
+
+ private static void ScrollViewerPreviewMouseWheel(object sender, MouseWheelEventArgs e)
+ {
+ //IL_000e: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0014: Expected O, but got Unknown
+ //IL_0035: Unknown result type (might be due to invalid IL or missing references)
+ //IL_003b: Invalid comparison between Unknown and I4
+ double currentToValue = _currentToValue;
+ double num = e.Delta;
+ ScrollViewer val = (ScrollViewer)sender;
+ double num2 = num * 2.0 / 3.0;
+ if (_storyboard == null || (int)_storyboard.GetCurrentState() == 1)
+ {
+ _currentToValue = val.VerticalOffset;
+ }
+ _currentToValue = ((num2 > _currentToValue) ? 0.0 : ((_currentToValue - num2 > val.ScrollableHeight) ? val.ScrollableHeight : (_currentToValue - num2)));
+ if (_currentToValue != val.VerticalOffset && _currentToValue != currentToValue)
+ {
+ AnimateScroll(val);
+ }
+ ((RoutedEventArgs)e).Handled = true;
+ }
+}