private void DetachBusinessEvents(PlayerBusiness business) {
     business.GetConditions -= business_GetConditions;
     business.IncreaseConditions -= business_IncreaseConditions;
     business.PlaylistChanged -= business_PlaylistChanged;
     business.DisplayPlayTime -= business_DisplayPlayTime;
     business.NowPlaying -= business_NowPlaying;
 }
        public void Start(MainWindow main) {
            // Make sure to initialize Settings static constructor to initialize database path.
            var a = Settings.SavedFile;

            Menu = (MenuControl)main.MainMenuContainer.Content;
            Layers = (LayersControl)main.LayersContainer.Content;
            RatingViewer = (RatingViewerControl)main.RatingViewerContainer.Content;
            Icon = main.Icon;
            Main = main;

            main.Loaded += Main_Loaded;
            main.Closing += Main_Closing;

            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            main.Dispatcher.UnhandledException += Dispatcher_UnhandledException;
            System.Windows.Forms.Application.ThreadException += Application_ThreadException; // MPC-HC API calls are done through WinForms.

            Business = new PlayerBusiness(GetNewPlayer());
            Windows = new WindowManager(main);
        }