public ConfigurationServiceResponse InstallFromStorage(string source) { var response = new ConfigurationServiceResponse(); try { if (!CheckLicense(source)) { throw new LicException(); } bool canExecuteOperation = GetInstallPackageRights(); if (!canExecuteOperation) { throw new SecurityException( string.Format( new LocalizableString("Terrasoft.Core", "DBSecurityEngine.Exception.Admin.UnitCannotExecuteAdminOperation"), "CanManageSolution")); } InstallStorage(source); WorkspaceBuilder workspaceBuilder = WorkspaceBuilderUtility.CreateWorkspaceBuilder(UserConnection.AppConnection); CompilerErrorCollection compilerErrors = workspaceBuilder.Build(UserConnection.Workspace); if (GetIsError(compilerErrors)) { throw new Exception(new LocalizableString("Terrasoft.WebApp", "CompilationErrors.Caption")); } WorkspaceUtilities.ForceGetCustomPackageUId(UserConnection); } catch (Exception exception) { response.Exception = exception; } return(response); }
/// <summary> /// Call this method to determine if the task should be scheduled for /// execution. /// </summary> /// <param name="workspaceModel">Render packages for all the nodes in /// this workspaceModel will be extracted, if 'nodeModel' parameter is /// null.</param> /// <param name="nodeModel">An optional NodeModel from which all upstream /// nodes are to be examined for render packages. If this parameter is /// null, render packages are extracted from all nodes in workspaceModel. /// </param> /// <returns>Returns true if the task should be scheduled for execution, /// or false otherwise.</returns> /// internal bool Initialize(WorkspaceModel workspaceModel, NodeModel nodeModel) { if (workspaceModel == null) { throw new ArgumentNullException("workspaceModel"); } if (nodeModel == null) // No node is specified, gather all nodes. { targetedNodeId = Guid.Empty; // Duplicate a list of all nodes for consumption later. var nodes = workspaceModel.Nodes.Where(n => n.IsVisible); duplicatedNodeReferences = nodes.ToList(); } else { targetedNodeId = nodeModel.GUID; // Recursively gather all upstream nodes. Stop // gathering if this node does not display upstream. var gathered = new List <NodeModel>(); WorkspaceUtilities.GatherAllUpstreamNodes(nodeModel, gathered, model => model.IsUpstreamVisible); duplicatedNodeReferences = gathered; } return(duplicatedNodeReferences.Any()); }
/// <summary> /// Finds exists schema data UId by name and package UId, if not exist generate new UId. /// </summary> /// <param name="packageUId">Package UId</param> /// <param name="schemaDataName">Schema data name</param> /// <returns></returns> private Guid GetSchemaDataUId(Guid packageUId, string schemaDataName) { var packageId = GetPackageIdByUId(packageUId); var schemaDataUId = WorkspaceUtilities.FindSchemaDataUIdByName(packageId, schemaDataName, UserConnection); if (schemaDataUId.IsEmpty()) { schemaDataUId = Guid.NewGuid(); } return(schemaDataUId); }
private void CreateImportItem(List <ImportItem> importItems) { BMECInstanceManager instanceManager = BMECApi.Instance.InstanceManager; foreach (ImportItem importItem in importItems) { if (string.IsNullOrEmpty(importItem.Key) || !importItem.Valid) { //log-- this means there are blank records continue; } System.Windows.Forms.Application.DoEvents(); ArrayList associations = new ArrayList(); ArrayList propertyValues = new ArrayList(); //use the instance to set the properties foreach (IECPropertyValue propertyValue in importItem.Instance) { if (propertyValue.IsNull) { continue; } if (propertyValue.StringValue == null) { continue; } string pval = string.Format("{0}={1}", propertyValue.AccessString, propertyValue.StringValue); propertyValues.Add(pval); } foreach (string rItem in importItem.RelationClassValueCache.Keys) { string relatedVal = string.Format("{0}={1}", rItem, importItem.RelationClassValueCache[rItem]); associations.Add(relatedVal); } string clsName = importItem.Instance.ClassDefinition.Name; if (associations.Count > 0) { WorkspaceUtilities.SaveSettings("Associations." + clsName, associations); } IECInstance ecInstance = instanceManager.CreateECInstance(clsName); BMECApi.Instance.SpecProcessor.FillCurrentPreferences(ecInstance, true); ECInstanceDialog ecDlg = new ECInstanceDialog(importItem.Instance); ecDlg.InitializeWithCustomProperties(associations, propertyValues, true); ecDlg.SaveData(false); } }
public void UpdateWBSParts(IECInstance selectedECInstance) { try { if (selectedECInstance == null) { return; } ArrayList assocItems = SchemaUtilities.GetAssociatedItemInformation(selectedECInstance.ClassDefinition); UpdateWBSParts(assocItems, selectedECInstance); } catch (Exception ex) { WorkspaceUtilities.DisplayErrorMessage(ex.Message, string.Empty); } }
private void SaveSettings() { ArrayList arr = new ArrayList(); for (int i = 0; i < this.Rows.Count; i++) { //DataGridViewTextBoxCell itemTypeCell = this[s_wbsClass, i] as DataGridViewTextBoxCell; //IECClass ecClass = itemTypeCell.Tag as IECClass; DataGridViewComboBoxCell itemInstanceCell = this[s_WBSInstanceKey, i] as DataGridViewComboBoxCell; string selectedInstanceString = itemInstanceCell.Value as string; IECClass ecClass = getECClassInformationForCurrentSelection(i); //itemInstanceCell.Tag as IECClass; arr.Add(ecClass.Name + "=" + selectedInstanceString); } WorkspaceUtilities.SaveSettings("Associations." + _ClassDef.Name, arr); }
/*------------------------------------------------------------------------------------**/ /// <summary> /// OpenProjectPortal /// </summary> /// <param name="unparsed"></param> /*--------------+---------------+---------------+---------------+---------------+------*/ public static void OpenProjectPortal ( string unparsed ) { try { string cfgProj = WorkspaceUtilities.GetConfigVar("CONNECTPROJECTGUID"); if (string.IsNullOrWhiteSpace(cfgProj)) { return; } string url = getProjectPortalUrl(new System.Guid(cfgProj)); System.Diagnostics.Process.Start(url); } catch (Exception ex) { BMECApi.Instance. SendToMessageCenterD(Bentley.DgnPlatformNET.OutputMessagePriority.Error, ex.Message); } }
/*------------------------------------------------------------------------------------**/ /// <summary> /// Import /// </summary> /// <param name="unparsed"></param> /*--------------+---------------+---------------+---------------+---------------+------*/ public static void Import ( string unparsed ) { if (string.IsNullOrEmpty(unparsed)) { WorkspaceUtilities.DisplayErrorMessage(LocalizableStrings.BadImportCommand, LocalizableStrings.ImportCommandFormat); return; } BMECApi.Instance.ClearActivePlacementTool(); // exit current placement tool IECClass ecClass = SchemaUtilities.PlantSchema.GetClass(unparsed.Trim()); if (ecClass == null) { WorkspaceUtilities.DisplayErrorMessage(string.Format(LocalizableStrings.BadClassName, unparsed.Trim()), ""); return; } BMECInstanceManager instanceManager = BMECApi.Instance.InstanceManager; OpenFileDialog openFileDlg = new OpenFileDialog(); openFileDlg.Multiselect = false; openFileDlg.Filter = "Import data file|*.txt"; openFileDlg.ShowDialog(); if (string.IsNullOrEmpty(openFileDlg.FileName)) { return; } if (!IsImportFileValidFormat(openFileDlg.FileName, ecClass)) { return; } System.IO.StreamReader sr = System.IO.File.OpenText(openFileDlg.FileName); ArrayList associations = new ArrayList(); ArrayList propertyValues = new ArrayList(); WaitDialog wtDlg = new WaitDialog(); wtDlg.SetTitleString(LocalizableStrings.ImportingInstances); wtDlg.SetInformationSting(LocalizableStrings.ImportingInstancesInfo); wtDlg.Show(); string lineRead = sr.ReadLine().Trim(); while (!sr.EndOfStream) { Application.DoEvents(); if (string.IsNullOrEmpty(lineRead)) { lineRead = sr.ReadLine().Trim(); continue; } if (lineRead == "[Associations]") { associations.Clear(); while (!sr.EndOfStream) { lineRead = sr.ReadLine().Trim(); if (string.IsNullOrEmpty(lineRead)) { continue; } if (lineRead == "[InstanceData]") { break; } associations.Add(lineRead); } } if (lineRead == "[InstanceData]") { propertyValues.Clear(); while (!sr.EndOfStream) { lineRead = sr.ReadLine().Trim(); if (lineRead == "[InstanceData]") { break; } if (lineRead == "[Associations]") { break; } if (string.IsNullOrEmpty(lineRead)) { continue; } propertyValues.Add(lineRead); } IECInstance ecInstance = instanceManager.CreateECInstance(ecClass.Name); BMECApi.Instance.SpecProcessor.FillCurrentPreferences(ecInstance, true); ecInstance.InstanceId = "mechanical"; ECInstanceDialog ecDlg = new ECInstanceDialog(ecInstance); ecDlg.InitializeWithCustomProperties(associations, propertyValues, true); ecDlg.SaveData(); } } wtDlg.Close(); sr.Close(); }
/*------------------------------------------------------------------------------------**/ /// <summary> /// IsImportFileValidFormat /// </summary> /// <param name="fileName"></param> /// <param name="ecClass"></param> /// <returns></returns> /*--------------+---------------+---------------+---------------+---------------+------*/ private static bool IsImportFileValidFormat ( string fileName, IECClass ecClass ) { bool status = true; bool assoicationFound = false; bool instanceFound = false; int lineNumber = 0; ArrayList arr = SchemaUtilities.GetAssociatedItems(ecClass); bool lookForAssociations = (arr.Count > 1); System.IO.StreamReader sr = System.IO.File.OpenText(fileName); try { while (!sr.EndOfStream) { string lineRead = sr.ReadLine().Trim(); lineNumber++; if (string.IsNullOrEmpty(lineRead)) { continue; } string testString = lineRead.Replace("[Associations]", "|"); testString = testString.Replace("[InstanceData]", "|"); testString = testString.Replace("=", "|"); if (!testString.Contains("|")) { WorkspaceUtilities.DisplayErrorMessage(string.Format(LocalizableStrings.InvalidString, lineRead, lineNumber), ""); status = false; break; } else if (lineRead == "[Associations]" && !lookForAssociations) { WorkspaceUtilities.DisplayErrorMessage(string.Format(LocalizableStrings.NoAssociationRequired, lineNumber), ""); status = false; break; } else if (lineRead == "[InstanceData]" && lookForAssociations && !assoicationFound) { WorkspaceUtilities.DisplayErrorMessage(string.Format(LocalizableStrings.AssociationsNotDefined, ecClass.Name, lineNumber), ""); status = false; break; } //Validate Associations if (lineRead == "[Associations]") { while (!sr.EndOfStream) { lineRead = sr.ReadLine().Trim(); lineNumber++; if (string.IsNullOrEmpty(lineRead)) { continue; } if (lineRead == "[InstanceData]") { break; } string[] strs = lineRead.Split(new char[] { '=' }); IECClass ecAssocateClass = SchemaUtilities.PlantSchema.GetClass(strs[0]); if (ecAssocateClass == null) { WorkspaceUtilities.DisplayErrorMessage(string.Format(LocalizableStrings.InvalidAssociationClass, lineNumber), ""); status = false; break; } } assoicationFound = true; } if (status == false) { break; } //Validate Instance Data if (lineRead == "[InstanceData]") { while (!sr.EndOfStream) { lineRead = sr.ReadLine().Trim(); lineNumber++; if (lineRead == "[InstanceData]") { break; } if (lineRead == "[Associations]") { break; } if (string.IsNullOrEmpty(lineRead)) { continue; } string[] strs = lineRead.Split(new char[] { '=' }); IECProperty ecProp = ecClass[strs[0]]; if (ecProp == null) { WorkspaceUtilities.DisplayErrorMessage(string.Format(LocalizableStrings.InvalidPropertyName, lineNumber), ""); status = false; break; } } instanceFound = true; } if (status == false) { break; } } } finally { sr.Close(); } return(status && instanceFound); }
private ResponceApplyChanges ApplyColumnsChanges(Guid entitySchemaId, List <ChangedColumn> changedColumns) { ResponceApplyChanges responce = new ResponceApplyChanges(); responce.success = true; var entitySchemaManager = UserConnection.EntitySchemaManager; string baseCaption = string.Empty; var baseEntitySchema = entitySchemaManager.FindItemByUId(entitySchemaId); if (baseEntitySchema != null) { baseCaption = baseEntitySchema.Caption; } ISchemaManagerItem designSchemaItem = entitySchemaManager.DesignItemInCustomPackage(UserConnection, entitySchemaId); if (baseCaption != string.Empty) { designSchemaItem.Caption = baseCaption; } var entitySchema = designSchemaItem.Instance as EntitySchema; if (baseCaption != string.Empty) { entitySchema.Caption = baseCaption; } Dictionary <string, string> newLookupsCollection = new Dictionary <string, string>(); Dictionary <string, EntitySchema> newLookupsEntitiesCollection = new Dictionary <string, EntitySchema>(); var newLookups = changedColumns.Where(c => c.IsNewLookup && entitySchema.Columns.FindByName(c.Name) == null); if (newLookups != null) { foreach (ChangedColumn item in newLookups) { var dictionaryEntitySchema = entitySchemaManager.FindItemByName(item.ReferenceSchemaName); if (dictionaryEntitySchema != null) { responce.Code = "Error.Dictionary.Exists"; responce.Message = item.ReferenceSchemaName; responce.success = false; return(responce); } newLookupsCollection.Add(item.ReferenceSchemaName, item.ReferenceSchemaCaption); } } if (newLookupsCollection.Count > 0) { var sysFolderId = (new Select(UserConnection) .Column("Id") .From("SysSchemaFolder") .Where("ParentId").IsNull() as Select) .ExecuteScalar <Guid>(); var baseLookupEntitySchema = entitySchemaManager.GetInstanceByName("BaseLookup"); var sysLookup = entitySchemaManager.GetInstanceByName("SysLookup"); var customPackageId = WorkspaceUtilities.ForceGetCustomPackageUId(UserConnection); foreach (var item in newLookupsCollection) { var lookupEntitySchemaItemUId = Guid.NewGuid(); object schemaNamePrefix; var lookupSchemaName = item.Key; if (SysSettings.TryGetValue(UserConnection, "SchemaNamePrefix", out schemaNamePrefix) && !schemaNamePrefix.Equals(string.Empty)) { lookupSchemaName = string.Concat(schemaNamePrefix, lookupSchemaName); } ISchemaManagerItem <EntitySchema> lookupEntitySchemaItem = entitySchemaManager.CreateSchema(lookupSchemaName, baseLookupEntitySchema, UserConnection, lookupEntitySchemaItemUId, false); lookupEntitySchemaItem.Caption = item.Value; var lookupEntitySchema = (EntitySchema)lookupEntitySchemaItem.Instance; lookupEntitySchema.Caption = item.Value; entitySchemaManager.SaveDesignedItemInSessionData(lookupEntitySchemaItem); entitySchemaManager.SaveDesignedItemFolderIdInSessionData(UserConnection, lookupEntitySchemaItemUId, sysFolderId); entitySchemaManager.SaveDesignedItemPackageUIdInSessionData(UserConnection, lookupEntitySchemaItemUId, customPackageId); entitySchemaManager.SaveSchema(lookupEntitySchemaItemUId, UserConnection); try { responce = ApplyDbChanges(responce, lookupEntitySchema); } catch (Exception) { responce.success = false; responce.Code = "Error.DbMetaActions.LookupApply"; return(responce); } newLookupsEntitiesCollection.Add(item.Key, lookupEntitySchema); Entity sysLookupEntity = sysLookup.CreateEntity(UserConnection); sysLookupEntity.SetColumnValue("Id", Guid.NewGuid()); sysLookupEntity.SetColumnValue("Name", item.Value); sysLookupEntity.SetColumnValue("Description", string.Empty); sysLookupEntity.SetColumnValue("SysFolderId", new Guid("80AB12C2-F36B-1410-A883-16D83CAB0980")); //// SysLookupFolder - General sysLookupEntity.SetColumnValue("SysEntitySchemaUId", lookupEntitySchema.UId); sysLookupEntity.SetColumnValue("ProcessListeners", 0); sysLookupEntity.Save(); } } foreach (ChangedColumn item in changedColumns) { EntitySchemaColumn column = entitySchema.Columns.FindByName(item.Name); if (column == null) { DataValueType dataValueType = GetDataValueTypeByTypeName(item.TypeGroupName, item.TypeName); column = entitySchema.Columns.CreateItem(); column.UId = Guid.NewGuid(); column.UsageType = EntitySchemaColumnUsageType.General; column.Name = item.Name; column.DataValueType = dataValueType; column.DataValueTypeManager = dataValueType.DataValueTypeManager; column.DataValueTypeUId = dataValueType.UId; if (dataValueType.IsLookup || dataValueType.IsMultiLookup) { EntitySchema referenceEntitySchema; if (item.IsNewLookup) { referenceEntitySchema = newLookupsEntitiesCollection.First(l => l.Key == item.ReferenceSchemaName).Value; } else { referenceEntitySchema = entitySchemaManager.GetInstanceByName(item.ReferenceSchemaName); } column.ReferenceSchema = referenceEntitySchema; column.ReferenceSchemaUId = referenceEntitySchema.UId; } entitySchema.Columns.Add(column); } column.Caption = item.Caption; column.IsSimpleLookup = item.IsEnum; column.RequirementType = item.IsRequired ? EntitySchemaColumnRequirementType.ApplicationLevel : EntitySchemaColumnRequirementType.None; column.IsMultiLineText = item.IsMultiline; } entitySchemaManager.SaveDesignedItemInSessionData(UserConnection, entitySchema as MetaSchema, entitySchema.UId); try { entitySchemaManager.SaveSchema(entitySchema.UId, UserConnection, false); responce = ApplyDbChanges(responce, entitySchema, true); responce.success = true; } catch (Exception) { responce.success = false; responce.Code = "Error.DbMetaActions.EntitySchemaApply"; } return(responce); }
/// <summary> /// Returns packageId by package UId. /// </summary> /// <param name="packageUId">Package UId</param> /// <returns></returns> private Guid GetPackageIdByUId(Guid packageUId) { return(WorkspaceUtilities.GetPackageIdByUId(packageUId, UserConnection)); }
private TaskPaneTool CreateTaskPane(object smartPart, UltraToolbarsSmartPartInfo smartPartInfo) { // get the control that we will be siting Control ctrl = WorkspaceUtilities.GetSmartPartControl(smartPart); TaskPaneTool taskPane = null; UltraTaskPaneToolbar toolbar = null; DockedPosition defaultDockedPosition = smartPartInfo.PreferredDockedPosition; string toolbarKey = smartPartInfo.PreferredTaskPane; // create the task pane tool and set it up taskPane = new TaskPaneTool(Guid.NewGuid().ToString()); taskPane.Control = ctrl; // add it to the root tools collection this.Tools.Add(taskPane); this.composer.Add(taskPane, ctrl); // initialize its settings this.ApplySmartPartInfoHelper(taskPane, smartPartInfo); // if a key was specified... if (toolbarKey != null && this.Toolbars.Exists(toolbarKey)) { // as long as its an task pane toolbar key, use it if (this.Toolbars[toolbarKey] is UltraTaskPaneToolbar) { toolbar = this.Toolbars[toolbarKey] as UltraTaskPaneToolbar; } else // otherwise use a default key { toolbarKey = null; } } if (toolbar == null) { // if one wasn't specified use a guid to ensure uniqueness if (toolbarKey == null) { toolbarKey = Guid.NewGuid().ToString(); } // create a taskpane toolbar and add it to the controls collection toolbar = new UltraTaskPaneToolbar(toolbarKey); toolbar.DockedPosition = defaultDockedPosition; if (smartPartInfo.PreferredExtent != UltraToolbarsSmartPartInfo.DefaultExtent) { toolbar.DockedContentExtent = smartPartInfo.PreferredExtent; } toolbar.ShowHomeButton = smartPartInfo.PreferredShowHomeButton; toolbar.NavigationButtonStyle = smartPartInfo.PreferredNavigationStyle; this.Toolbars.Add(toolbar); } toolbar.Tools.AddTool(taskPane.Key); return(taskPane); }
public void UpdateWBSParts(ArrayList assocItems, IECInstance selectedECInstance) { if (assocItems == null || assocItems.Count == 0 || selectedECInstance == null) { return; } //set cache of WBS items (classname, relationship name) IDictionary <string, string> aitems = new Dictionary <string, string> (); foreach (string item in assocItems) { string[] part = item.Split(new char[] { '|' }); if (part.Length < 1) { continue; } string className = part[0]; string relClassName = part[1]; if (!aitems.ContainsKey(className)) { aitems.Add(className, relClassName); } } DgnUtilities dgnUtil = DgnUtilities.GetInstance(); IECRelationshipInstanceCollection ecList = selectedECInstance.GetRelationshipInstances(); if (ecList == null || ecList.Count == 0) { return; } bool needWBS = false; string msg = string.Empty; //iterate thru relationship instances IEnumerator en = ecList.GetEnumerator(); while (en.MoveNext()) { IECRelationshipInstance rel = en.Current as IECRelationshipInstance; if (rel == null) { continue; } string wbsRelationshipName = rel.ClassDefinition.Name; IECInstance wbsSource = rel.Source; if (wbsSource == null) { continue; } string wbsSourceClassName = wbsSource.ClassDefinition.Name; //match wbs type and pass to UpdateWBSComboxValue() if (!aitems.ContainsKey(wbsSourceClassName)) { continue; } if (UpdateWBSComboxValue(wbsSource, wbsRelationshipName) == WBSUpdateType.NeedToCreate) { IECPropertyValue sourceVal = wbsSource.FindPropertyValue(s_WBSName, false, false, false); string val = string.Empty; if (sourceVal != null && !sourceVal.IsNull) { val = sourceVal.StringValue; } msg = msg + "\n" + string.Format(LocalizableStrings.MissingWbs, wbsSourceClassName, val); needWBS = true; } } if (needWBS && !string.IsNullOrEmpty(msg)) { string val = WorkspaceUtilities.GetMSConfigVariable("AllowPlacementOnMissingWBSItems"); if (string.IsNullOrEmpty(val) || val != "1") { dgnUtil.RunKeyin("BMECH DEFERDEFAULTCMD"); } //this value is used in consistency manager placement. //setting to false allows CM to display instances correctly dgnUtil.ConsistencyPlacementValidState = false; string message = string.Format(LocalizableStrings.AlertMissingWbs, msg); dgnUtil.ConsistencyPlacementErrorMessage = message; MessageBox.Show(message, LocalizableStrings.WBSAlert, MessageBoxButtons.OK, MessageBoxIcon.Warning); WorkspaceUtilities.DisplayWarningMessage(LocalizableStrings.WBSAlert, message); } }
public bool FillAssociatedItems(bool isModifyTool) { ArrayList classRelationshipStrs = SchemaUtilities.GetAssociatedItems(_ClassDef); if (classRelationshipStrs.Count == 0) { return(false); } if (_bMultiInst) {//when editing associations of multiple instances, edit and delete options should not be available. this.optionDelete.Visible = false; this.optionEdit.Visible = false; //refresh/redraw the grid this.OnResize(new EventArgs()); } for (int i = 0; i < classRelationshipStrs.Count; i++) { string strData = classRelationshipStrs[i] as string; string[] strArr = strData.Split(new char[] { '|' }); IECClass ecAssociatedClass = SchemaUtilities.PlantSchema.GetClass(strArr[0]); int rowIndex = this.Rows.Add(); DataGridViewTextBoxCell itemTypeCell = this[s_WBSClassKey, rowIndex] as DataGridViewTextBoxCell; itemTypeCell.Value = ecAssociatedClass.DisplayLabel; //itemTypeCell.Tag = ecAssociatedClass; DataGridViewComboBoxCell itemInstanceCell = this[s_WBSInstanceKey, rowIndex] as DataGridViewComboBoxCell; //ArrayList arr = DgnUtilities.GetInstance().GetECInstanceDisplayLabelsFromDgn (strArr[0]); ECInstanceList arr = DgnUtilities.GetInstance().GetAllInstancesFromDgn(strArr[0]); IECRelationshipClass ecAssociatedRel = SchemaUtilities.PlantSchema.GetClass(strArr[1]) as IECRelationshipClass; // move class to 1st column tag, to start with, later changed itemInstanceCell.Tag = ecAssociatedClass; itemTypeCell.Tag = ecAssociatedRel; if (_bMultiInst) { itemInstanceCell.Items.Add(_cstr_Varies); } itemInstanceCell.Items.Add(LocalizableStrings.None); Dictionary <string, IECInstance> dropDownCache = new Dictionary <string, IECInstance> (); foreach (IECInstance returnedInstance in arr) //for (int j = 0; j < arr.Count; j++) { // insert only if this is not from a referenced file if (DgnUtilities.GetInstance().IsECInstanceFromReferenceFile(returnedInstance)) { continue; } string key = SchemaUtilities.GetDisplayNameForECInstance(returnedInstance, true); if (dropDownCache.ContainsKey(key)) { dropDownCache[key] = returnedInstance; } else { // insert dropDownCache.Add(key, returnedInstance); itemInstanceCell.Items.Add(key); } } if (dropDownCache.Count > 0) { itemInstanceCell.Tag = dropDownCache; } if (isModifyTool) { string strLastInstID = null; string key = ""; for (int j = 0; j < _instList.Count; j++) { IECInstance parentInstance = GetAssociatedItemFromInstance(_instList[j], ecAssociatedRel, ecAssociatedRel.Source.GetClasses()[0].Class); string strCurrInstID = ""; // If we have a parent instance, then we must be using an existing instance. We need to make sure we select the existing values. if (null != parentInstance) { key = SchemaUtilities.GetDisplayNameForECInstance(parentInstance, true); strCurrInstID = parentInstance.InstanceId; } else { key = LocalizableStrings.None; strCurrInstID = LocalizableStrings.None; } if (String.IsNullOrEmpty(strLastInstID)) { strLastInstID = strCurrInstID; } else { if (strCurrInstID != strLastInstID) { key = _cstr_Varies; break; } } } // end for loop itemInstanceCell.Value = key; } itemInstanceCell.Sorted = true; DataGridViewImageCell tempImageCell = this["optionAdd", rowIndex] as DataGridViewImageCell; tempImageCell.Tag = ecAssociatedClass; } if (!isModifyTool) { ArrayList AssociatonList = WorkspaceUtilities.GetSettings("Associations." + _ClassDef.Name); LoadSettings(AssociatonList, false); } return(true); }