예제 #1
0
        private void Slider_ValueChanged(MinMaxSliderVM sender, double delta)
        {
            ChainedSliderVM thisSlider = (ChainedSliderVM)sender;

            List <ChainedSliderVM> sliderstochange = UnlockedSliders.Where(T => T != thisSlider).ToList();
            double eachperslider = delta / sliderstochange.Count;

            foreach (var slider in sliderstochange)
            {
                slider.Add(eachperslider);
            }
            if (thisSlider != null)
            {
                thisSlider.Add(MaxValue - TotalValues);
            }

            foreach (var item in UnlockedSliders)
            {
                item.OnPropertyChanged(nameof(ChainedSliderVM.Value));
                item.OnPropertyChanged(nameof(ChainedSliderVM.SliderValue));
            }
        }
예제 #2
0
        public ComponentAbilityDesignVM(ComponentDesignVM designVM, ComponentDesignAbility designAbility, StaticDataStore staticData)
        {
            _designAbility  = designAbility;
            _staticData     = staticData;
            _parentDesignVM = designVM;


            switch (designAbility.GuiHint)
            {
            case GuiHint.GuiTechSelectionList:

                foreach (var kvp in designAbility.GuidDictionary)
                {
                    TechSD sd = _staticData.Techs[Guid.Parse((string)kvp.Key)];
                    TechList.Add(sd, sd.Name);
                }
                TechList.SelectedIndex          = 0;
                TechList.SelectionChangedEvent += TechList_SelectionChangedEvent;
                break;

            case GuiHint.GuiSelectionMaxMin:
            {
                minMaxSliderVM = new MinMaxSliderVM();

                designAbility.SetMax();
                designAbility.SetMin();
                designAbility.SetValue();
                designAbility.SetStep();
                minMaxSliderVM.Name             = Name;
                minMaxSliderVM.MaxValue         = MaxValue;
                minMaxSliderVM.MinValue         = MinValue;
                minMaxSliderVM.StepValue        = StepValue;
                minMaxSliderVM.Value            = Value; //.PreLoadedValue = Value; //hack due to eto bug. MinMaxSlider.Value = Value;
                minMaxSliderVM.PropertyChanged += MinMaxSlider_PropertyChanged;
            }
            break;
            }
        }