internal static void SetDictionaryValue(General block, Snap.UI.Block.PropertyType propType, string propName, object propValue, Dictionary <PropertyKey, object> dict) { PropertyKey key = new PropertyKey(propType, propName); if (!dict.ContainsKey(key)) { dict.Add(key, propValue); } if ((propType == Snap.UI.Block.PropertyType.IntegerArray) && (propValue != null)) { int[] numArray = (int[])propValue; int[] numArray2 = (int[])numArray.Clone(); dict[key] = numArray2; } else if ((propType == Snap.UI.Block.PropertyType.DoubleArray) && (propValue != null)) { double[] numArray3 = (double[])propValue; double[] numArray4 = (double[])numArray3.Clone(); dict[key] = numArray4; } if ((propType == Snap.UI.Block.PropertyType.IntegerMatrix) && (propValue != null)) { int[,] numArray5 = (int[, ])propValue; int[,] numArray6 = (int[, ])numArray5.Clone(); dict[key] = numArray6; } else if ((propType == Snap.UI.Block.PropertyType.DoubleMatrix) && (propValue != null)) { double[,] numArray7 = (double[, ])propValue; double[,] numArray8 = (double[, ])numArray7.Clone(); dict[key] = numArray8; } else if ((propType == Snap.UI.Block.PropertyType.StringArray) && (propValue != null)) { string[] strArray = (string[])propValue; string[] strArray2 = (string[])strArray.Clone(); dict[key] = strArray2; } else if ((propType == Snap.UI.Block.PropertyType.ObjectArray) && (propValue != null)) { TaggedObject[] objArray = (TaggedObject[])propValue; TaggedObject[] objArray2 = (TaggedObject[])objArray.Clone(); dict[key] = objArray2; } else if ((propType == Snap.UI.Block.PropertyType.EnumMembers) && (propValue != null)) { string[] strArray3 = (string[])propValue; string[] strArray4 = (string[])strArray3.Clone(); dict[key] = strArray4; } else if ((propType == Snap.UI.Block.PropertyType.Filter) && (propValue != null)) { Selection.MaskTriple[] tripleArray = (Selection.MaskTriple[])propValue; Selection.MaskTriple[] tripleArray2 = (Selection.MaskTriple[])tripleArray.Clone(); dict[key] = tripleArray2; } else { dict[key] = propValue; } }
private static void SetNxopenBlockValue(General block, Snap.UI.Block.PropertyType propType, string propName, object propValue) { UIBlock nXOpenBlock = block.NXOpenBlock; if (propType == Snap.UI.Block.PropertyType.Double) { NxSetDouble(nXOpenBlock, propName, (double)propValue); } if (propType == Snap.UI.Block.PropertyType.Integer) { NxSetInteger(nXOpenBlock, propName, (int)propValue); } if (propType == Snap.UI.Block.PropertyType.Logical) { NxSetLogical(nXOpenBlock, propName, (bool)propValue); } if (propType == Snap.UI.Block.PropertyType.String) { NxSetString(nXOpenBlock, propName, (string)propValue); } if (propType == Snap.UI.Block.PropertyType.Enum) { NxSetEnum(nXOpenBlock, propName, (int)propValue); } if (propType == Snap.UI.Block.PropertyType.EnumAsString) { NxSetEnumAsString(nXOpenBlock, propName, (string)propValue); } if (propType == Snap.UI.Block.PropertyType.EnumMembers) { NxSetEnumMembers(nXOpenBlock, propName, (string[])propValue); } if (propType == Snap.UI.Block.PropertyType.DoubleArray) { NxSetDoubleArray(nXOpenBlock, propName, (double[])propValue); } if (propType == Snap.UI.Block.PropertyType.IntegerArray) { NxSetIntegerArray(nXOpenBlock, propName, (int[])propValue); } if (propType == Snap.UI.Block.PropertyType.DoubleMatrix) { NxSetDoubleMatrix(nXOpenBlock, propName, (double[, ])propValue); } if (propType == Snap.UI.Block.PropertyType.IntegerMatrix) { NxSetIntegerMatrix(nXOpenBlock, propName, (int[, ])propValue); } if (propType == Snap.UI.Block.PropertyType.StringArray) { NxSetStringArray(nXOpenBlock, propName, (string[])propValue); } if (propType == Snap.UI.Block.PropertyType.ObjectArray) { NxSetObjectArray(nXOpenBlock, propName, (TaggedObject[])propValue); } if (propType == Snap.UI.Block.PropertyType.Point) { NxSetPoint(nXOpenBlock, propName, (Position)propValue); } if (propType == Snap.UI.Block.PropertyType.Vector) { NxSetVector(nXOpenBlock, propName, (Vector)propValue); } if (propType == Snap.UI.Block.PropertyType.Object) { NxSetObject(nXOpenBlock, propName, (TaggedObject)propValue); } if (propType == Snap.UI.Block.PropertyType.BitArray) { NxSetBits(nXOpenBlock, propName, (int)propValue); } if (propType == Snap.UI.Block.PropertyType.File) { NxSetFile(nXOpenBlock, propName, (string)propValue); } if (propType == Snap.UI.Block.PropertyType.Filter) { NxSetFilter(nXOpenBlock, propName, (Selection.MaskTriple[])propValue); } }
internal static object GetNxopenBlockValue(General block, Snap.UI.Block.PropertyType propType, string propName) { UIBlock nXOpenBlock = block.NXOpenBlock; object obj2 = null; if (propType == Snap.UI.Block.PropertyType.Double) { obj2 = NxGetDouble(nXOpenBlock, propName); } if (propType == Snap.UI.Block.PropertyType.Integer) { obj2 = NxGetInteger(nXOpenBlock, propName); } if (propType == Snap.UI.Block.PropertyType.Logical) { obj2 = NxGetLogical(nXOpenBlock, propName); } if (propType == Snap.UI.Block.PropertyType.String) { obj2 = NxGetString(nXOpenBlock, propName); } if (propType == Snap.UI.Block.PropertyType.Enum) { obj2 = NxGetEnum(nXOpenBlock, propName); } if (propType == Snap.UI.Block.PropertyType.EnumAsString) { obj2 = NxGetEnumAsString(nXOpenBlock, propName); } if (propType == Snap.UI.Block.PropertyType.EnumMembers) { obj2 = NxGetEnumMembers(nXOpenBlock, propName); } if (propType == Snap.UI.Block.PropertyType.DoubleArray) { obj2 = NxGetDoubleArray(nXOpenBlock, propName); } if (propType == Snap.UI.Block.PropertyType.IntegerArray) { obj2 = NxGetIntegerArray(nXOpenBlock, propName); } if (propType == Snap.UI.Block.PropertyType.DoubleMatrix) { obj2 = NxGetDoubleMatrix(nXOpenBlock, propName); } if (propType == Snap.UI.Block.PropertyType.IntegerMatrix) { obj2 = NxGetIntegerMatrix(nXOpenBlock, propName); } if (propType == Snap.UI.Block.PropertyType.StringArray) { obj2 = NxGetStringArray(nXOpenBlock, propName); } if (propType == Snap.UI.Block.PropertyType.ObjectArray) { obj2 = NxGetObjectArray(nXOpenBlock, propName); } if (propType == Snap.UI.Block.PropertyType.Point) { obj2 = NxGetPoint(nXOpenBlock, propName); } if (propType == Snap.UI.Block.PropertyType.Vector) { obj2 = NxGetVector(nXOpenBlock, propName); } if (propType == Snap.UI.Block.PropertyType.Object) { obj2 = NxGetObject(nXOpenBlock, propName); } if (propType == Snap.UI.Block.PropertyType.BitArray) { obj2 = NxGetBits(nXOpenBlock, propName); } if (propType == Snap.UI.Block.PropertyType.File) { obj2 = NxGetFile(nXOpenBlock, propName); } return(obj2); }
internal static void DictionaryToBlock(General block, PropertyKey propKey) { object propValue = block.PropertyDictionary[propKey]; SetNxopenBlockValue(block, propKey.Type, propKey.Name, propValue); }
internal static void AddProperty(General block, PropertyKey propKey, object propValue) { block.PropertyDictionary.Add(propKey, propValue); }
internal SnapPointsStateSet(General ownerBlock) { this.OwnerBlock = ownerBlock; this.SetAll(SnapPointState.Hidden); }
void SetDefaultValue(ElecManage.ElectrodeInfo info) { //赋值 strElecName.Value = info == null ? string.Empty : info.Elec_Name;; txtFINISHNUMBER.Value = (info == null ? 0 : info.FINISH_NUMBER); txtMIDDLENUMBER.Value = (info == null ? 0 : info.MIDDLE_NUMBER); txtROUGHNUMBER.Value = (info == null ? 0 : info.ROUGH_NUMBER); txtFINISHSPACE.Value = (info == null ? 0 : info.FINISH_SPACE); txtMIDDLESPACE.Value = (info == null ? 0 : info.MIDDLE_SPACE); txtROUGHSPACE.Value = (info == null ? 0 : info.ROUGH_SPACE); stringExp.Value = (info == null ? string.Empty : info.ASSEMBLYEXP); stringExp1.Value = (info == null ? string.Empty : info.ASSEMBLYEXP1); double matchJiajuValue = 0; _configData.Poperties.ForEach(u => { var dic = new Dictionary <Snap.UI.Block.General, string>(); Snap.UI.Block.General cbb = null; var realValue = string.Empty; if (u.DisplayName == "电极材质") { realValue = info == null ? string.Empty : info.MAT_NAME; cbb = cboxMATNAME; if (_configData.IsMatNameSel) { dic.Add(cboxMMATNAME, info == null ? string.Empty : info.M_MAT_NAME); if (!dic.ContainsKey(cboxRMATNAME)) { dic.Add(cboxRMATNAME, info == null ? string.Empty : info.R_MAT_NAME); } } } else if (u.DisplayName == "加工方向") { realValue = info == null ? string.Empty : info.EDMPROCDIRECTION; cbb = cbbProdirection; } else if (u.DisplayName == "电极类型") { realValue = info == null ? string.Empty : info.UNIT; cbb = cbbElecType; } else if (u.DisplayName == "摇摆方式") { realValue = info == null ? string.Empty : info.EDMROCK; cbb = cbbRock; } else if (u.DisplayName == "精公光洁度") { realValue = info == null ? string.Empty : info.F_SMOOTH; cbb = cbbFSmoth; } else if (u.DisplayName == "中公光洁度") { realValue = info == null ? string.Empty : info.M_SMOOTH; cbb = cbbMSmoth; } else if (u.DisplayName == "粗公光洁度") { realValue = info == null ? string.Empty : info.R_SMOOTH; cbb = cbbRSmoth; } else if (u.DisplayName == "夹具类型") { realValue = info == null ? string.Empty : info.ELEC_CLAMP_GENERAL_TYPE; cbb = cbbChuckType; } else if (u.DisplayName == "间隙方式") { realValue = info == null ? string.Empty : info.CAPSET; cbb = cbbCAPSET; } else if (u.DisplayName == "摇动平面形状") { realValue = info == null ? string.Empty : info.EDMROCKSHAPE; cbb = cbbRockShape; } else if (u.DisplayName == "电极形状") { realValue = info == null ? string.Empty : info.EDMSHAPE; cbb = cbbShape; } if (cbb is Snap.UI.Block.Enumeration) { if (!dic.ContainsKey(cbb)) { dic.Add(cbb, realValue); } } foreach (var item in dic) { var enumration = item.Key as Snap.UI.Block.Enumeration; var rValue = item.Value; var defaultSelection = string.IsNullOrEmpty(rValue) ? (u.Selections.FirstOrDefault(m => m.IsDefault)) : u.Selections.FirstOrDefault(m => m.Value == rValue); if (u.DisplayName == "夹具类型") { defaultSelection = string.IsNullOrEmpty(rValue) ? (MatchJiaju(info) ?? u.Selections.FirstOrDefault(m => m.IsDefault)) : u.Selections.FirstOrDefault(m => m.Value == rValue); if (defaultSelection != null) { matchJiajuValue = EactConfig.MatchJiaju.GetDouble(defaultSelection.Ex2); } } if (defaultSelection != null) { defaultSelection = u.Selections.FirstOrDefault(m => m.Value == defaultSelection.Value); if (defaultSelection != null) { u.Selections.Remove(defaultSelection); u.Selections.Insert(0, defaultSelection); } } enumration.Items = Enumerable.Select(u.Selections, m => m.Value).ToArray(); } }); if (info != null) { strElecSize.Value = info.ElecSize; strElecCuttingSize.Value = info.ElecCuttingSize(_configData, matchJiajuValue); } else { strElecSize.Value = string.Empty; strElecCuttingSize.Value = string.Empty; } }