Inheritance: IViewModel, INotifyPropertyChanged
Beispiel #1
0
        public MainViewModel()
        {
            try
            {
                m_config = AppConfig.Load();
            }
            catch(Exception e)
            {
                MessageBox.Show($"app.configを読み込めませんでした:{e.Message}");
                Application.Current.Shutdown();
            }

            Units = new UnitViewModel(m_config);
            OwnedIdol = new OwnedIdolViewModel(m_config,Units);
            ImplementedIdol = new ImplementedIdolViewModel(m_config, OwnedIdol);
            Simulation = new SimulationViewModel(m_config);
        }
Beispiel #2
0
        public MainViewModel()
        {
            try
            {
                m_config = AppConfig.Load();
            }
            catch (Exception e)
            {
                MessageBox.Show($"app.configを読み込めませんでした:{e.Message}");
                Application.Current.Shutdown();
            }

            Units           = new UnitViewModel(m_config, this);
            OwnedIdol       = new OwnedIdolViewModel(m_config, this);
            ImplementedIdol = new ImplementedIdolViewModel(m_config, this);
            Simulation      = new SimulationViewModel(m_config);
            Potential       = new PotentialViewModel(m_config);
        }
        public ImplementedIdolViewModel(AppConfig config, OwnedIdolViewModel ovm)
        {
            m_config = config;
            m_ovm = ovm;

            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);
        }