public ExternalViewPort(GeometryModel3D geometry)
 {
     Geometry = geometry;
     InitializeComponent();
     try
     {
         _viewModel = ((App) Application.Current).ViewModelFactory.CreateViewPortViewModel();
         DataContext = _viewModel;
     }
     catch (Exception exc)
     {
         Logger.Instance.Error("Error while initilizing ExternalViewPort view.", exc);
     }
 }
        public MainViewPort()
        {
            InitializeComponent();
            try
            {
                _viewModel = ((App) Application.Current).ViewModelFactory.CreateViewPortViewModel();
                DataContext = _viewModel;

                //Todo: Extract to view model
                _externalViewPort = new ExternalViewPort(Resources["Geometry"] as GeometryModel3D);
                _externalViewPort.Closing += ExternalViewPortOnClosing;
                _viewModel.State.PropertyChanged += StateOnPropertyChanged;
                _viewModel.State.StereoOutput = _viewModel.State.StereoOutput;
            }
            catch (Exception exc)
            {
                Logger.Instance.Error("Error while initilizing MainViewPort view.", exc);
            }
        }