private void DoSaveCommand() { if (this.IsSaveEnabled) { this.CurrentSaveImagePath = KarveToolBarViewModel.currentSaveImage; this.IsSaveEnabled = false; DataPayLoad payLoad = _careKeeper.GetScheduledPayload(); if ((_careKeeper.GetScheduledPayloadType() == DataPayLoad.Type.Insert) || (_states == ToolbarStates.Insert)) { InsertDataCommand dataCommand = new InsertDataCommand(this._dataServices, this._careKeeper, this._eventManager, this._configurationService) { ValidationRules = this._validationRules }; _careKeeper.Do(new CommandWrapper(dataCommand)); _states = ToolbarStates.None; } else { SaveDataCommand dataCommand = new SaveDataCommand(this._dataServices, this._careKeeper, this._eventManager, this._configurationService); payLoad = _careKeeper.Do(new CommandWrapper(dataCommand)); payLoad.PayloadType = DataPayLoad.Type.UpdateView; _eventManager.NotifyObserverSubsystem(payLoad.SubsystemName, payLoad); //DeliverIncomingNotify(payLoad.Subsystem, payLoad); } } this.CurrentSaveImagePath = KarveToolBarViewModel.currentSaveImage; this.IsSaveEnabled = false; }
public void Should_CareKeeper_SchedulePayload() { DataPayLoad dataPayLoad = new DataPayLoad(); dataPayLoad.DataObject = new MockDataObject(); dataPayLoad.HasDataObject = true; dataPayLoad.ObjectPath = new Uri("karve://suppliers/viewmodel/id/8393839"); _keeper.Schedule(dataPayLoad); Assert.AreEqual(_keeper.GetScheduledPayload().Count, 1); }
public void ShouldCareKeeper_Schedule_Item() { Guid guid = Guid.NewGuid(); Uri uri = new Uri("karve://suppliers/viewmodel?id=" + guid.ToString()); DataPayLoad payload = new DataPayLoad(); payload.ObjectPath = uri; payload.DataObject = new SupplierViewObject(); _careKeeper.Schedule(payload); var schedulerQueue = _careKeeper.GetScheduledPayload(); var scheduledPayload = schedulerQueue.Dequeue(); Assert.AreEqual(scheduledPayload.ObjectPath, uri); }