locked
Calling a parent project method? RRS feed

  • Question

  • Hi,

    I have (main) WPF project which loads child wpf projects (add ins) using reflection.

    I have an addin that contains a long runnning process, so I want to update the main project, to reflects this (open up a modal popup..."Large Process Running" ).

    I currently have this inside my main project:
    .
    .
     UIElement page = Activator.CreateInstance(GetComponentType(component),this) as UIElement;
    canvasPanel.Children.Add(page);
    .
    .
    This loads up the addin fine. The addin code looks somthing like this:
      public partial class MainPage : UserControl
        {
            List<Media> mediaList;
            ConfigurationManager cm;
            public MainPage()
            {
                InitializeComponent();
                
                RunBigProcess();
              
            }
    	private void RunBigProcess(){
                //This method take ~10mins
    	}
         }
    How can I pass a message back to the main project? 
    I thought about adding a reference to the main project dll and passing itself (this) across to the child addin, but that seems pretty circular...the parent proj having reference to child dll and child proj having a reference to parent dll.

    Cheers

    Monday, September 7, 2009 3:47 PM

Answers

  • If you have the process run in a closed UserControl, I'd suggest you add a property to the Child control that reports the progress and:
    1. Periodicaly check the property value in the main project.
    2. Implement INotifyPropertyChanged on the child control and use Binding directly.

    Bigsby, Lisboa, Portugal - O que for, quando for, é que será o que é... http://bigsby.eu
    • Proposed as answer by Bruce.Zhou Thursday, September 10, 2009 12:05 PM
    • Marked as answer by Bruce.Zhou Monday, September 14, 2009 2:34 AM
    Monday, September 7, 2009 4:04 PM