async Task Save() { if (String.IsNullOrWhiteSpace(Module.moduleID) && String.IsNullOrWhiteSpace(Module.creditID) && String.IsNullOrWhiteSpace(Module.staffID) && String.IsNullOrWhiteSpace(Module.moduleName) && String.IsNullOrWhiteSpace(Module.courseID)) { await _pageService.DisplayAlert("Error", "Please enter All the Fields", "OK"); return; } if (Module.id == 0) { await _moduleStore.AddModule(Module); ModuleAdded?.Invoke(this, Module); } else { await _moduleStore.UpdateModule(Module); ModuleUpdated?.Invoke(this, Module); } await _pageService.PopModalAsync(); }
public void BroadcastEquip(Pickupable pickupable, GameObject owner, string slot) { NitroxId ownerId = NitroxEntity.GetId(owner); NitroxId itemId = NitroxEntity.GetId(pickupable.gameObject); TechType techType = pickupable.GetTechType(); if (techType == TechType.VehicleStorageModule) { List <InteractiveChildObjectIdentifier> childIdentifiers = VehicleChildObjectIdentifierHelper.ExtractInteractiveChildren(owner); VehicleChildUpdate vehicleChildInteractiveData = new VehicleChildUpdate(ownerId, childIdentifiers); packetSender.Send(vehicleChildInteractiveData); } Transform parent = pickupable.gameObject.transform.parent; pickupable.gameObject.transform.SetParent(null); byte[] bytes = SerializationHelper.GetBytes(pickupable.gameObject); EquippedItemData equippedItem = new EquippedItemData(ownerId, itemId, bytes, slot, techType.ToDto()); Player player = owner.GetComponent <Player>(); if (player != null) { PlayerEquipmentAdded equipmentAdded = new PlayerEquipmentAdded(techType.ToDto(), equippedItem); packetSender.Send(equipmentAdded); pickupable.gameObject.transform.SetParent(parent); return; } ModuleAdded moduleAdded = new ModuleAdded(equippedItem); packetSender.Send(moduleAdded); pickupable.gameObject.transform.SetParent(parent); }
public IDebugModule3 GetOrCreate(SbModule lldbModule, IGgpDebugProgram program) { lock (cache) { if (!cache.TryGetValue(lldbModule, out IDebugModule3 module)) { module = moduleCreator(lldbModule, nextLoadOrder++, program); cache.Add(lldbModule, module); // TODO: Simplify inter-thread interactions in the VSI, and as part // of that find a less ad-hoc solution to ModuleAdded/Removed event thread // safety issues mainThreadDispatcher.Post(() => { try { ModuleAdded?.Invoke(Self, new ModuleAddedEventArgs(module)); } catch (Exception e) { Trace.WriteLine( $"Warning: ModuleAdded handler failed with exception: {e}"); } }); } ; return(module); } }
public int AddModule(Surrogate.Controller.IController module) { var key = module.GetHashCode(); modules.Add(key, module); ModuleAdded?.Invoke(this, new ModuleArgs(module, key)); return(key); }
protected virtual void OnModuleAdded(IControllerModule e) { ModuleAdded?.Invoke(this, e); }