艦隊の状態を表します。
Inheritance: DisposableNotifier
コード例 #1
0
		public CombinedFleet(Homeport parent, params Fleet[] fleets)
		{
			if (fleets == null || fleets.Length == 0) throw new ArgumentException();

			this.Fleets = fleets;
			this.State = new FleetState(parent, fleets);
			this.CompositeDisposable.Add(this.State);

			foreach (var fleet in fleets)
			{
				this.CompositeDisposable.Add(new PropertyChangedEventListener(fleet)
				{
					{ nameof(Fleet.Name), (sender, args) => this.UpdateName() },
				});

				var source = fleet;
				this.CompositeDisposable.Add(new WeakEventListener<EventHandler, EventArgs>(
					h => new EventHandler(h),
					h => source.State.Updated += h,
					h => source.State.Updated -= h,
					(sender, args) => this.State.Update()));
				this.CompositeDisposable.Add(new WeakEventListener<EventHandler, EventArgs>(
					h => new EventHandler(h),
					h => source.State.Calculated += h,
					h => source.State.Calculated -= h,
					(sender, args) => this.State.Calculate()));
			}

			this.UpdateName();

			this.State.Calculate();
			this.State.Update();
		}
コード例 #2
0
		public HomeportViewModel(FleetState state)
			: base(state)
		{
			this.Condition = new ConditionViewModel(state.Condition);
            this.Repairing = new RepairingViewModel(state.Dock);
			this.CompositeDisposable.Add(this.Condition);
            this.CompositeDisposable.Add(this.Repairing);
		}
コード例 #3
0
		public FleetStateViewModel(FleetState source)
		{
			this.Source = source;
			this.CompositeDisposable.Add(new PropertyChangedEventListener(source)
			{
				(sender, args) => this.RaisePropertyChanged(args.PropertyName),
			});

			this.Sortie = new SortieViewModel(source);
			this.CompositeDisposable.Add(this.Sortie);

			this.Homeport = new HomeportViewModel(source);
			this.CompositeDisposable.Add(this.Homeport);
		}
コード例 #4
0
        public CombinedFleet(Homeport parent, params Fleet[] fleets)
        {
            if (fleets == null || fleets.Length == 0)
            {
                throw new ArgumentException();
            }

            this.Fleets = fleets;
            this.State  = new FleetState(parent, fleets);
            this.CompositeDisposable.Add(this.State);

            foreach (var fleet in fleets)
            {
                this.CompositeDisposable.Add(new PropertyChangedEventListener(fleet)
                {
                    { nameof(Fleet.Name), (sender, args) => this.UpdateName() },
                });

                var source = fleet;
                this.CompositeDisposable.Add(new WeakEventListener <EventHandler, EventArgs>(
                                                 h => new EventHandler(h),
                                                 h => source.State.Updated += h,
                                                 h => source.State.Updated -= h,
                                                 (sender, args) => this.State.Update()
                                                 ));
                this.CompositeDisposable.Add(new WeakEventListener <EventHandler, EventArgs>(
                                                 h => new EventHandler(h),
                                                 h => source.State.Calculated += h,
                                                 h => source.State.Calculated -= h,
                                                 (sender, args) => this.State.Calculate()
                                                 ));
            }

            this.UpdateName();

            this.State.Calculate();
            this.State.Update();
        }
コード例 #5
0
ファイル: Fleet.cs プロジェクト: pocono1/KanColleViewer
 internal void UpdateStatus()
 {
     if (this.Ships.Length == 0) this.State = FleetState.Empty;
     else if (this.Expedition.IsInExecution) this.State = FleetState.Expedition;
     else if (this.homeport.Repairyard.CheckRepairing(this)) this.State = FleetState.Repairing;
     else this.State = FleetState.Ready;
 }
コード例 #6
0
ファイル: Fleet.cs プロジェクト: ranai/KanColleViewer
        internal void Update(kcsapi_deck rawData)
        {
            this.Id = rawData.api_id;
            this.Name = rawData.api_name;
            this.Ships = rawData.api_ship.Select(id => KanColleClient.Current.Homeport.Ships[id]).Where(x => x != null).ToArray();
            this.Expedition.Update(rawData.api_mission);

            if (this.Expedition.IsInExecution) this.State = FleetState.Expedition;
            else if(KanColleClient.Current.Homeport.Repairyard.CheckRepairing(this)) this.State = FleetState.Repairing;
            else this.State = FleetState.Ready;
        }
コード例 #7
0
		public SortieViewModel(FleetState state) : base(state) {
            SortieInfo = state.GetFleet().SortieInfo;
		}
コード例 #8
0
		protected QuickStateViewViewModel(FleetState state)
		{
			this.State = state;
		}
コード例 #9
0
		// QuickStateView は ContentControl に対し型ごとの DataTemplate を適用する形で実現するので
		// 状況に応じた型がそれぞれ必要。これはその 1 つ。

		public SortieViewModel(FleetState state) : base(state) { }