Example #1
0
        private void btnProperties_Click(object sender, RoutedEventArgs e)
        {
            PropWindow win = new PropWindow(properties, device.Type.ToString());

            win.ShowDialog();

            if (win.customCalibrate)
            {
                CalibrateWindow cb = new CalibrateWindow(device);
                cb.ShowDialog();

                if (cb.doSave)
                {
                    win.props.calString = cb.Calibration.ToString();
                    win.ShowDialog();
                }
                else
                {
                    win.Show();
                }
            }

            if (win.doSave)
            {
                ApplyCalibration(win.props.calPref, win.props.calString);
                properties    = new Property(win.props);
                snapIRpointer = properties.pointerMode != Property.PointerOffScreenMode.Center;
                SetName(properties.name);
                UserPrefs.Instance.AddDevicePref(properties);
                UserPrefs.SavePrefs();
            }
        }
Example #2
0
 private void menu_MsBluetooth_Click(object sender, RoutedEventArgs e)
 {
     menu_MsBluetooth.IsChecked     = !menu_MsBluetooth.IsChecked;
     WinBtStream.ForceToshibaMode   = !menu_MsBluetooth.IsChecked;
     UserPrefs.Instance.toshibaMode = !menu_MsBluetooth.IsChecked;
     UserPrefs.SavePrefs();
 }
Example #3
0
        public static bool LoadPrefs()
        {
            bool          successful = false;
            XmlSerializer X          = new XmlSerializer(typeof(UserPrefs));

            try
            {
                if (File.Exists(DataPath))
                {
                    using (FileStream stream = File.OpenRead(DataPath))
                        using (StreamReader reader = new StreamReader(stream))
                        {
                            _instance = X.Deserialize(reader) as UserPrefs;
                            reader.Close();
                            stream.Close();
                        }

                    successful = true;

                    if (_instance != null && _instance.devicePrefs != null)
                    {
                        _instance.defaultProperty = _instance.devicePrefs.Find((p) => p.hid.ToLower().Equals("all"));
                    }
                }
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.Message);
            }

            return(successful);
        }
Example #4
0
 private void menu_AutoRefresh_Click(object sender, RoutedEventArgs e)
 {
     menu_AutoRefresh.IsChecked     = !menu_AutoRefresh.IsChecked;
     UserPrefs.Instance.autoRefresh = menu_AutoRefresh.IsChecked;
     UserPrefs.SavePrefs();
     AutoRefresh(menu_AutoRefresh.IsChecked && groupAvailable.Children.Count + groupXinput.Children.Count == 0);
 }
Example #5
0
 private void menu_AutoRefresh_Click(object sender, RoutedEventArgs e)
 {
     menu_AutoRefresh.IsChecked     = !menu_AutoRefresh.IsChecked;
     UserPrefs.Instance.autoRefresh = menu_AutoRefresh.IsChecked;
     UserPrefs.SavePrefs();
     AutoRefresh(menu_AutoRefresh.IsChecked && ApplicationIsActivated());
 }
Example #6
0
 private void menu_AutoXInput_Click(object sender, RoutedEventArgs e)
 {
     menu_AutoXInput.IsChecked     = !menu_AutoXInput.IsChecked;
     UserPrefs.Instance.autoXInput = menu_AutoXInput.IsChecked;
     UserPrefs.SavePrefs();
     if (menu_AutoXInput.IsChecked)
     {
         Refresh();
     }
 }
Example #7
0
 private void SettingsMenu_Closing(object sender, RoutedEventArgs e)
 {
     UserPrefs.AutoStart = menu_AutoStart.IsChecked;
     UserPrefs.Instance.startMinimized   = menu_StartMinimized.IsChecked;
     UserPrefs.Instance.autoRefresh      = menu_AutoRefresh.IsChecked;
     UserPrefs.Instance.autoRefreshCount = menu_AutoRefreshCount.Value;
     UserPrefs.Instance.greedyMode       = menu_NoSharing.IsChecked;
     UserPrefs.Instance.toshibaMode      = !menu_MsBluetooth.IsChecked;
     UserPrefs.SavePrefs();
 }
Example #8
0
 private void menu_NoSharing_Click(object sender, RoutedEventArgs e)
 {
     menu_NoSharing.IsChecked      = !menu_NoSharing.IsChecked;
     UserPrefs.Instance.greedyMode = menu_NoSharing.IsChecked;
     UserPrefs.SavePrefs();
     WinBtStream.OverrideSharingMode = UserPrefs.Instance.greedyMode;
     if (UserPrefs.Instance.greedyMode)
     {
         WinBtStream.OverridenFileShare = FileShare.None;
     }
 }
Example #9
0
 //this is executed WHENEVER the application is closing and not just when clicking the title_Close button as expected
 //this means the following function WILL get executed even when calling Application.Current.Shutdown() directly
 void title_Close_click(object sender, CancelEventArgs e)
 {
     //cancels the window close command
     if (UserPrefs.Instance.minimizeOnExit)
     {
         HideWindow();
         e.Cancel = true;
     }
     //saves UserPrefs before closing unless UserPrefs are flagged to beg reset
     else if (_reset_prefs != true)
     {
         if (WindowState == WindowState.Normal)
         {
             UserPrefs.Instance.WindowTop  = this.Top;
             UserPrefs.Instance.WindowLeft = this.Left;
             //can use Properties.Settings.Default.Save() command to write/save into executable instead of UserPres
         }
         UserPrefs.SavePrefs();
     }
 }
Example #10
0
 private void menu_StartMinimized_Click(object sender, RoutedEventArgs e)
 {
     menu_StartMinimized.IsChecked     = !menu_StartMinimized.IsChecked;
     UserPrefs.Instance.startMinimized = menu_StartMinimized.IsChecked;
     UserPrefs.SavePrefs();
 }
Example #11
0
 private void menu_AutoStart_Click(object sender, RoutedEventArgs e)
 {
     menu_AutoStart.IsChecked = !menu_AutoStart.IsChecked;
     UserPrefs.AutoStart      = menu_AutoStart.IsChecked;
     UserPrefs.SavePrefs();
 }
Example #12
0
 private void menu_MinimizeOnExit_Click(object sender, RoutedEventArgs e)
 {
     menu_MinimizeOnExit.IsChecked     = !menu_MinimizeOnExit.IsChecked;
     UserPrefs.Instance.minimizeOnExit = menu_MinimizeOnExit.IsChecked;
     UserPrefs.SavePrefs();
 }