public ProfileModifierViewModel(IProfileModifier model, ICommandsAggregateService commands, IDialogService dialogService) : base(model, commands) { DialogService = dialogService; ParentProfile = Modifier.GetParentProfile(); CharacteristicTypes = ParentProfile.TypeLink.Target.CharacteristicTypes; Fields = CharacteristicTypes.Select(type => type.Id).ToArray(); IsFieldActive = CanFieldBeActive(); IsValueActive = CanValueBeActive(); }
/// <summary> /// Use the lookup table /// </summary> internal static CharacteristicTypes GetSensorCharacteristicType(string uuid) { CharacteristicTypes res = CharacteristicTypes.NOTFOUND; if (Characters.Keys.Contains(uuid.ToUpper())) { var rt = Characters[uuid.ToUpper()]; res = rt.Item2; } //Could also pass the sensor as its known when this is called and validate against rt.Item1 return(res); }
/// <summary> /// /// </summary> /// <param name="controlName"></param> private void GetControlID(string controlName) { try { controlName = controlName.Replace("grd", string.Empty).ToLower(); controlName = controlName.Replace("btndelete", string.Empty).ToLower(); controlName = controlName.Replace("chkselect", string.Empty).ToLower(); switch (controlName) { case "colour": CharCode = CharacteristicTypes.Where(c => c.Description.ToLower() == "color" || c.Description.ToLower() == "colour").FirstOrDefault().Code; grdCharacteristic = grdColour; chkCharacteristic = chkSelectColour; CharHeaderText = "Color"; break; case "size": CharCode = CharacteristicTypes.Where(c => c.Description.ToLower() == "size").FirstOrDefault().Code; grdCharacteristic = grdSize; chkCharacteristic = chkSelectSize; CharHeaderText = "Size"; break; case "style": CharCode = CharacteristicTypes.Where(c => c.Description.ToLower() == "style").FirstOrDefault().Code; grdCharacteristic = grdStyle; chkCharacteristic = chkSelectStyle; CharHeaderText = "Style"; break; case "fabric": CharCode = CharacteristicTypes.Where(c => c.Description.ToLower() == "fabric").FirstOrDefault().Code; grdCharacteristic = grdFabric; chkCharacteristic = chkSelectFabric; CharHeaderText = "Fabric"; break; default: break; } } catch (Exception ex) { Logger.Log(ex, Logger.LogingLevel.Error); throw ex; } }
/// <summary> /// /// </summary> /// <param name="gridName"></param> /// <returns></returns> private string GetCharCode(string gridName) { try { gridName = gridName.Replace("grd", string.Empty).ToLower(); switch (gridName) { case "colour": CharCode = CharacteristicTypes.Where(c => c.Description.ToLower() == "color" || c.Description.ToLower() == "colour").FirstOrDefault().Code; CharHeaderText = "Color"; break; case "size": CharCode = CharacteristicTypes.Where(c => c.Description.ToLower() == "size").FirstOrDefault().Code; CharHeaderText = "Size"; break; case "style": CharCode = CharacteristicTypes.Where(c => c.Description.ToLower() == "style").FirstOrDefault().Code; CharHeaderText = "Style"; break; case "fabric": CharCode = CharacteristicTypes.Where(c => c.Description.ToLower() == "fabric").FirstOrDefault().Code; CharHeaderText = "Fabric"; break; default: break; } return(CharCode); } catch (Exception ex) { Logger.Log(ex, Logger.LogingLevel.Error); throw ex; } }
private void AddEntryes() { #region ValueType ValueType valueIntType = new ValueType("int"); ValueType valueStringType = new ValueType("string"); ValueType valueFloatType = new ValueType("float"); ValueType valueBoolType = new ValueType("bool"); ValueTypes.Add(valueIntType); ValueTypes.Add(valueStringType); ValueTypes.Add(valueFloatType); ValueTypes.Add(valueBoolType); SaveChanges(); #endregion #region DeviceType DeviceType deviceLaptopType = new DeviceType("Ноутбук", Properties.Resources.Laptop); DeviceTypes.Add(deviceLaptopType); SaveChanges(); #endregion #region Devices Device device1 = new Device(deviceLaptopType.ID, "Samsung NC10"); Device device2 = new Device(deviceLaptopType.ID, "ASUS K50IN"); Devices.Add(device1); Devices.Add(device2); SaveChanges(); #endregion #region CharacteristicType CharacteristicType characteristicType_Webcam = new CharacteristicType(deviceLaptopType.ID, "Веб-камера", valueBoolType.ID); CharacteristicType characteristicType_VideoCard = new CharacteristicType(deviceLaptopType.ID, "Видеокарта", valueStringType.ID); CharacteristicType characteristicType_WorkingHours = new CharacteristicType(deviceLaptopType.ID, "Время работы", valueIntType.ID); CharacteristicType characteristicType_Screen = new CharacteristicType(deviceLaptopType.ID, "Диагональ экрана", valueFloatType.ID); CharacteristicType characteristicType_Storage = new CharacteristicType(deviceLaptopType.ID, "Накопитель", valueIntType.ID); CharacteristicType characteristicType_RAM = new CharacteristicType(deviceLaptopType.ID, "Оперативная память", valueIntType.ID); CharacteristicType characteristicType_CPU = new CharacteristicType(deviceLaptopType.ID, "Процессор", valueStringType.ID); CharacteristicTypes.Add(characteristicType_Webcam); CharacteristicTypes.Add(characteristicType_VideoCard); CharacteristicTypes.Add(characteristicType_WorkingHours); CharacteristicTypes.Add(characteristicType_Screen); CharacteristicTypes.Add(characteristicType_Storage); CharacteristicTypes.Add(characteristicType_RAM); CharacteristicTypes.Add(characteristicType_CPU); SaveChanges(); #endregion #region Characteristics //1 Samsung NC10 Characteristic char1_Webcam = new Characteristic(device1.ID, characteristicType_Webcam.ID, "true"); Characteristic char1_VideoCard = new Characteristic(device1.ID, characteristicType_VideoCard.ID, "Intel GMA 952 (встроенная)"); Characteristic char1_WorkingHours = new Characteristic(device1.ID, characteristicType_WorkingHours.ID, "6"); Characteristic char1_Screen = new Characteristic(device1.ID, characteristicType_Screen.ID, "10,20"); Characteristic char1_Storage = new Characteristic(device1.ID, characteristicType_Storage.ID, "80"); Characteristic char1_RAM = new Characteristic(device1.ID, characteristicType_RAM.ID, "1"); Characteristic char1_CPU = new Characteristic(device1.ID, characteristicType_CPU.ID, "Intel 945GSE"); Characteristics.Add(char1_Webcam); Characteristics.Add(char1_VideoCard); Characteristics.Add(char1_WorkingHours); Characteristics.Add(char1_Screen); Characteristics.Add(char1_Storage); Characteristics.Add(char1_RAM); Characteristics.Add(char1_CPU); //2 ASUS K50IN Characteristic char2_Webcam = new Characteristic(device2.ID, characteristicType_Webcam.ID, "true"); Characteristic char2_VideoCard = new Characteristic(device2.ID, characteristicType_VideoCard.ID, "NVIDIA GeForce G 102M (дискретная)"); Characteristic char2_WorkingHours = new Characteristic(device2.ID, characteristicType_WorkingHours.ID, "6"); Characteristic char2_Screen = new Characteristic(device2.ID, characteristicType_Screen.ID, "15,6"); Characteristic char2_Storage = new Characteristic(device2.ID, characteristicType_Storage.ID, "250"); Characteristic char2_RAM = new Characteristic(device2.ID, characteristicType_RAM.ID, "2"); Characteristics.Add(char2_Webcam); Characteristics.Add(char2_VideoCard); Characteristics.Add(char2_WorkingHours); Characteristics.Add(char2_Screen); Characteristics.Add(char2_Storage); Characteristics.Add(char2_RAM); SaveChanges(); #endregion }