public void ListAttributes() { Dictionary <string, string> attrList = new Dictionary <string, string>(); MainWindow window = new MainWindow(new BlockViewModel(attrList)); Application.ShowModalWindow(window); if (window.isClicked == true) { //var objectIds = Utils.GetAllCurrentSpaceBlocksByName(window.NameBlock.Text); ObjectId mSpaceId = SymbolUtilityServices.GetBlockModelSpaceId(Active.Database); ObjectIdCollection objectIds = Utils.SelectDynamicBlockReferences(mSpaceId); List <Sheet> dict = new List <Sheet>(); List <PrintModel> printModels = new List <PrintModel>(); BlockAttribute objectNameEn = window.ComboObjectNameEn.SelectedItem as BlockAttribute; BlockAttribute objectNameRu = window.ComboObjectNameRu.SelectedItem as BlockAttribute; BlockAttribute position = window.ComboBoxPosition.SelectedItem as BlockAttribute; BlockAttribute nomination = window.ComboBoxNomination.SelectedItem as BlockAttribute; BlockAttribute comment = window.ComboBoxComment.SelectedItem as BlockAttribute; BlockAttribute trItem = window.ComboBoxTrItem.SelectedItem as BlockAttribute; BlockAttribute trDocNumber = window.ComboBoxTrDocNumber.SelectedItem as BlockAttribute; BlockAttribute trDocTitleEn = window.ComboBoxTrDocTitleEn.SelectedItem as BlockAttribute; BlockAttribute trDocTitleRu = window.ComboBoxTrDocTitleRu.SelectedItem as BlockAttribute; AttributModel attributModel = new AttributModel(objectNameEn, objectNameRu, position, nomination, comment, trItem, trDocNumber, trDocTitleEn, trDocTitleRu); using (Transaction tr = Active.Database.TransactionManager.StartTransaction()) { MyCommands.GetSheetsFromBlocks(Active.Editor, dict, tr, objectIds); string selAttrName = "НОМЕР_ЛИСТА"; MyCommands.GetPrintParametersToPdf(Active.Editor, printModels, tr, objectIds, selAttrName); if (window.transmittalCheckBox.IsChecked == true) { Utils utils = new Utils(); utils.CreateOnlyVed(dict); utils.CreateOnlytrans(dict); foreach (var printModel in printModels) { PlotCurrentLayout(printModel.DocNumber, printModel); } } else { //Utils utils = new Utils(); //utils.CreateOnlyVed(dict); foreach (var printModel in printModels) { //PlotCurrentLayout(printModel.DocNumber, printModel.BlockExtents3d, printModel.StampViewName); } } tr.Commit(); } } }
/// <summary> /// Обновление значения атрибута /// </summary> /// <param name="element">элемент</param> /// <param name="attributeName">имя атрибута</param> /// <param name="shift">сдвиг</param> /// <returns>флаг было ли обновлено значение атрибута</returns> public static bool UpdateAttributeValue(XElement element, BlockAttribute attributeName, int shift) { var attribute = element.Attribute(attributeName.ToString()); if (attribute != null) { element.SetAttributeValue(attributeName.ToString(), uint.Parse(attribute.Value) + shift); return(true); } return(false); }
public override By BuildBy() { BlockAttribute[] blocks = (BlockAttribute[])htmlElementType.GetCustomAttributes(typeof(BlockAttribute), true); if (blocks.Length > 0) { BlockAttribute block = blocks[0]; FindsByAttribute findsBy = block.Value; return(BuildByFromFindsBy(findsBy)); } throw new HtmlElementsException(string.Format("Cannot determine how to locate instance of {0}", htmlElementType)); }
public void InitData(BlockType _blockType, BlockAttribute _attr) { blockType = _blockType; attr = _attr; if (attr != null) { edNameKey.Text = attr.NameKey; edNameUI.Text = attr.NameUI; edOrder.Text = attr.Order.ToString(); cbMandatory.Checked = attr.Mandatory; } }
public bool HasAttribute(BlockAttribute attribute) { foreach (BlockAttribute ba in attributes) { if (ba == attribute) { return(true); } } return(false); }
private string GetNodeLink(XElement node) { string link = ""; int index = 0; BlockAttribute[] atrribates = new BlockAttribute[] { BlockAttribute.LINK, BlockAttribute.EI }; while ((link == "") && (index < atrribates.Length)) { link = node.Attribute(atrribates[index]); ++index; } return(link); }
private By BuildByFromHtmlElementAttributes(Type type) { FindsByAttribute[] findBys = (FindsByAttribute[])Field.GetCustomAttributes(typeof(FindsByAttribute)); if (findBys.Length > 0) { return(BuildByFromFindsBys(findBys)); } BlockAttribute[] blocks = (BlockAttribute[])type.GetCustomAttributes(typeof(BlockAttribute), true); if (blocks.Length > 0) { BlockAttribute block = blocks[0]; FindsByAttribute findsBy = block.Value; return(BuildByFromFindsBy(findsBy)); } return(BuildByFromDefault()); }
private string GetPersonName(XElement person) { StringBuilder builder = new StringBuilder(); BlockAttribute[] attributeOrder = new BlockAttribute[] { BlockAttribute.LN, BlockAttribute.FN, BlockAttribute.MN }; foreach (BlockAttribute attribute in attributeOrder) { string value = person.Attribute(attribute); if (!value.IsEmpty()) { if (!builder.IsEmpty()) { builder.Append(" "); } builder.Append(value); } } return(builder.ToString()); }
/// <summary> /// Анализ совпадения значений атрибута /// </summary> /// <param name="attribute">атрибут</param> /// <param name="contradiction">флаг нахождения противоречия</param> /// <param name="nonemptyPair">флаг, что проверяемые значения не пустые</param> /// <param name="applyFirstLetter">допускается проверка по первому символу</param> private void AnalizeAttribute(BlockAttribute attribute, ref bool contradiction, ref bool nonemptyPair, bool applyFirstLetter) { if (contradiction) { return; } string current = _CurrentNode.AttributeUpper(attribute); string compare = _CompareNode.AttributeUpper(attribute); if (current != compare) { if (!(current.IsEmpty() || compare.IsEmpty())) { if (applyFirstLetter && ((current.Length == 1) || (compare.Length == 1))) /// указан только инициал { if (current.FirstOrDefault() != compare.FirstOrDefault()) { contradiction = true; } else { nonemptyPair = true; } } else { contradiction = true; } } } else if (!current.IsEmpty()) { nonemptyPair = true; } }
/// <summary> /// 1チャック分のブロック属性を決める /// </summary> /// <param name="chunkPos">チャンク</param> /// <returns>1チャンク分のブロック属性</returns> public BlockAttribute[,,] CreateChunkBlockAttributes(IntVector3 chunkPos) { var attributes = Chunk.CreateChunkBlockArray <BlockAttribute>(() => new BlockAttribute(BlockTypes.Empty)); // チャンク座標をワールド座標に変換 IntVector3 chunkWorldPos = Chunk.ConvertChunkPosToWorldPos(chunkPos); // 地表の頂点座標を求める var peeks = this.CreateChunkPeeks(chunkWorldPos); if ((attributes.GetLength(0) != peeks.GetLength(0)) || (attributes.GetLength(2) != peeks.GetLength(1))) { Debug.LogError($"生成した地表の頂点座標配列のサイズが不正です サイズ:[{peeks.GetLength(0)}, {peeks.GetLength(1)}]"); return(attributes); } // 地表のブロック属性を決める for (int z = 0, zEnd = attributes.GetLength(0); z < zEnd; z++) { for (int x = 0, xEnd = attributes.GetLength(2); x < xEnd; x++) { int peek = peeks[z, x]; // 頂点がこのチャンクより下にあるなら飛ばす if (peek < chunkWorldPos.y) { continue; } for (int y = 0; y < peek; y++) { attributes[z, y, x] = new BlockAttribute(BlockTypes.Dirt); } // 地表の1ブロックは草にする attributes[z, peek, x] = new BlockAttribute(BlockTypes.Grass); } } return(attributes); }
private static string CorrectAttributeValue(string xmlText, BlockAttribute attribute) { Regex attributeValue = new Regex(attribute.ToString() + "=\".*?\""); return(attributeValue.Replace(xmlText, new MatchEvaluator(Encoder))); }
/// <summary> /// Обновление параметров атрибута в хранилище. /// </summary> /// <param name="attr">объект типа BlockAttribute</param> public abstract void AttributeUpdate(BlockAttribute attr);
/// <summary> /// Проверяет наличие атрибута /// </summary> /// <param name="element"></param> /// <param name="attribute">имя атрибута</param> /// <returns></returns> public static bool IsContainAttribute(this XElement element, BlockAttribute attribute) { return(element.IsContainAttribute(attribute.ToString())); }
protected static void SendToPrefabEditors <T>(Master master, GameObject block, T prefabComponent, bool asPreview, BlockAttribute sender) { foreach (Component component in block.GetComponents <Component>()) { if (component is IPrefabEditor <T> prefabEditor) { prefabEditor.OnPrefab(master, prefabComponent, asPreview, sender); } } }
public override void AttributeUpdate(BlockAttribute attr) { dbConnector.AttributeUpdate(attr); }