/// <summary> /// Initializes the view model. Normally the initialization is done in the constructor, but sometimes this must be delayed /// to a state where the associated UI element (user control, window, ...) is actually loaded. /// <para/> /// This method is called as soon as the associated UI element is loaded. /// </summary> /// <remarks> /// It's not recommended to implement the initialization of properties in this method. The initialization of properties /// should be done in the constructor. This method should be used to start the retrieval of data from a web service or something /// similar. /// <para/> /// During unit tests, it is recommended to manually call this method because there is no external container calling this method. /// </remarks> protected override void Initialize() { var vm = new ProvideAnalyticsViewModel(); if (_uiVisualizerService.ShowDialog(vm) ?? false) { AuditingManager.RegisterAuditor(new GoogleAnalytics(vm.ApiKey, "Catel Analytics Example")); } else { _messageService.ShowError("Cannot provide analytics when no API is provided"); } }
/// <summary> /// Initializes the view model. Normally the initialization is done in the constructor, but sometimes this must be delayed /// to a state where the associated UI element (user control, window, ...) is actually loaded. /// <para/> /// This method is called as soon as the associated UI element is loaded. /// </summary> /// <remarks> /// It's not recommended to implement the initialization of properties in this method. The initialization of properties /// should be done in the constructor. This method should be used to start the retrieval of data from a web service or something /// similar. /// <para/> /// During unit tests, it is recommended to manually call this method because there is no external container calling this method. /// </remarks> protected override async Task Initialize() { var vm = new ProvideAnalyticsViewModel(); if (await _uiVisualizerService.ShowDialog(vm) ?? false) { AuditingManager.RegisterAuditor(new GoogleAnalytics(vm.ApiKey, "Catel Analytics Example")); } else { await _messageService.ShowError("Cannot provide analytics when no API is provided"); } }