예제 #1
0
        public ViewModelPowerStateOverlay(IObjectElectricityConsumerPublicState consumerPublicState)
        {
            this.consumerPublicState = consumerPublicState;
            this.consumerPublicState.ClientSubscribe(_ => _.ElectricityConsumerState,
                                                     _ => this.Refresh(),
                                                     this);

            this.Refresh();
            this.Update();
            ClientUpdateHelper.UpdateCallback += this.Update;
        }
예제 #2
0
        public ViewModelWindowFridge(
            IStaticWorldObject worldObjectFridge,
            ObjectCratePrivateState privateState,
            Action callbackCloseWindow)
        {
            this.WorldObjectFridge = worldObjectFridge;
            this.ViewModelItemsContainerExchange = new ViewModelItemsContainerExchange(
                privateState.ItemsContainer,
                callbackTakeAllItemsSuccess: callbackCloseWindow);

            if (this.WorldObjectFridge.ProtoStaticWorldObject is IProtoObjectElectricityConsumer)
            {
                this.publicStatePowerConsumer = this.WorldObjectFridge
                                                .GetPublicState <IObjectElectricityConsumerPublicState>();
                this.publicStatePowerConsumer?.ClientSubscribe(
                    _ => _.ElectricityConsumerState,
                    _ => this.NotifyPropertyChanged(nameof(this.IsActive)),
                    this);
            }
        }