Ejemplo n.º 1
0
        public MainWindow()
        {
            InitializeComponent();

            if (!Settings.IsConfigured())
            {
                SettingsWindow settingsDialog = new SettingsWindow();
                settingsDialog.ShowDialog();
            }


            client = new Client();
            client.videoStateChanged      += clientVideoStateChanged;
            client.connectionStateChanged += clientConnectionStateChanged;
            client.onError      += clientOnError;
            player               = new MPCController();
            player.stateChanged += playerStateChanged;
            player.initialized  += playerInitialized;

            // Not connected
            disconnectGrid.Visibility = Visibility.Hidden;
            connectButton.IsEnabled   = false;
            hostButton.IsEnabled      = false;

            // Run MPC
            mpcProceess = Process.Start(Path.Combine(Directory.GetCurrentDirectory(), "lib/mpc-hc64/mpc-hc64.exe"));
            mpcProceess.EnableRaisingEvents = true;
            mpcProceess.Exited += mpcProceessExited;

            // Window position
            double screenWidth  = SystemParameters.PrimaryScreenWidth;
            double screenHeight = SystemParameters.PrimaryScreenHeight;
            double windowWidth  = this.Width;
            double windowHeight = this.Height;

            this.Left = (screenWidth / 2) - (windowWidth / 2);
            this.Top  = (screenHeight / 2) - (windowHeight / 2) + 175;
        }
Ejemplo n.º 2
0
        private void settingsButton_Click(object sender, RoutedEventArgs e)
        {
            SettingsWindow settingsDialog = new SettingsWindow();

            settingsDialog.ShowDialog();
        }