Esempio n. 1
0
        public void CopyModeProfileFromTemplate(int templateModeSource, int destinationMode)
        {
            if (!ModeProfiles.ContainsKey(templateModeSource))
            {
                return;
            }

            var sourceMap = ModeProfiles[templateModeSource];

            var isDestinationMapFound = ModeProfiles.TryGetValue(destinationMode, out var destinationMap);

            if (!isDestinationMapFound)
            {
                //if a mode is expected to be there but isn't. rebuild its profile list from the first entry (mode=1)
                var firstMap        = ModeProfiles[1];
                var modeCount       = ModeProfiles.Count;
                var missingMapCount = destinationMode - modeCount;
                for (var i = 1; i <= missingMapCount; i++)
                {
                    ModeProfiles.Add(i + modeCount, firstMap.ToObservableCollection());
                }
                destinationMap = ModeProfiles[destinationMode];
            }

            destinationMap.Clear();
            CopyButtonMapProfile(sourceMap, destinationMap);
        }
Esempio n. 2
0
        //todo pass in the mode profile key for the profile you want to template from
        public int SetupNewModeProfile()
        {
            var maxKey  = ModeProfiles.OrderByDescending(x => x.Key).First();
            var newMode = maxKey.Key + 1;

            var newButtonMap = new ObservableCollection <IHotasBaseMap>();

            ModeProfiles.Add(newMode, newButtonMap);

            //create an empty button map, but do not switch to it yet
            SeedButtonMapProfileFromDeviceCapabilities(newButtonMap);

            return(newMode);
        }
Esempio n. 3
0
 private void InitializeModeProfile()
 {
     ModeProfiles.Add(1, ButtonMap);
 }