public event EventHandler CanExecuteChanged; // Event that can be raised when the executability of the command changes. When this event is raised, the Viewer will invoke the CanExecute method, allowing the add-in to update the state of the tool's button on the toolbar. //if (CanExecuteChanged != null){CanExecuteChanged(this, EventArgs.Empty);} #endregion ICommand members #region Event Handlers /// <summary> /// Handle successful query task and create FeatureLayer from related table/FC /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void QueryTask_ExecuteRelationshipQueryCompleted(object sender, RelationshipEventArgs e) { // queryResult used once the results layer is initialized queryResult = e.Result; // Create a new url for the related table using the querytaskUrl and the RelatedTableId. string resultsUrl = relatesLayer.lyrUrl; var lastSlash = resultsUrl.LastIndexOf("/"); // -1? resultsUrl = string.Format("{0}/{1}", resultsUrl.Substring(0, lastSlash), relationInfo.tableId); log(string.Format("QueryTask_ExecuteRelationshipQueryCompleted, resultsUrl='{0}'", resultsUrl)); // Create a FeatureLayer for the results based on the url of the related records. var resFL = new FeatureLayer() { Url = resultsUrl }; resFL.OutFields.Add("*"); // Initialize the resultsLayer to populate layer metadata (LayerInfo) so the OID field can be retrieved. resFL.Initialized += resultsLayer_Initialized; resFL.Initialize(); resultsLayer = new mwb02.AddIns.VLayer(resFL); log(string.Format("QueryTask_ExecuteRelationshipQueryCompleted, completed, wait for resultsLayer_Initialized")); } // private void QueryTask_ExecuteRelationshipQueryCompleted(object sender, RelationshipEventArgs e)
public virtual void OnFriendshipRequested(RelationshipEventArgs args) { if (FriendshipRequested != null) { FriendshipRequested(this, args); } }
public virtual void OnFriendshipDeleted(RelationshipEventArgs args) { if (this.FriendshipDeleted != null) { this.FriendshipDeleted(this, args); } }
public virtual void OnUnfollowRequested(RelationshipEventArgs args) { if (UnfollowRequested != null) { UnfollowRequested(this, args); } }
/// <summary> /// Handle successful query task and create FeatureLayer from related table/FC /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void QueryTask_ExecuteRelationshipQueryCompleted( object sender, RelationshipEventArgs e) { // queryResult used once the results layer is initialized queryResult = e.Result; // Create a new url for the related table using the querytaskUrl and the RelatedTableId. string resultsUrl = relatesLayer.Url; string[] splitResultUrl = resultsUrl.Split('/'); resultsUrl = resultsUrl.Replace(splitResultUrl.Last <string>(), ""); resultsUrl = resultsUrl.Insert(resultsUrl.Length, relationInfo.tableId.ToString()); log(string.Format("QueryTask_ExecuteRelationshipQueryCompleted, resultsUrl='{0}'", resultsUrl)); // Create a FeatureLayer for the results based on the url of the related records. resultsLayer = new FeatureLayer() { Url = resultsUrl }; resultsLayer.OutFields.Add("*"); // Initialize the resultsLayer to populate layer metadata (LayerInfo) so the OID field can be retrieved. resultsLayer.Initialized += resultsLayer_Initialized; resultsLayer.Initialize(); log(string.Format("QueryTask_ExecuteRelationshipQueryCompleted, completed, wait for resultsLayer_Initialized")); } // private void QueryTask_ExecuteRelationshipQueryCompleted(object sender, RelationshipEventArgs e)
protected override void OnRelationAdded(object sender, RelationshipEventArgs e) { switch (e.Relationship.RelationshipType) { case RelationshipType.Extension: AddExtends(e.Relationship as ExtendsRelationship); break; case RelationshipType.Inclusion: AddIncludes(e.Relationship as IncludesRelationship); break; case RelationshipType.UseCaseAssociation: AddAssociation(e.Relationship as UseCaseAssociation); break; case RelationshipType.UseCaseGeneralization: AddGeneralization(e.Relationship as UseCaseGeneralization); break; case RelationshipType.Comment: AddCommentRelationship(e.Relationship as CommentRelationship); break; } }
///-------------------------------------------------------------------------------- /// <summary>This method applies relationship deletes.</summary> ///-------------------------------------------------------------------------------- public void ProcessDeleteRelationshipPerformed(RelationshipEventArgs data) { try { bool isItemMatch = false; if (data != null && data.Relationship != null) { foreach (RelationshipViewModel item in Relationships.ToList <RelationshipViewModel>()) { if (item.Relationship.RelationshipID == data.Relationship.RelationshipID) { // remove item from tabs, if present WorkspaceEventArgs message = new WorkspaceEventArgs(); message.ItemID = item.Relationship.RelationshipID; Mediator.NotifyColleagues <WorkspaceEventArgs>(MediatorMessages.Command_CloseItemRequested, message); // delete children for (int i = item.Items.Count - 1; i >= 0; i--) { if (item.Items[i] is RelationshipPropertyViewModel) { RelationshipPropertyViewModel child = item.Items[i] as RelationshipPropertyViewModel; RelationshipPropertyEventArgs childMessage = new RelationshipPropertyEventArgs(); childMessage.RelationshipProperty = child.RelationshipProperty; childMessage.RelationshipID = item.Relationship.RelationshipID; childMessage.Solution = Solution; childMessage.WorkspaceID = child.WorkspaceID; item.ProcessDeleteRelationshipPropertyPerformed(childMessage); } } // delete item isItemMatch = true; Relationships.Remove(item); Entity.RelationshipList.Remove(item.Relationship); Items.Remove(item); Entity.ResetModified(true); OnUpdated(this, null); break; } } if (isItemMatch == false) { ShowIssue(DisplayValues.Issue_DeleteItemNotFound); } } } catch (Exception ex) { ShowIssue(ex.Message + ex.StackTrace); } }
internal RelationshipEventArgs RaiseOnRelationDeleted(Transaction trans) { RelationshipEventArgs args = new RelationshipEventArgs(EventTypeEnum.OnRelationDelete, trans); if (!trans.FireGraphEvents) { return(args); } onRelationDeleted?.Invoke(this, args); return(args); }
/// <summary> /// Handle successful query task and initializes the results layer /// </summary> private void QueryTask_ExecuteRelationshipQueryCompleted(object sender, RelationshipEventArgs e) { // Unhook the queryTask.ExecuteRelationshipQueryCompleted queryTask.ExecuteRelationshipQueryCompleted -= QueryTask_ExecuteRelationshipQueryCompleted; // queryResult used once the results layer is initialized queryResult = e.Result; if (queryResult.RelatedRecordsGroup.Count > 0) { string relatedTableID = SelectedRelationship.RelatedTableId.ToString(); if (relatedTableID == null) { relatedTableID = relatesLayer.LayerInfo.Relationships.First().RelatedTableId.ToString(); } // Determine the url for the related table and use to populate the Url property of the new resultsLayer. string resultsUrl = relatesLayer.Url; resultsUrl = resultsUrl.Substring(0, resultsUrl.LastIndexOf('/') + 1); resultsUrl = resultsUrl.Insert(resultsUrl.Length, relatedTableID); // Create a FeatureLayer for the results based on the url of the related records. At this point, the feature layer will // retrieve all the graphics/info from the layer. In the resultsLayer_Initialized, we trim that down based on the Object id field. resultsLayer = new FeatureLayer() { Url = resultsUrl, ProxyUrl = relatesLayer.ProxyUrl }; resultsLayer.OutFields.Add("*"); // Initialize the resultsLayer to populate layer metadata (LayerInfo) so the OID field can be retrieved. resultsLayer.Initialized += resultsLayer_Initialized; resultsLayer.InitializationFailed += resultsLayer_InitializationFailed; resultsLayer.UpdateCompleted += resultsLayer_UpdateCompleted; resultsLayer.Initialize(); } else { Grid infoWindowGrid = Utils.FindChildOfType <Grid>(popupWindow, 3); infoWindowGrid.Children.Remove(indicator); infoWindowGrid.Children.Add(NoRecordsFoundView); ((DelegateCommand)CloseNoRecordsView).RaiseCanExecuteChanged(); } }
///-------------------------------------------------------------------------------- /// <summary>This method processes the new relationship command.</summary> ///-------------------------------------------------------------------------------- public void ProcessNewRelationshipCommand() { RelationshipEventArgs message = new RelationshipEventArgs(); message.Relationship = new Relationship(); message.Relationship.RelationshipID = Guid.NewGuid(); message.Relationship.EntityID = Entity.EntityID; message.Relationship.Entity = Entity; message.EntityID = Entity.EntityID; message.Relationship.Solution = Solution; message.Solution = Solution; message.WorkspaceID = WorkspaceID; Mediator.NotifyColleagues <RelationshipEventArgs>(MediatorMessages.Command_EditRelationshipRequested, message); }
void QueryTask_ExecuteRelationshipQueryCompleted(object sender, RelationshipEventArgs e) { RelationshipResult pr = e.Result; if (pr.RelatedRecordsGroup.Count == 0) { RelatedRowsDataGrid.ItemsSource = null; } else { foreach (var pair in pr.RelatedRecordsGroup) { RelatedRowsDataGrid.ItemsSource = pair.Value; } } }
protected override void OnRelationAdded(object sender, RelationshipEventArgs e) { { switch (e.Relationship.RelationshipType) { case RelationshipType.Association: AddAssociation(e.Relationship as AssociationRelationship); break; case RelationshipType.Composition: AddComposition(e.Relationship as AssociationRelationship); break; case RelationshipType.Aggregation: AddAssociation(e.Relationship as AssociationRelationship); break; case RelationshipType.Generalization: AddGeneralization(e.Relationship as GeneralizationRelationship); break; case RelationshipType.Realization: AddRealization(e.Relationship as RealizationRelationship); break; case RelationshipType.Dependency: AddDependency(e.Relationship as DependencyRelationship); break; case RelationshipType.Nesting: AddNesting(e.Relationship as NestingRelationship); break; case RelationshipType.Comment: AddCommentRelationship(e.Relationship as CommentRelationship); break; } } }
///-------------------------------------------------------------------------------- /// <summary>This method applies relationship updates.</summary> ///-------------------------------------------------------------------------------- public void ProcessEditRelationshipPerformed(RelationshipEventArgs data) { try { bool isItemMatch = false; if (data != null && data.Relationship != null) { foreach (RelationshipViewModel item in Relationships) { if (item.Relationship.RelationshipID == data.Relationship.RelationshipID) { isItemMatch = true; item.Relationship.TransformDataFromObject(data.Relationship, null, false); item.OnUpdated(item, null); item.ShowInTreeView(); break; } } if (isItemMatch == false) { // add new Relationship data.Relationship.Entity = Entity; RelationshipViewModel newItem = new RelationshipViewModel(data.Relationship, Solution); newItem.Updated += new EventHandler(Children_Updated); Relationships.Add(newItem); Entity.RelationshipList.Add(newItem.Relationship); Solution.RelationshipList.Add(newItem.Relationship); Items.Add(newItem); OnUpdated(this, null); newItem.ShowInTreeView(); } } } catch (Exception ex) { ShowIssue(ex.Message + ex.StackTrace); } }
/// <summary> /// Handle successful query task and initializes the results layer /// </summary> private void QueryTask_ExecuteRelationshipQueryCompleted(object sender, RelationshipEventArgs e) { // Unhook the queryTask.ExecuteRelationshipQueryCompleted queryTask.ExecuteRelationshipQueryCompleted -= QueryTask_ExecuteRelationshipQueryCompleted; // queryResult used once the results layer is initialized queryResult = e.Result; if (queryResult.RelatedRecordsGroup.Count > 0) { string relatedTableID = SelectedRelationship.RelatedTableId.ToString(); if (relatedTableID == null) { relatedTableID = relatesLayer.LayerInfo.Relationships.First().RelatedTableId.ToString(); } // Determine the url for the related table and use to populate the Url property of the new resultsLayer. string resultsUrl = relatesLayer.Url; resultsUrl = resultsUrl.Substring(0, resultsUrl.LastIndexOf('/') + 1); resultsUrl = resultsUrl.Insert(resultsUrl.Length, relatedTableID); // Create a FeatureLayer for the results based on the url of the related records. At this point, the feature layer will // retrieve all the graphics/info from the layer. In the resultsLayer_Initialized, we trim that down based on the Object id field. resultsLayer = new FeatureLayer() { Url = resultsUrl, ProxyUrl = relatesLayer.ProxyUrl }; resultsLayer.OutFields.Add("*"); // Initialize the resultsLayer to populate layer metadata (LayerInfo) so the OID field can be retrieved. resultsLayer.Initialized += resultsLayer_Initialized; resultsLayer.InitializationFailed += resultsLayer_InitializationFailed; resultsLayer.UpdateCompleted += resultsLayer_UpdateCompleted; resultsLayer.Initialize(); } else { Grid infoWindowGrid = Utils.FindChildOfType<Grid>(popupWindow, 3); infoWindowGrid.Children.Remove(indicator); infoWindowGrid.Children.Add(NoRecordsFoundView); ((DelegateCommand)CloseNoRecordsView).RaiseCanExecuteChanged(); } }
protected virtual void OnRelationRemoved(RelationshipEventArgs e) { if (RelationRemoved != null) RelationRemoved(this, e); OnModified(EventArgs.Empty); }
public void OnRelationshipDeleted(RelationshipEventArgs args) { if (null != RelationshipDeleted) RelationshipDeleted(this, args); }
private Task Discord_RelationshipAdded(RelationshipEventArgs e) { SortRelationship(e.Relationship); return(Task.CompletedTask); }
private void Client_OnRelationshipRemoved(object sender, RelationshipEventArgs args) { Relationships.Remove(args.Relationship); }
private Task Discord_RelationshipRemoved(RelationshipEventArgs e) { RemoveRelationship(e.Relationship); return(Task.CompletedTask); }
private void Client_OnRelationshipAdded(DiscordSocketClient client, RelationshipEventArgs args) { Relationships.Add(args.Relationship); }