Esempio n. 1
0
        private async void DownLoadOC()
        {
            b_dl_OC.IsEnabled = false;

            b_dl_OC.Content = "Check for Open Composite update";
            string latesthash = await OC.GetLatestHash();

            await Task.Delay(2000);

            if (latesthash is null)
            {
                b_dl_OC.Content = "Open Composite version Check: connection failed!";
                await Task.Delay(2000);
            }
            else if (!OC.CheckForVersion(latesthash))
            {
                b_dl_OC.Content = "New version available!";
                await Task.Delay(2000);

                b_dl_OC.Content = "Downloading Open Composite...";
                bool download = await OC.downloadDll();

                if (!download)
                {
                    b_dl_OC.Content = "Open Composite Download: connection failed!";
                    await Task.Delay(3000);

                    b_dl_OC.Content = "Download Open Composite";
                }
                else
                {
                    b_dl_OC.Content = "Open Composite is updated.";
                    await Task.Delay(3000);

                    b_dl_OC.Content = "Download Open Composite";
                }
            }
            else
            {
                b_dl_OC.Content = "Download Open Composite";
            }


            if (!OC.IsAvailable())
            {
                cb_OC.Foreground = Brushes.Red;
                cb_OC.Content    = "Open Composite not available";
                cb_OC.IsEnabled  = false;
            }
            else
            {
                cb_OC.Foreground = Brushes.Black;
                cb_OC.Content    = "Use Open Composite";
                cb_OC.IsEnabled  = true;
            }

            b_dl_OC.IsEnabled = true;
        }
Esempio n. 2
0
 private void Cb_OC_Click(object sender, RoutedEventArgs e)
 {
     if (cb_OC.IsChecked != true)
     {
         OC.DisableOC();
     }
     else
     {
         OC.EnableOC();
     }
 }
Esempio n. 3
0
        public MainWindow()
        {
            InitializeComponent();
            #region Check Oculus install and Service
            // Check install
            if (Tools.GetOculusInstallFolder() == null)
            {
                MessageBoxResult mb = MessageBox.Show("Oculus installation not found. Please install using OculusSetup.exe", "Oculus register entry not found", MessageBoxButton.OK);
                if (mb == MessageBoxResult.OK)
                {
                    Application.Current.Shutdown();
                    Environment.Exit(0);
                }
            }
            else
            {
                // Renable Native library in case off, due to possible crash on disable
                Tools.SetNativeLibrary(OculusInstallFolder, true);
                OculusInstallFolder = Tools.GetOculusInstallFolder();
                Properties.Settings.Default.HOTSettings = OculusInstallFolder;
                Properties.Settings.Default.Save();
            }

            // Check Service
            if (!Tools.IsOculusServiceRunning())
            {
                MessageBoxResult mb = MessageBox.Show("Oculus service is not running", "Oculus service not found", MessageBoxButton.OK);
                //TODO implement Admin call to activate service.
                if (mb == MessageBoxResult.OK)
                {
                    grid_main.IsEnabled = false;
                    tab_misc.IsSelected = true;
                }
            }
            l_version.Content = "Runtime version: " + Tools.GetLibVersion(OculusInstallFolder);
            #endregion

            #region Check if Oculus Debug tool are available and set default parameter
            if (Tools.IsOculusServiceRunning())
            {
                if (!Tools.SetSS(OculusInstallFolder, ss)) //This also apply SS
                {
                    MessageBox.Show("OculusDebugToolCLI.exe not found or wrong version!\nPlease check your Oculus installation.\nDebug function are disable.");
                    grid_main.IsEnabled = false;
                }
                else // Apply saved settings
                {
                    cb_ASW.SelectedIndex      = asw;
                    cb_debugHUD.SelectedIndex = 0;
                    l_ss.Content = ss;
                    Tools.SetFOV(OculusInstallFolder, hfov, vfov);
                    l_hfov.Content = hfov;
                    l_vfov.Content = vfov;
                    SetValuesGray();
                }
            }

            cb_ASW.ItemsSource = Tools.ASW_Modes;
            #endregion

            #region Read and set Link values
            encode_values er1 = new encode_values();
            er1.value = -1;
            er1.name  = "Default";
            list_encode_res.Add(er1);

            /*
             * encode_res er2 = new encode_res();
             * er2.value = 2352;
             * er2.name = er2.value + " Quest 1 balanced";
             * list_encode_res.Add(er2);
             *
             * encode_res er3 = new encode_res();
             * er3.value = 2608;
             * er3.name = er3.value.ToString();
             * list_encode_res.Add(er3);
             *
             * encode_res er4 = new encode_res();
             * er4.value = 2912;
             * er4.name = er4.value + " Quest 1 quality";
             * list_encode_res.Add(er4);
             *
             * encode_res er5 = new encode_res();
             * er5.value = 3288;
             * er5.name = er5.value.ToString();
             * list_encode_res.Add(er5);
             *
             * encode_res er6 = new encode_res();
             * er6.value = 3664; // Volga suggest https://twitter.com/volgaksoy/status/1316243051791015936
             * er6.name = er6.value + " Quest 2 quality";
             * list_encode_res.Add(er6);
             *
             * encode_res er7 = new encode_res();
             * er7.value = 4000;
             * er7.name = er7.value.ToString();
             * list_encode_res.Add(er7);
             */
            cb_link_res.ItemsSource = list_encode_res;

            sl_bitrate.Value     = Tools.GetLinkBitrate();
            l_link_res.Content   = Tools.GetLinkEncodingResolution();
            l_link_curve.Content = Tools.GetLinkDistortionCurve();
            #endregion

            #region ** OBSOLETE ** Check Admin mode -> Now Admin is default
            //Activate exe check if in Admin mode, or disable Advanced tab if not in Administrator mode.
            //if (!new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator))
            //{
            //    //grid_advanced.IsEnabled = false;
            //    b_add_exe.IsEnabled = false;
            //    b_del_exe.IsEnabled = false;
            //    lv_records.Visibility = Visibility.Hidden;
            //    tb_launcher.Visibility = Visibility.Visible;
            //}
            //else
            //{
            //    //Start exe check with Management Event. Admini required
            //    WqlEventQuery query = new WqlEventQuery("SELECT * FROM Win32_ProcessStartTrace");
            //    ManagementEventWatcher watcher = new ManagementEventWatcher(query);
            //    watcher.EventArrived += new EventArrivedEventHandler(startWatch_EventArrived);
            //    watcher.Start();
            //}
            #endregion

            #region Check if Open Composite is available for use
            if (!OC.IsAvailable())
            {
                //Check is OC is actived
                if (OC.IsActive())
                {
                    cb_OC.IsChecked = true;
                }
                else
                {
                    cb_OC.IsChecked = false;
                }

                cb_OC.Foreground = Brushes.Red;
                cb_OC.Content    = "Open Composite is not available";
                cb_OC.IsEnabled  = false;
            }
            #endregion

            #region Watcher initializzation
            ReadAppsCfg();
            //WqlEventQuery query = new WqlEventQuery("SELECT * FROM Win32_ProcessStartTrace");

            /*WqlEventQuery query = new WqlEventQuery("Select * From __InstanceCreationEvent Within 5 Where TargetInstance Isa 'Win32_Process'");
             * ManagementEventWatcher watcher = new ManagementEventWatcher();
             * watcher.Query = query;
             * watcher.EventArrived += new EventArrivedEventHandler(watcher_EventArrived);
             * watcher.Start();
             *
             * var startWatch = new ManagementEventWatcher("SELECT * FROM Win32_ProcessStartTrace");
             * startWatch.EventArrived += startWatch_EventArrived;
             * startWatch.Start();
             *
             * var stopWatch = new ManagementEventWatcher("SELECT * FROM Win32_ProcessStopTrace");
             * stopWatch.EventArrived += stopWatch_EventArrived;
             * stopWatch.Start();
             */
            #endregion

            #region Check Dash misc option
            //Check Dash SFX
            if (Tools.DashSFX(OculusInstallFolder, 1, false))
            {
                ck_sfx_status.IsChecked = false;
            }
            else
            {
                ck_sfx_status.IsChecked = true;
            }

            //check Dash black BG
            if (Tools.DashBackground(OculusInstallFolder, 0, false))
            {
                ck_blk_dash.IsChecked = false;
            }
            else
            {
                ck_blk_dash.IsChecked = true;
            }
            #endregion
        }