locked
ModelChanged event handler missing event args RRS feed

  • Question

  • I have implemented a ModelChanged event handler in my AddDesigner call as follows:

                 _wd.ModelChanged += wd_ModelChanged;
    
    
    The code for the ModelChanged event is:

    private void wd_ModelChanged(object sender, EventArgs e)
            {
                ModelChangedEventArgs changedEventArgs = e as ModelChangedEventArgs;
    
                if(changedEventArgs != null)
                {
                    IEnumerable<ModelItem> itemsRemoved = changedEventArgs.ItemsRemoved;
    
                    foreach (ModelItem modelItem in itemsRemoved)
                    {
                        if (modelItem.ItemType == typeof(Flowchart))
                        {
                            MessageBox.Show("You can not delete the base flow chart!", _appName, MessageBoxButton.OK, MessageBoxImage.Stop);
                        }
                    }
                }
    
                //Add the expression text boxes to all switch and descision flow activities
                AddExpressionTextToFlowActivities();
    
                _wd.Flush();
            }
    The issue I have is that there are no event args coming through, when I expected there to be event arguments from the editing context. Any ideas on what I have missed?
    Tuesday, February 23, 2010 2:12 AM

All replies

  • This is a bit of a weirdness on the API, but I don't think the workflow designer actually knows what the exact changes are. Instead you can try subscribing to ModelService.ModelChanged, that one should have some useful event information.

    Tim

    Wednesday, February 24, 2010 1:23 AM
  • Thanks Tim, yeah seems to be just another little weird part of WF4 rehosting!

    I'll take a look at that and see how we progress and report back.
    Wednesday, February 24, 2010 2:49 AM
  • hi is there any solution about this issue.

    Friday, October 1, 2010 8:00 PM