Giter Club home page Giter Club logo

therightdirectionlibraries's People

Contributors

mannusetten avatar

Watchers

 avatar

therightdirectionlibraries's Issues

een speciale converter ontwikkelen

in alle projecten vier main projecten zit een converter die een bepaalde waarde vergelijkt en dan een bepaalde output geeft

bijvoorbeeld:
enumsportstype == basketball -> kleur groen

waarde x = 10 -> true

hier een algemene converter voor maken, samen met de convertercollection die al in WinUX aanwezig is kan zo een set van regels gemaakt worden

unit testing library toevoegen

alles van de repository unit testing toevoegen
documenten schrijven
oude repository verwijderen
nuget package updaten

mouse over werkt niet goed

de mouse over en vooral weg van de control als de tekst is geselecteerd werkt niet goed voor de editable textbox in een lijst

buildserver inrichten

een vm inrichten met Jenkins om alle projecten te unit testen, builden en de test results te mailen

code aanpassing voor extensions

public static partial class Extensions
{
public static void CopyProperties(this object from, object to, bool includePropertiesFromBaseType = false, string[] excludedProperties = null)
{
if (to == null)
{
return;
}
Dictionary<string, PropertyInfo> sourceProperties = GetProperties(from.GetType(), includePropertiesFromBaseType);
Dictionary<string, PropertyInfo> targetProperties = GetProperties(to.GetType(), includePropertiesFromBaseType);
IEnumerable commonPropertiesName = sourceProperties.Values.Intersect(targetProperties.Values, new PropertyInfoComparer()).Select(x => x.Name);
foreach (var commonPropertyName in commonPropertiesName)
{
if (excludedProperties != null
&& excludedProperties.Contains(commonPropertyName))
continue;
var hasExcludeAttribute = FindAttribute(targetProperties[commonPropertyName]);
if (!hasExcludeAttribute)
{
var value = sourceProperties[commonPropertyName].GetValue(from, null);
if (targetProperties[commonPropertyName].CanWrite)
{
targetProperties[commonPropertyName].SetValue(to, value, null);
}
}
}
}

    public static int GetHashCodeOnProperties(this object inspect)
    {
        return inspect.GetType().GetTypeInfo().DeclaredProperties.Select(o => o.GetValue(inspect)).GetListHashCode();
    }

    public static int GetListHashCode(this IEnumerable<object> sequence)
    {
        return sequence.Where(x => x != null)
            .Select(item => item.GetHashCode())
            .Aggregate((total, nextCode) => total ^ nextCode);
    }

    private static bool FindAttribute(PropertyInfo commonProperty)
    {
        var attribute = commonProperty.GetCustomAttribute<ExcludeFromCopyPropertyAttribute>();
        return attribute != null;
    }

    private static Dictionary<string, PropertyInfo> GetProperties(Type type, bool recursive)
    {
        if (recursive)
        {
            Dictionary<string, PropertyInfo> properties = new Dictionary<string, PropertyInfo>();
            var retrievedProperties = GetProperties(type);
            foreach(var retrievedProperty in retrievedProperties)
            {
                properties.Add(retrievedProperty.Key, retrievedProperty.Value);
            }
            var typeInfo = type.GetTypeInfo();
            while (typeInfo.BaseType != null)
            {
                var baseType = typeInfo.BaseType;
                retrievedProperties = GetProperties(baseType);
                foreach (var retrievedProperty in retrievedProperties)
                {
                    if (!properties.ContainsKey(retrievedProperty.Key))
                    {
                        properties.Add(retrievedProperty.Key, retrievedProperty.Value);
                    }
                }
                typeInfo = baseType.GetTypeInfo();
            }
            return properties;
        }
        return GetProperties(type);
    }

    private static Dictionary<string, PropertyInfo> GetProperties(Type type)
    {
        var typeInfo = type.GetTypeInfo();
        Dictionary<string, PropertyInfo> properties = new Dictionary<string, PropertyInfo>();
        foreach (var property in typeInfo.DeclaredProperties)
        {
            properties.Add(property.Name, property);
        }
        return properties;
    }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.