コード例 #1
0
ファイル: ItemViewModel.cs プロジェクト: blackkatmork13/cbs1
        public ItemViewModel(PlayerInventoryViewModel context, Possession possession)
        {
            Context      = context;
            Value        = possession;
            BaseItemInfo = new Command(async() =>
            {
                await Context.Navigation.PushAsync(InfoPage.Show(Value.Item));
            }, () => Value.BaseItem != null);

            ShowInfo = new Command(async(par) =>
            {
                if (par is MagicViewModel m)
                {
                    await Context.Navigation.PushAsync(InfoPage.Show(m.Magic));
                }
            });
            OnDelete = new Command((par) =>
            {
                if (par is MagicViewModel m)
                {
                    Value.MagicProperties.RemoveAll(s => ConfigManager.SourceInvariantComparer.Equals(s, m.Magic.Name + " " + ConfigManager.SourceSeperator + " " + m.Magic.Source));
                    Magic.ReplaceRange(new List <MagicViewModel>());
                    UpdateMagic();
                    IsChanged = true;
                    Context.FirePlayerChanged();
                }
            });
            UpdateMagic();
        }
コード例 #2
0
ファイル: ItemViewModel.cs プロジェクト: blackkatmork13/cbs1
 public ItemViewModel(PlayerInventoryViewModel context) : this(context, new Possession(context.Context, "", 1))
 {
     IsNew = true;
 }