public void Release(T instance) { if (_nextReturn == -1) { throw new OutOfMemoryException("Pool can not release any more objects."); } Free++; Reset?.Invoke(instance); _instances[_nextReturn] = instance; if (_nextAvailable == -1) { _nextAvailable = _nextReturn; } _nextReturn++; if (_nextReturn >= Total) { _nextReturn = 0; } if (_nextReturn == _nextAvailable) { _nextReturn = -1; } }
private void Reload() { _original = File.Exists(_filename) ? KsAnim.FromFile(_filename) : KsAnim.CreateEmpty(); if (_wrappers != null) { for (var i = 0; i < _wrappers.Length; i++) { _wrappers[i].Set(null); } Reset?.Invoke(this, EventArgs.Empty); } if (_parent != null) { Initialize(_parent); Set(_currentPosition); } if (_holder != null && _holder.TryGetTarget(out var holder)) { holder.RaiseSceneUpdated(); } }
private void OnReset(object sender, RoutedEventArgs e) { Reset?.Invoke(this, EventArgs.Empty); Simulator.Reset(); EndOfCounterExample.Visibility = Visibility.Hidden; }
protected void btnReset_Click(object sender, EventArgs e) { ClearForm(); // Page should be valid at this point; no need to verify validity. Reset?.Invoke(sender, new FlightQueryEventArgs(Restriction)); }
private void RaiseReset() { if (Reset != null) { Reset.Invoke(); } }
private void RaiseReset(KnownFeature feature) { if (_options.ContainsKey(feature)) { Reset?.Invoke(this, new FeatureEventArgs(feature)); } }
/// <summary> /// Fetches and executes the next <see cref="Instruction"/>. /// </summary> public void Step() { var instruction = Fetch(); try { Decode(instruction); Execute(instruction); Tick?.Invoke(this, new EventArgs()); if (instruction == Instruction.HALT) { Halt?.Invoke(this, new EventArgs()); } if (instruction == Instruction.RESET) { Reset?.Invoke(this, new ResetEventArgs(instruction, null)); } } catch (Exception e) { continueExecution = false; Initialize(); Reset?.Invoke(this, new ResetEventArgs(instruction, e)); // FUTURE: don't throw exception? throw; } }
protected void OnCollectionChangedReset() { var eventArgs = new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset); using (BlockReentrancy()) { CollectionChanged?.Invoke(this, eventArgs); Reset?.Invoke(this, eventArgs); } }
public void ReleaseAll() { _nextAvailable = 0; _nextReturn = -1; Free = Total; foreach (var i in _instances) { Reset?.Invoke(i); } }
public CalcuForm() { InitializeComponent(); button1.Click += delegate { Add?.Invoke(this, EventArgs.Empty); }; button2.Click += delegate { Reset?.Invoke(this, EventArgs.Empty); textBox1.Focus(); }; }
public CalcForm() { InitializeComponent(); btnAdd.Click += delegate { Add?.Invoke(this, EventArgs.Empty); }; btnReset.Click += delegate { Reset?.Invoke(this, EventArgs.Empty); txtNumber1.Focus(); }; }
private static void Collection_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { if (Begin != null) { Begin.Invoke(); } switch (e.Action) { case NotifyCollectionChangedAction.Add: if (Add != null) { Device.BeginInvokeOnMainThread(() => { Add.Invoke(e.NewItems, e.NewStartingIndex); }); } break; case NotifyCollectionChangedAction.Remove: if (Remove != null) { Device.BeginInvokeOnMainThread(() => { Remove.Invoke(e.OldItems, e.OldStartingIndex); }); } break; case NotifyCollectionChangedAction.Reset: if (Reset != null) { //IOS 下,Device.BeginInvokeOnMainThread 导至 Reset 重复触发, // TODO Android 下不确定,待测 //Device.BeginInvokeOnMainThread(() => { Reset.Invoke(); //}); } break; case NotifyCollectionChangedAction.Move: break; case NotifyCollectionChangedAction.Replace: break; } if (Finished != null) { Finished.Invoke(); } }
protected void Invoke() { if (invoked) { return; } if (Reset != null) { Reset.Invoke(); } invoked = true; }
public void ResetFor(int playerNum, int playerLife) { Properties = new PlayerProperties[playerNum]; _failedPlayers = new List <int>(); for (var i = 0; i < Properties.Length; i++) { Properties[i] = new PlayerProperties() { playerId = i + 1, life = playerLife }; } Reset.Invoke(); }
private void InitTimer() { if (Config.Settings.resetTime == null) { return; } resetTimer = new ResetTimer(Config.Settings.resetTime, delegate() { LoadConfig(); Reset?.Invoke(this, null); return(0); }); }
public void ResetState() { Resetting?.Invoke(this, EventArgs.Empty); Memory = new MemoryUnit(); Accumulator = 0; if (Cards != null) { Input = Cards.GetEnumerator(); InputAvailable = Input.MoveNext(); } Reset?.Invoke(this, EventArgs.Empty); }
/// <summary> /// Dispose mapping /// </summary> public void Dispose() { _collisionManager.Dispose(); _regionManager.Dispose(); _eventAreaManager.Dispose(); _lightManager.Dispose(); _terrainManager.Dispose(); _unknowManager.Dispose(); _scriptManager.Dispose(); _waterManager.Dispose(); _potencialManager.Dispose(); _questPropManager.Dispose(); Reset?.Invoke(this, EventArgs.Empty); }
private void newGameToolStripMenuItem_Click(object sender, EventArgs e) { foreach (var control in Controls) { if (!(control is Button)) { continue; } (control as Button).Image = null; (control as Button).Enabled = true; } labelWon.Visible = false; labelLoose.Visible = false; IsWinner = 0; Reset?.Invoke(); }
public void ResetGame() { Debug.Log(stump3.transform.position + " " + pst3); stump1.transform.position = pst1; stump1.transform.rotation = Rst1; stump1.GetComponent <Rigidbody>().velocity = Vector3.zero; stump1.GetComponent <Rigidbody>().angularVelocity = Vector3.zero; stump2.transform.position = pst2; stump2.transform.rotation = Rst2; stump2.GetComponent <Rigidbody>().angularVelocity = Vector3.zero; stump2.GetComponent <Rigidbody>().velocity = Vector3.zero; stump3.transform.position = pst3; stump3.transform.rotation = Rst3; stump3.GetComponent <Rigidbody>().angularVelocity = Vector3.zero; stump3.GetComponent <Rigidbody>().velocity = Vector3.zero; Reset.Invoke(); }
/// <summary> /// Dispose mapping /// </summary> public void Dispose() { Reset?.Invoke(this, EventArgs.Empty); Nfa.Blank(); Nfc.Blank(); Nfe.Blank(); Nfl.Blank(); Nfm.Blank(); Nfp.Blank(); Nfs.Blank(); Nfw.Blank(); Pvs.Blank(); Qpf.Blank(); Refresh(); }
/// <summary> /// Resets the credentials state to the account with the given <paramref name="accountName"/> and the /// given <paramref name="projectId"/>. The <seealso cref="Reset"/> event will be raised to notify /// listeners on this. /// If <paramref name="accountName"/> cannot be found in the store then the credentials will be reset /// to empty. /// </summary> /// <param name="accountName">The name of the account to make current.</param> /// <param name="projectId">The projectId to make current.</param> public void ResetCredentials(string accountName, string projectId) { var newCurrentAccount = GetAccount(accountName); if (newCurrentAccount != null) { _currentAccount = newCurrentAccount; _currentProjectId = projectId; } else { Debug.WriteLine($"Unknown account: {accountName}"); _currentAccount = null; _currentProjectId = null; } Reset?.Invoke(this, EventArgs.Empty); }
private void HandleOptionsChanged(IFileLoggerSettings options, string optionsName) { if (optionsName != _optionsName) { return; } Task resetTask; lock (_loggers) { if (_isDisposed) { return; } _resetTask = resetTask = ResetProcessorAsync(() => { lock (_loggers) { if (_isDisposed) { return; } Settings = options.Freeze(); foreach (FileLogger logger in _loggers.Values) { logger.Update(Settings); } } }); } Reset?.Invoke(this, resetTask); }
protected override ICalculatorState OnReset(Reset reset) { var newCtx = reset.Invoke(Ctx); return(new OperandState(newCtx)); }
protected virtual void OnReset() { Reset?.Invoke(); }
public static void ResetSkill(Skill sk) { Reset?.Invoke(sk); }
public void TriggerReset() { Reset?.Invoke(this, EventArgs.Empty); }
void OnReset() { Reset?.Invoke(this, EventArgs.Empty); }
public static void InvokeReset() => Reset?.Invoke();
private void ResetButton_Click(object sender, RoutedEventArgs e) { Reset?.Invoke(); ClearHexGrid(); }
private void M_resetall_Click(object sender, EventArgs e) { RcCore.It.EngineSettings.DefaultSettings(); Reset?.Invoke(this, EventArgs.Empty); }