示例#1
0
        /// <summary>
        /// Create a new OCPP get composite schedule response.
        /// </summary>
        /// <param name="Status">The result of the request.</param>
        /// <param name="ConnectorId">The charging schedule contained in this notification applies to a specific connector.</param>
        /// <param name="ScheduleStart">The periods contained in the charging profile are relative to this timestamp.</param>
        /// <param name="ChargingSchedule">The planned composite charging schedule, the energy consumption over time. Always relative to ScheduleStart.</param>
        public GetCompositeScheduleResponse(GetCompositeScheduleStatus Status,
                                            Connector_Id ConnectorId,
                                            DateTime?ScheduleStart,
                                            ChargingSchedule ChargingSchedule)

            : base(Result.OK())

        {
            this.Status           = Status;
            this.ConnectorId      = ConnectorId;
            this.ScheduleStart    = ScheduleStart ?? new DateTime?();
            this.ChargingSchedule = ChargingSchedule;
        }
        /// <summary>
        /// Create a new get composite schedule response.
        /// </summary>
        /// <param name="Request">The start transaction request leading to this response.</param>
        /// <param name="Status">The result of the request.</param>
        /// <param name="ConnectorId">The charging schedule contained in this notification applies to a specific connector.</param>
        /// <param name="ScheduleStart">The periods contained in the charging profile are relative to this timestamp.</param>
        /// <param name="ChargingSchedule">The planned composite charging schedule, the energy consumption over time. Always relative to ScheduleStart.</param>
        public GetCompositeScheduleResponse(CS.GetCompositeScheduleRequest Request,
                                            GetCompositeScheduleStatus Status,
                                            Connector_Id?ConnectorId,
                                            DateTime?ScheduleStart,
                                            ChargingSchedule ChargingSchedule)

            : base(Request,
                   Result.OK())

        {
            this.Status           = Status;
            this.ConnectorId      = ConnectorId;
            this.ScheduleStart    = ScheduleStart;
            this.ChargingSchedule = ChargingSchedule;
        }
示例#3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ListChargingScheduleViewModel"/> class.
        /// </summary>
        ///
        /// <param name="dataStore">                     The data store. </param>
        public ListChargingScheduleViewModel(ChargingScheduleDataStore dataStore)
            : base("Charging Schedule List View Model")
        {
            this.IsChargingScheduleListVisible = true;

            this.ChargingSchedules = new ObservableCollection <ChargingSchedule>();

            this.DataStore = dataStore;

            this.RefreshChargingSchedules = ReactiveCommand.CreateFromTask(this.GetChargingSchedulesAsync).DisposeWith(this.Disposables);

            this.NavigateToEditChargingScheduleViewModel = ReactiveCommand.CreateFromObservable <Guid, IRoutableViewModel>(this.EditChargingSchedule).DisposeWith(this.Disposables);

            this.Schedules = new ();
            for (var i = 0; i < 5; i++)
            {
                this.Schedules.Add(new Models.ChargingSchedule {
                    DateTime = DateTime.Today, Range = "150 mi"
                });
            }

            this.WhenAnyValue(vm => vm.Schedules)
            .Select(schedules => schedules.Any())
            .ToPropertyEx(this, vm => vm.IsChargingScheduleListVisible)
            .DisposeWith(this.Disposables);

            this.WhenAnyValue(vm => vm.DateSelected)
            .Subscribe(dateSelected =>
            {
                if (dateSelected.CompareTo(DateTime.Today) == 1)
                {
                    var chargingSchedule = new ChargingSchedule
                    {
                        DateTime = dateSelected,
                    };
                    if (this.DataStore.TryAddData <ChargingSchedule>(chargingSchedule))
                    {
                        this.HostScreen.Router.Navigate
                        .Execute(Locator.Current.GetService <IRoutableViewModel>(nameof(EditChargingScheduleViewModel)))
                        .Subscribe()
                        .DisposeWith(this.Disposables);
                    }
                }
            })
            .DisposeWith(this.Disposables);
        }