コード例 #1
0
        // CONSTRUCTORS

        public SplashWindow()
        {
            try
            {
                InitializeComponent();
                vm          = new SplashViewModel();
                DataContext = vm;

                //Setup input listener
                input = new InputListener();
                input.KeyboardUpdated += Input_KeyPressed;

                //If no video is set, skip the splash screen
                if (vm.VideoSource == null)
                {
                    EndSplash();
                }
            }
            catch (Exception ex)
            {
                //TODO: Show controller-friendly error message
                Tools.LogError(ex);
                EndSplash();
            }
        }
コード例 #2
0
        // CONSTRUCTORS

        public MainWindow()
        {
            //Initialise main window and view model
            try
            {
                //TODO: Make the initialisation file directory scan async (on another thread)
                vm          = new MainViewModel();
                DataContext = vm;
                InitializeComponent();
            }
            catch (Exception ex)
            {
                HandleCriticalError(ex, "Failed launching. View error log for more information.");
            }

            //Initialise task tray icon
            try
            {
                trayIcon = new TaskTrayIcon();
                trayIcon.AddMenuItem("Exit", TrayIcon_Exit);
            }
            catch (Exception ex)
            {
                HandleError(ex, "Error initialising task tray icon.");
            }

            //Initialise music player
            try
            {
                MusicPlayer.OnMusicStarted += MusicPlayer_MusicStarted;
                MusicPlayer.ScanDirectory();
                MusicStartDelayed();
            }
            catch (Exception ex)
            {
                HandleError(ex, "Error initialising music player.");
            }

            //Initialise global input listener
            try
            {
                input = new InputListener();
                input.KeyboardUpdated += Input_KeyPressed;
            }
            catch (Exception ex)
            {
                HandleError(ex, "Error initialising input listener.");
            }

            //Register menu actions
            MenuHandler.HomeAction += Menu_Home;

            ShowCollectionPage();

#if DEBUG
            WindowStyle = WindowStyle.SingleBorderWindow;
#endif
        }