Inheritance: IViewModel
Beispiel #1
0
        public UnitViewModel(AppConfig config, MainViewModel mvm)
        {
            m_config = config;
            m_mvm = mvm;

            SendToSlotCommand = new DelegateCommand<string>(SendToSlot, x => SelectedIdol != null);
            SaveCommand = new DelegateCommand(Save, () => !string.IsNullOrEmpty(UnitName));
            DeleteCommand = new DelegateCommand(Delete, () => Units.Contains(SelectedUnit));
            MoveToSlotCommand = new DelegateCommand<string>(MoveToSlot, CanMoveToSlot);
            ResetSlotCommand = new DelegateCommand<string>(ResetSlot, CanResetSlot);
            HighlightCommand = new DelegateCommand<string>(Highlight, CanHighlight);
            CopyIidCommand = new DelegateCommand(CopyIid, () => SelectedIdol != null);
            SetGuestCenterCommand = new DelegateCommand(SetGuestCenter, () => SelectedIdol != null);
            CopyIidFromSlotCommand = new DelegateCommand<string>(CopyIidFromSlot);
            SetGuestCenterFromSlotCommand = new DelegateCommand<string>(SetGuestCenterFromSlot);

            Idols = new ListCollectionView(m_config.OwnedIdols);
            Filter = new IdolFilter(config, Idols, false);
            Filter.SetConfig(config.UnitIdolFilterConfig);

            Units = m_config.Units;

            TemporalUnit = new Unit();
            SelectedUnit = Units.FirstOrDefault();

            foreach (var option in config.UnitIdolSortOptions)
            {
                Idols.SortDescriptions.Add(option.ToSortDescription());
            }
        }
Beispiel #2
0
        public OwnedIdolViewModel(AppConfig config, MainViewModel mvm)
        {
            m_config = config;
            m_mvm = mvm;
            Idols = new ListCollectionView(config.OwnedIdols);
            Filter = new IdolFilter(config, Idols, enableOwnedFilter: false);
            Filter.SetConfig(config.OwnedIdolFilterConfig);

            foreach (var option in config.OwnedIdolSortOptions)
            {
                Idols.SortDescriptions.Add(option.ToSortDescription());
            }

            DeleteCommand = new DelegateCommand(Delete, () => SelectedIdols != null && SelectedIdols.Count > 0);
            CopyIidCommand = new DelegateCommand(CopyIid, () => SelectedIdols != null && SelectedIdols.Count == 1);
            SetGuestCenterCommand = new DelegateCommand(SetGuestCenter, () => SelectedIdols != null && SelectedIdols.Count == 1);
        }
        public ImplementedIdolViewModel(AppConfig config, MainViewModel mvm)
        {
            m_config = config;
            m_mvm = mvm;

            Idols = new ListCollectionView(m_config.ImplementedIdols);
            Filter = new IdolFilter(config, Idols, true);
            Filter.SetConfig(config.ImplementedIdolFilterConfig);

            foreach(var option in m_config.ImplementedIdolSortOptions)
            {
                Idols.SortDescriptions.Add(option.ToSortDescription());
            }

            ReloadDataCommand = new AwaitableDelegateCommand(ReloadData);
            AddToOwnedCommand = new DelegateCommand(AddToOwned, () => SelectedIdols!=null && SelectedIdols.Count > 0);
            CopyIidCommand = new DelegateCommand(CopyIid, () => SelectedIdols != null && SelectedIdols.Count ==1);
            SetGuestCenterCommand = new DelegateCommand(SetGuestCenter, () => SelectedIdols != null && SelectedIdols.Count == 1);
        }