Esempio n. 1
0
        //PROCESSING OF BIPLINKS AND STREAM LINKS STILL MISSING
        public static bool FindSolution(GenericPanelBinding genericBinding, ref bool settingsWereModified)
        {
            settingsWereModified = false;

            /*
             * 1) Check, are there multiple such panels where hardware does not match? If so user must map them
             *    If only 1, then we can map it without asking questions.
             */
            var count = _genericBindings.FindAll(o => (o.HardwareWasFound == false) && (o.PanelType == genericBinding.PanelType)).Count;

            if (count == 1)
            {
                var hidSkeleton = HIDHandler.GetInstance().HIDSkeletons.Find(o => o.PanelInfo.GamingPanelType == genericBinding.PanelType);
                if (hidSkeleton != null)
                {
                    //This we can map ourselves!
                    genericBinding.HIDInstance = hidSkeleton.InstanceId;
                    settingsWereModified       = true;
                    MessageBox.Show("USB settings has changed. Please save the profile.", "USB changes found", MessageBoxButton.OK, MessageBoxImage.Information);
                }
                else
                {
                    MessageBox.Show("Reference found in bindings file to a " + genericBinding.PanelType.GetDescriptionField() + ", no such hardware found.", "Hardware missing", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                }
                return(true);
            }

            return(false);
        }
Esempio n. 2
0
 public HIDHandler()
 {
     if (_instance != null)
     {
         throw new Exception("HIDHandler already exists.");
     }
     _instance = this;
 }
        // PROCESSING OF BIPLINKS AND STREAM LINKS STILL MISSING
        public static bool FindSolution(GenericPanelBinding genericBinding, ref bool settingsWereModified)
        {
            settingsWereModified = false;

            /*
             * 1) Check, are there multiple such panels where hardware does not match? If so user must map them
             *    If only 1, then we can map it without asking questions.
             */
            var count = 0;

            lock (_genericBindingsLock)
            {
                count = _genericBindings
                        .FindAll(o => (o.InUse == false) && (o.PanelType == genericBinding.PanelType)).Count;
            }

            if (count == 1)
            {
                var hidSkeleton = HIDHandler.GetInstance().HIDSkeletons.Find(o => o.PanelInfo.GamingPanelType == genericBinding.PanelType && o.IsAttached);
                if (hidSkeleton != null)
                {
                    // This we can map ourselves!
                    genericBinding.HIDInstance = hidSkeleton.HIDInstance;
                    settingsWereModified       = true;
                    MessageBox.Show("USB settings has changed. Please save the profile.", "USB changes found", MessageBoxButton.OK, MessageBoxImage.Information);
                }
                else
                {
                    MessageBox.Show("Reference found in bindings file to a " + genericBinding.PanelType.GetEnumDescriptionField() + ", no such hardware found.", "Hardware missing", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                    if (MessageBox.Show(
                            "Do you want to remove the configuration(s) for the " +
                            genericBinding.PanelType.GetEnumDescriptionField() + ".", "Delete configuration",
                            MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
                    {
                        settingsWereModified          = true;
                        genericBinding.HasBeenDeleted = true;

                        MessageBox.Show(
                            "Profile has been changed, please save the profile.",
                            "Panel Removed", MessageBoxButton.OK, MessageBoxImage.Information);
                    }
                }

                return(true);
            }

            return(false);
        }
 public static void SendBinding(string hidInstance)
 {
     lock (_genericBindingsLock)
     {
         var hardwareFound = HIDHandler.GetInstance().HIDSkeletons
                             .Any(o => o.IsAttached && o.HIDInstance.Equals(hidInstance));
         foreach (var genericPanelBinding in _genericBindings)
         {
             if (genericPanelBinding.HIDInstance.Equals(hidInstance) && genericPanelBinding.InUse == false &&
                 hardwareFound)
             {
                 genericPanelBinding.InUse = true;
                 AppEventHandler.ProfileEvent(null, ProfileEventEnum.ProfileSettings, genericPanelBinding,
                                              DCSFPProfile.SelectedProfile);
             }
         }
     }
 }
Esempio n. 5
0
        public static bool VerifyBindings(ref bool settingsWereModified)
        {
            foreach (var genericBinding in _genericBindings)
            {
                var found = false;

                foreach (var hidSkeleton in HIDHandler.GetInstance().HIDSkeletons)
                {
                    if (genericBinding.HIDInstance == hidSkeleton.InstanceId)
                    {
                        genericBinding.HardwareWasFound = true;
                        found = true;
                        break;
                    }
                }

                if (!found)
                {
                    genericBinding.HardwareWasFound = false;
                }
            }

            var problemsPersists = false;

            foreach (var genericBinding in _genericBindings)
            {
                if (genericBinding.HardwareWasFound == false)
                {
                    if (!FindSolution(genericBinding, ref settingsWereModified))
                    {
                        problemsPersists = true;
                    }
                }
            }

            if (problemsPersists)
            {
                return(false);
            }

            return(true);
        }
Esempio n. 6
0
 public static HIDHandler GetInstance()
 {
     return(_instance ?? (_instance = new HIDHandler()));
 }