private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            string   exePath          = Assembly.GetEntryAssembly().Location;
            FileInfo fi               = new FileInfo(exePath);
            string   workingDirectory = fi.Directory.FullName;

            PlayerDLL.ApplicationStart(workingDirectory);
        }
 private void Window_Closed(object sender, EventArgs e)
 {
     try
     {
         PlayerDLL.ApplicationQuit();
     }
     catch (Exception ex)
     {
         Console.Error.WriteLine("Failed to quit application. Exception={0}", ex);
     }
 }
 private void BtnScene_Click(object sender, RoutedEventArgs e)
 {
     foreach (Button button in _mRefButtons)
     {
         if (button == sender)
         {
             button.Background = new SolidColorBrush(Color.FromArgb(255, 0, 255, 0));
             PlayerDLL.PlayerSelectScene((int)button.DataContext);
         }
         else
         {
             button.Background = new SolidColorBrush(Colors.LightGray);
         }
     }
 }
        private void BtnPlay_Click(object sender, RoutedEventArgs e)
        {
            _mBtnPlay.Background = new SolidColorBrush(Color.FromArgb(255, 0, 255, 0));
            _mBtnStop.Background = new SolidColorBrush(Colors.LightGray);

            if (!_mInitialized)
            {
                _mInitialized = true;
                int result = PlayerDLL.PlayerChromaInit();
                if (result == 0)
                {
                    _mTextStatus.Text = "STATUS: CHROMA [ACTIVE]";
                }
                else
                {
                    _mTextStatus.Text = string.Format("STATUS: CHROMA [ERROR] Code: {0}", result);
                }
            }
        }
        private void BtnLoadScene_Click(object sender, RoutedEventArgs e)
        {
            _mButtons.Children.Clear();
            _mRefButtons.Clear();

            OpenFileDialog openFileDialog = new OpenFileDialog();

            if (openFileDialog.ShowDialog() == true)
            {
                string path = openFileDialog.FileName;
                if (!string.IsNullOrEmpty(path))
                {
                    try
                    {
                        string contents = File.ReadAllText(path);
                        JArray json     = JArray.Parse(contents);
                        int    i        = 0;
                        foreach (JObject scene in json)
                        {
                            string description = (string)scene.GetValue("description");
                            AddButton(i, description);
                            ++i;
                        }
                    }
                    catch
                    {
                    }

                    int result = PlayerDLL.LoadScene(path);
                    if (result == 0)
                    {
                        PlayerDLL.PlayerSelectScene(0); //reset scene selection
                    }
                    else
                    {
                        Console.Error.WriteLine("Failed to load scene! {0}", path);
                    }
                }
            }
        }