Ejemplo n.º 1
0
        public ToolViewModel(MapInfoProxy proxy)
        {
            this.mapInfoProxy = proxy;

            if (this.mapInfoProxy == null)
            {
                return;
            }

            this.mapInfoProxy.Subscribe(
                nameof(MapInfoProxy.Maps),
                () =>
            {
                if (this.mapInfoProxy?.Maps?.MapList == null)
                {
                    return;
                }
                // M の中身は殆ど変更通知してくれないし全部一括作りなおししかしないひどい実装
                this.Maps = this.mapInfoProxy.Maps.MapList
                            .OrderBy(x => x.Id)
                            .Select(x => new MapViewModel(x))
                            .Where(x => !x.IsCleared)
                            .ToArray();
                this.IsNoMap = !this.Maps.Any();
                this.FleetsUpdated();
            }, false);

            KanColleClient.Current
            .Subscribe(nameof(KanColleClient.IsStarted), Initialize, false);
        }
Ejemplo n.º 2
0
        public ToolViewModel(MapInfoProxy proxy)
        {
            this.mapInfoProxy = proxy;

            if (this.mapInfoProxy == null)
            {
                return;
            }

            this.CompositeDisposable.Add(new PropertyChangedEventListener(this.mapInfoProxy)
            {
                {
                    () => this.mapInfoProxy.Maps, (sender, args) =>
                    {
                        this.Maps = this.mapInfoProxy.Maps.MapList
                                    .OrderBy(x => x.Id)
                                    .Select(x => new MapViewModel(x))
                                    .Where(x => !x.IsCleared)
                                    .ToArray();
                        this.IsNoMap = !this.Maps.Any();
                    }
                }
            });
        }