void OnLocationChanged(Object sender, LocationChangedEventArgs e) { if (LocationChanged != null) { LocationChanged(sender, e); } }
void OnFreeFormPanelLocationChanged(object sender, LocationChangedEventArgs e) { Debug.Assert(sender is UIElement, "Sender should be of type UIElement"); Connector movedConnector = sender as Connector; if (movedConnector != null) { //ViewState is undoable only when a user gesture moves a connector. If the FreeFormPanel routes a connector, //the change is not undoable. bool isUndoableViewState = false; ModelItem connectorModelItem = StateContainerEditor.GetConnectorModelItem(movedConnector); PointCollection existingViewState = this.ViewStateService.RetrieveViewState(connectorModelItem, ConnectorLocationViewStateKey) as PointCollection; if (existingViewState != null && existingViewState.Count > 0 && movedConnector.Points.Count > 0 && existingViewState[0].Equals(movedConnector.Points[0]) && existingViewState[existingViewState.Count - 1].Equals(movedConnector.Points[movedConnector.Points.Count - 1])) { isUndoableViewState = true; } StoreConnectorLocationViewState(movedConnector, isUndoableViewState); } else { //This is called only when a shape without ViewState is auto-layout'd by the FreeFormPanel. WorkflowViewElement view = sender as WorkflowViewElement; if (view != null) { StoreShapeLocationViewState(view, e.NewLocation); } } }