/// <summary>コンストラクタ。</summary>
        public BleachDialogViewModel(IDialogService dlgService)
        {
            this.dialogService = dlgService;

            var charaList = new BleachAgent().GetAllCharacters();

            this.bleachCharacters = new ObservableCollection <BleachCharacter>(charaList.OrderBy(c => c.Code.Value));

            this.Characters = this.bleachCharacters
                              .ToReadOnlyReactiveCollection(c => new BlearchItemViewModel(c))
                              .AddTo(this.disposables);

            this.SelectedItem = new ReactiveProperty <BlearchItemViewModel>(this.Characters.First())
                                .AddTo(this.disposables);

            this.OkCommand = new ReactiveCommand()
                             .WithSubscribe(() => this.okButton_Click())
                             .AddTo(this.disposables);

            this.ListBoxDoubleClick = new ReactiveCommand()
                                      .WithSubscribe(() => this.listBox_DoubleClick())
                                      .AddTo(this.disposables);

            this.AddCommand = new ReactiveCommand()
                              .WithSubscribe(() => this.addButtonClick())
                              .AddTo(this.disposables);
        }
Ejemplo n.º 2
0
        /// <summary>キャラクターコードの変更イベントハンドラ。</summary>
        /// <param name="characterCode">現在入力されているキャラクターコードを表す文字列。</param>
        private void onCharacterCode(string characterCode)
        {
            var chara = new BleachAgent().GetCharacter(characterCode);

            if (chara == null)
            {
                this.character.Code.Value = string.Empty;
            }
            else
            {
                this.character.Name.Value = chara.Name.Value;
            }
        }
        /// <summary>コンストラクタ。</summary>
        public SearchDialogViewModel()
        {
            var charaList = new BleachAgent().GetAllCharacters();

            this.bleachCharacters = new ObservableCollection <Character>(charaList.OrderBy(c => c.Code.Value));

            this.Characters = this.bleachCharacters
                              .ToReadOnlyReactiveCollection(c => new SearchItemViewModel(c));

            this.SelectedItem = new ReactiveProperty <SearchItemViewModel>(this.Characters.First());

            this.OkCommand = new ReactiveCommand();
            this.OkCommand.Subscribe(() => this.okButton_Click());

            this.ListBoxDoubleClick = new ReactiveCommand();
            this.ListBoxDoubleClick.Subscribe(() => this.listBox_DoubleClick());

            this.AddCommand = new ReactiveCommand();
            this.AddCommand.Subscribe(() => this.addButtonClick());
        }