private void MonitorComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (!this.initializing)
     {
         MonitorInfo monInfo = ((ComboBoxItem)this.MonitorComboBox.SelectedItem).DataContext as MonitorInfo;
         if (monInfo != null)
         {
             VmultiUtil.setCurrentMonitor(monInfo);
         }
     }
 }
Beispiel #2
0
        /// <summary>
        /// Construct a new Window.
        /// </summary>
        public MainWindow()
        {
            //Set highest priority on main process.
            Process currentProcess = Process.GetCurrentProcess();

            currentProcess.PriorityClass  = ProcessPriorityClass.High;
            Thread.CurrentThread.Priority = ThreadPriority.Normal;

            if (Settings.Default.minimizeOnStart)
            {
                this.ShowActivated = false;
                this.WindowState   = System.Windows.WindowState.Minimized;
            }

            string currentVmultiMonitor        = VmultiUtil.getCurrentMonitorDevicePath();
            IEnumerable <MonitorInfo> monInfos = DeviceUtil.GetMonitorList();

            if (VmultiDevice.Current.isAvailable())
            {
                //See if the selected monitor is still connected to the computer
                if (currentVmultiMonitor != null)
                {
                    string primaryMonitor = null;
                    foreach (MonitorInfo monInfo in monInfos)
                    {
                        if (monInfo.DevicePath == currentVmultiMonitor)
                        {
                            primaryMonitor = currentVmultiMonitor;
                        }
                    }
                    if (primaryMonitor != null)                           //The vmulti monitor is still connected.
                    {
                        Settings.Default.primaryMonitor = primaryMonitor; //Make sure the same value is in settings.
                    }
                    else //The selected monitor is not connected
                    {
                        VmultiUtil.setCurrentMonitor(monInfos.First()); //Use the first monitor in the list.
                    }
                }
                else
                {
                    VmultiUtil.setCurrentMonitor(monInfos.First()); //No setting found, default to first found monitor.
                }
            }
            else
            {
                Settings.Default.primaryMonitor = "";
            }

            defaultInstance = this;

            // Load from the XAML.
            InitializeComponent();
        }
        public WiiPointerProviderSettings()
        {
            InitializeComponent();

            //this.cbSystemCursor.IsChecked = Settings.Default.pointer_changeSystemCursor;
            //this.cbMoveCursor.IsChecked = Settings.Default.pointer_moveCursor;
            if (Settings.Default.pointer_sensorBarPos == "top")
            {
                this.cbiTop.IsSelected = true;
            }
            else if (Settings.Default.pointer_sensorBarPos == "bottom")
            {
                this.cbiBottom.IsSelected = true;
            }
            else
            {
                this.cbiCenter.IsSelected = true;
            }

            if (VmultiDevice.Current.isAvailable())
            {
                string currentMonitor = VmultiUtil.getCurrentMonitorDevicePath();

                IEnumerable <MonitorInfo> monInfos = DeviceUtil.GetMonitorList();

                foreach (MonitorInfo monInfo in monInfos)
                {
                    ComboBoxItem cbItem = new ComboBoxItem();
                    cbItem.Content     = monInfo.FriendlyName;
                    cbItem.DataContext = monInfo;
                    this.MonitorComboBox.Items.Add(cbItem);

                    if (monInfo.DevicePath == currentMonitor)
                    {
                        this.MonitorComboBox.SelectedItem = cbItem;
                    }
                }
                this.initializing = false;
            }
            else
            {
                ComboBoxItem cbItem = new ComboBoxItem();
                cbItem.Content = "Requires driver";
                this.MonitorComboBox.Items.Add(cbItem);
                this.MonitorComboBox.IsEnabled     = false;
                this.MonitorComboBox.SelectedIndex = 0;
                this.initializing = false;
            }
        }