private async Task Send() { DialogResult result = DialogResult.Yes; if (RequestType == WebRequestType.Delete) { result = MessageBox.Show(GlobalStrings.AdvancedCreator_WarningDelete, GlobalStrings.Warning, MessageBoxButtons.YesNo, MessageBoxIcon.Warning); } if (result == DialogResult.Yes) { string json = await _bridge.SendRawCommandAsyncTask(Url, Text, RequestType); if (json == null) { _bridge.ShowErrorMessages(); } else { if (RequestType == WebRequestType.Get) { Text = JsonConvert.SerializeObject(JsonConvert.DeserializeObject(json), Formatting.Indented); } else { MessageBox.Show(_bridge.LastCommandMessages.ToString(), GlobalStrings.Success, MessageBoxButtons.OK, MessageBoxIcon.Information); OnObjectCreated?.Invoke(this, EventArgs.Empty); } } } }
public GameObject Create(string key, Vector3 position, Quaternion rotation) { if (m_poolDict.DoesNotContainKey(key)) { return(null); } OnObjectCreated?.Invoke(); GameObject _obj = m_poolDict[key].Get(position, rotation); UpdatePooledObjects(_obj, (IPooledObject _poolObj) => _poolObj.OnSpawned()); return(_obj); }
private void _insertGameObject_Click(object sender, EventArgs e) { Point cursorPosition = PointToClient(Cursor.Position); OnObjectCreated?.Invoke(this, new GameObjectCreatedArgs(cursorPosition.ToVector2())); }
private void InvokeObjectCreated() { OnObjectCreated?.Invoke(this, EventArgs.Empty); }
private void _acvm_OnObjectCreated(object sender, EventArgs e) { OnObjectCreated?.Invoke(this, EventArgs.Empty); }
/// <summary> /// Constructs a new instance of ObjectPool /// </summary> /// <param name="objectGenerator"> /// Funtions for constructing new instance of T /// </param> /// <param name="shimGenerator"> /// Function that greater shinning object for the object of T /// </param> /// <param name="limit"> /// Sets the limit of how many objects will be in the pool. /// </param> public ObjectPool(Func <T> objectGenerator, Func <T, Tshim> shimGenerator, int limit = 500) { inner = new ObjectPool <T>(objectGenerator, limit); inner.OnObjectCreated += (sender, args) => OnObjectCreated?.Invoke(this, new CreatedObjectEventArgs <T, Tshim>(this)); ShimGenerator = shimGenerator ?? throw new ArgumentNullException(nameof(shimGenerator)); }