private static void openWindowHandler(WindowFactoryData data)
        {
            Window window    = null;
            object viewModel = null;

            switch (data.WindowType)
            {
            case WindowClassType.MainWindow:
                window    = new MainWindow();
                viewModel = new MainWindowViewModel();
                break;

            case WindowClassType.Catalog:
                window    = new Catalog();
                viewModel = new CatalogViewModel(data.DataAgggregator);
                break;

            default:
                break;
            }

            if (window == null || viewModel == null)
            {
                return;
            }

            window.DataContext = viewModel;
            FactoryService.Register(viewModel as ViewModelBase, window);

            // Attemps to find a parent window based on what ViewModel sent the request.
            Window parentWindow = FactoryService.GetWindowReference(data.CallingViewModel);

            if (parentWindow != null)
            {
                window.Owner = parentWindow;
            }

            if (data.Modal)
            {
                window.ShowDialog();
            }
            else
            {
                window.Show();
            }
        }
 public static void OpenWindow(WindowFactoryData data)
 {
     if (OnDataTransmittedEvent != null)
     {
         if (Application.Current != null)
         {
             Application.Current.Dispatcher.Invoke((Action) delegate
             {
                 OnDataTransmittedEvent(data);
             });
         }
         else
         {
             OnDataTransmittedEvent(data);
         }
     }
 }