private void Application_Startup(object sender, StartupEventArgs e)
{
// create model
UserLocations = new ObservableCollection<UserLocation>();
UserList = new ClientConnectionList();
Actions = new ObservableCollection<ActionMessage>();
Listener = new ClientConnectionListener(50000, new XmlMessageParser()); // add parser
Listener.InitialConnectionSuccess += OnInitialConnectionSuccess;
Listener.InitialConnectionFailed += OnInitialConnectionFailed;
Listener.ConnectionFailed += OnConnectionFailed;
Listener.MessageReceived += OnMessageReceived;
Listener.MessageFailed += OnMessageFailed;
// create view model
MainWindowViewModel = new MainWindowViewModel();
MainWindowViewModel.UserList = UserList;
MainWindowViewModel.Actions = Actions;
MainWindowViewModel.UserLocations = UserLocations;
// create view
MainWindow = new MainWindow();
MainWindow.DataContext = MainWindowViewModel;
MainWindow.Show();
// start listening
Listener.StartAccepting();
UpdaterTask task = new UpdaterTask(
Dispatcher,
TaskHandler.Background,
UserList,
UserLocations);
task.ProgressChanged += TaskProgressReport;
task.BeginExecute();
}