1

Topic: To appeal event in other class

Good afternoon.
There is class MainWindow, in it there is function AddPreloadedCharts ().
There is static class DataManager in which the loaded stock quotes are stored and there is function LoadQuotes.
LoadQuotes  from MainWindow, this function causes in the end MainWindow. AddPreloadedCharts ().
Object reference MainWindow is stored in DataManager.
I want to make so: function LoadQuotes in the end of the operation should cause event in a class
MainWindow where there will be a later processing and call AddPreloadedCharts (), and on MainWindow it is not necessary to store the link.

public void AddPreloadedCharts (List <string> quoteNames)
{
foreach (string quoteCode in quoteNames)
{
this. Dispatcher. BeginInvoke (new Action (() => {AddChart (quoteCode, true);}));
}
}

But for an event call it is necessary to use in MainWindow static function, in it to cause nonstatic AddPreloadedCharts that is impossible.
Prompt how here to be, something I am confused.

2

Re: To appeal event in other class

mraklbrw wrote:

static class DataManager in which constants are stored loaded

in a statics only. Store in the normal.

3

Re: To appeal event in other class

MainWindow causes DataManager
DataManager causes MainWindow
The unsuitable architecture to alter

4

Re: To appeal event in other class

Shocker. Pro wrote:

MainWindow causes DataManager
DataManager causes MainWindow
The unsuitable architecture to alter

. A pattern "media torus".
Instead of especially , it is possible simply in DataManager  not MainWindow, and the delegate for  in the necessary situation.

5

Re: To appeal event in other class

All thanks, understood.