Ejemplo n.º 1
0
 public override int GetHashCode()
 {
     return(DPI.GetHashCode() ^
            PollRate.GetHashCode() ^
            ShowLastMouseMove.GetHashCode() ^
            ShowVelocityAndGain.GetHashCode());
 }
Ejemplo n.º 2
0
 public override int GetHashCode()
 {
     return(DPI.GetHashCode() ^
            PollRate.GetHashCode() ^
            ShowLastMouseMove.GetHashCode() ^
            ShowVelocityAndGain.GetHashCode() ^
            AutoWriteToDriverOnStartup.GetHashCode());
 }
Ejemplo n.º 3
0
        public override Dictionary <string, object> ToUpdate(IMemoryCache memoryCache, out BaseModel updatedElement)
        {
            Dictionary <string, object> changes = new Dictionary <string, object>();
            Sensor refInCache = null;

            if (Id != Guid.Empty)
            {
                refInCache = CacheHelper.GetSensorFromCache(memoryCache, Id);

                if (refInCache != null)
                {
                    if (!DeviceId.Equals(refInCache.DeviceId))
                    {
                        changes.Add("DeviceId", DeviceId);
                        refInCache.DeviceId = DeviceId;
                    }
                    if (HardwareId != null && !HardwareId.Equals(refInCache.HardwareId))
                    {
                        changes.Add("HardwareId", HardwareId);
                        refInCache.HardwareId = HardwareId;
                    }
                    if (SpaceId != null && !SpaceId.Equals(refInCache.SpaceId))
                    {
                        changes.Add("SpaceId", SpaceId);
                        refInCache.SpaceId = SpaceId;
                    }
                    if (!PollRate.Equals(refInCache.PollRate))
                    {
                        changes.Add("PollRate", PollRate);
                        refInCache.PollRate = PollRate;
                    }
                    if (PortType != null && !PortType.Equals(refInCache.PortType))
                    {
                        changes.Add("PortType", PortType);
                        refInCache.PortType = PortType;
                    }
                    if (DataType != null && !DataType.Equals(refInCache.DataType))
                    {
                        changes.Add("DataType", DataType);
                        refInCache.DataType = DataType;
                    }
                    if (DataUnitType != null && !DataUnitType.Equals(refInCache.DataUnitType))
                    {
                        changes.Add("DataUnitType", DataUnitType);
                        refInCache.DataUnitType = DataUnitType;
                    }
                    if (DataSubtype != null && !DataSubtype.Equals(refInCache.DataSubtype))
                    {
                        changes.Add("DataSubtype", DataSubtype);
                        refInCache.DataSubtype = DataSubtype;
                    }
                }
                else
                {
                    refInCache = this;
                    if (DeviceId != null)
                    {
                        changes.Add("DeviceId", DeviceId);
                    }
                    if (HardwareId != null)
                    {
                        changes.Add("HardwareId", HardwareId);
                    }
                    if (SpaceId != null)
                    {
                        changes.Add("SpaceId", SpaceId);
                    }
                    if (PollRate != 0)
                    {
                        changes.Add("PollRate", PollRate);
                    }
                    if (PortType != null)
                    {
                        changes.Add("PortType", PortType);
                    }
                    if (DataType != null)
                    {
                        changes.Add("DataType", DataType);
                    }
                    if (DataUnitType != null)
                    {
                        changes.Add("DataUnitType", DataUnitType);
                    }
                    if (DataSubtype != null)
                    {
                        changes.Add("DataSubTypeId", DataSubTypeId);
                    }
                }
            }
            updatedElement = refInCache;
            return(changes);
        }