public AlarmWindow(Einsatz _einsatz) { monitorService = ServiceLocator.Current.GetInstance <IMonitorService>(); InitializeComponent(); //Set time when window should be closed CloseTime = DateTime.Now.Add(Settings.Default.Monitor_AlarmTime); var _viewModel = new AlarmViewModel(_einsatz); _viewModel.CloseRequested += (sender, e) => { Close(); }; DataContext = _viewModel; Loaded += AlarmWindow_Loaded; Closing += AlarmWindow_Closing; //Add to alarmWindowList monitorService.AddAlarmWindow(this); }