示例#1
0
 private void TabItemClosed(string tagname)
 {
     if (ModelName.Equals(tagname))
     {
         IsViewActive = false;
     }
 }
示例#2
0
        /// <summary>
        /// Returns true if DetailedGear instances are equal
        /// </summary>
        /// <param name="other">Instance of DetailedGear to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(DetailedGear other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     BrandName == other.BrandName ||
                     BrandName != null &&
                     BrandName.Equals(other.BrandName)
                     ) &&
                 (
                     ModelName == other.ModelName ||
                     ModelName != null &&
                     ModelName.Equals(other.ModelName)
                 ) &&
                 (
                     FrameType == other.FrameType ||
                     FrameType != null &&
                     FrameType.Equals(other.FrameType)
                 ) &&
                 (
                     Description == other.Description ||
                     Description != null &&
                     Description.Equals(other.Description)
                 ));
        }
示例#3
0
        // override object.Equals
        public override bool Equals(object obj)
        {
            Product product = obj as Product;

            if (obj == null)
            {
                return(false);
            }

            return(ModelName.Equals(product.ModelName));
        }
示例#4
0
        public override bool Equals(object obj)
        {
            Vehicle vehicle = (Vehicle)obj;

            if (vehicle != null)
            {
                return(Type.Equals(vehicle.Type) && ModelName.Equals(vehicle.ModelName));
            }
            else
            {
                throw new Exception("It is not possible to compare two objects");
            }
        }
示例#5
0
 public void TabItemSelected(string tagname)
 {
     if (ModelName.Equals(tagname))
     {
         IsViewActive = true;
         TabActivate();
     }
     else
     {
         IsViewActive = false;
         TabDisActivate();
     }
 }
示例#6
0
        public async Task OnPostEdit([Bind("Id, Value")] ModelName modelName)
        {
            var oldName = _context.ModelNames.AsNoTracking().SingleOrDefault(n => n.Id == modelName.Id);

            if (ModelState.IsValid)
            {
                if (!modelName.Equals(oldName) && !_context.ModelNames.Any(n => n.Value == modelName.Value && n.Id != modelName.Id))
                {
                    oldName = modelName;
                    _context.ModelNames.Update(oldName);
                    await _context.SaveChangesAsync();
                }
                else
                {
                    ModelState.AddModelError("Value", "Дане ім'я не є унікальним");
                    ModelState["Value"].ValidationState = ModelValidationState.Invalid;
                }
            }
            Names = await _context.ModelNames.ToListAsync();
        }
示例#7
0
        public override bool Equals(object obj)
        {
            if (ReferenceEquals(this, obj))
            {
                return(true);
            }
            var oth = obj as ModemStatus;

            if (oth == null)
            {
                return(false);
            }
            return(IsSuccess == oth.IsSuccess &&
                   State.Equals(oth.State) &&
                   Manufacturer.Equals(oth.Manufacturer) &&
                   ModelName.Equals(oth.ModelName) &&
                   SerialNumber.Equals(oth.SerialNumber) &&
                   SignalQuality == oth.SignalQuality &&
                   Imsi.Equals(oth.Imsi) &&
                   Imei.Equals(oth.Imei) &&
                   OperatorName.Equals(oth.OperatorName));
        }
示例#8
0
 public override bool Equals(object obj)
 {
     return(obj is Vehicle vehicle &&
            Type.TypeName.Equals(vehicle.Type.TypeName) &&
            ModelName.Equals(vehicle.ModelName));
 }
示例#9
0
        public void FirmwareUpdate(string fullPathfilename, byte[] bytes)
        {
            try
            {
                if (bytes.Length > 0)
                {
                    /*TODO: GUI UNIT TEST
                     * new Thread(() =>
                     * {
                     *  Thread.CurrentThread.IsBackground = false;
                     *
                     *  for(int i = 1; i <= bytes.Length / 1024; i++)
                     *  {
                     *      Debug.WriteLine("device: sent block {0} of {1}", i.ToString(), (bytes.Length / 1024).ToString());
                     *      string [] message = { i.ToString() };
                     *      NotificationRaise(new DeviceNotificationEventArgs { NotificationType = NOTIFICATION_TYPE.NT_FIRMWARE_UPDATE_STEP, Message = message });
                     *      Thread.Sleep(10);
                     *  }
                     *  Thread.Sleep(1000);
                     *  SetDeviceFirmwareVersion();
                     * }).Start();
                     *
                     * return;*/

                    // Validate FW Signature
                    byte[] FirmwareSignature = new byte[64];
                    Array.Copy(bytes, 64, FirmwareSignature, 0, 32);
                    DeviceFirmwareSignature     Signature = new DeviceFirmwareSignature();
                    Dictionary <string, string> Values    = Common.processTLVUnencrypted(FirmwareSignature);

                    foreach (var Item in Values)
                    {
                        switch (Int32.Parse(Item.Key))
                        {
                        case (int)DeviceFirmwareSignature.SignatureIndex.SIG_VERSION:
                        {
                            Signature.Version = Common.hexStringToString(Item.Value);
                            break;
                        }

                        case (int)DeviceFirmwareSignature.SignatureIndex.SIG_MODELNAME:
                        {
                            Signature.ModelName = Common.hexStringToString(Item.Value);
                            break;
                        }

                        case (int)DeviceFirmwareSignature.SignatureIndex.SIG_TYPE:
                        {
                            Signature.Type = Item.Value;
                            break;
                        }
                        }
                    }

                    foreach (var ModelName in Signature.Devices.Where(x => x.Key.Equals(DeviceInformation.ModelName, StringComparison.CurrentCultureIgnoreCase)).Select(y => y.Value))
                    {
                        if (ModelName.Equals(Signature.ModelName, StringComparison.CurrentCultureIgnoreCase))
                        {
                            RETURN_CODE rt = IDT_Device.SharedController.device_updateDeviceFirmware(bytes);
                            if (rt == RETURN_CODE.RETURN_CODE_DO_SUCCESS)
                            {
                                string filename = System.IO.Path.GetFileName(fullPathfilename);
                                Logger.debug("device: firmware update started for: {0}", filename);
                                firmwareUpdate = true;
                            }
                            else
                            {
                                Logger.error("device: firmware Update Failed Error Code: 0x{0:X}", (ushort)rt);
                            }
                        }
                        else
                        {
                            string [] message = { string.Format("UPDATE FAILED: [{0}] FIRMWARE DOESN'T MATCH DEVICE MODEL {1}", Signature.ModelName, DeviceInformation.ModelName) };
                            Logger.error("device: {0}", message[0]);
                            NotificationRaise(new DeviceNotificationEventArgs {
                                NotificationType = NOTIFICATION_TYPE.NT_FIRMWARE_UPDATE_FAILED, Message = message
                            });
                            break;
                        }
                    }
                }
            }
            catch (Exception exp)
            {
                Logger.error("device: FirmwareUpdate() - exception={0}", (object)exp.Message);
            }
        }