public ApplicationViewModel(IZuneDatabaseReader dbReader, SafeObservableCollection<AlbumDetailsViewModel> albums, ViewLocator locator, IKernel kernel, ApplicationView av) { _dbReader = dbReader; _albums = albums; _viewLocator = locator; _kernel = kernel; //register for notification messages Messenger.Default.Register<ErrorMessage>(this, Notifications.Add); Messenger.Default.Register<UserControl>(this, (view) => { CurrentPage = view; }); }
void App_Startup(object sender, StartupEventArgs e) { this.DispatcherUnhandledException += App_DispatcherUnhandledException; //hack for setting the caret highlight colour in textboxes and the like //taken from: http://www.nickdarnell.com/2009/12/wpf-change-textbox-selection-color-net-3-5/ SolidColorBrush current = SystemColors.HighlightBrush; FieldInfo colorCacheField = typeof(SystemColors).GetField("_colorCache", BindingFlags.Static | BindingFlags.NonPublic); Color[] _colorCache = (Color[])colorCacheField.GetValue(typeof(SystemColors)); _colorCache[14] = Color.FromRgb(0xF1, 0x0D, 0xA2); //pink //improved perceived application startup by allowing the main //application view to load before anything else, be it code, dll's etc. _appView = new ApplicationView(); _appView.ContentRendered += new EventHandler(_appView_ContentRendered); _appView.Show(); }