Пример #1
0
        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;
            }
        }
Пример #2
0
        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();
            }
        }
Пример #3
0
        private void OnReset(object sender, RoutedEventArgs e)
        {
            Reset?.Invoke(this, EventArgs.Empty);

            Simulator.Reset();
            EndOfCounterExample.Visibility = Visibility.Hidden;
        }
Пример #4
0
    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));
    }
Пример #5
0
 private void RaiseReset()
 {
     if (Reset != null)
     {
         Reset.Invoke();
     }
 }
Пример #6
0
 private void RaiseReset(KnownFeature feature)
 {
     if (_options.ContainsKey(feature))
     {
         Reset?.Invoke(this, new FeatureEventArgs(feature));
     }
 }
Пример #7
0
        /// <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);
            }
        }
Пример #9
0
        public void ReleaseAll()
        {
            _nextAvailable = 0;
            _nextReturn    = -1;
            Free           = Total;

            foreach (var i in _instances)
            {
                Reset?.Invoke(i);
            }
        }
Пример #10
0
        public CalcuForm()
        {
            InitializeComponent();
            button1.Click += delegate { Add?.Invoke(this, EventArgs.Empty); };

            button2.Click += delegate
            {
                Reset?.Invoke(this, EventArgs.Empty);
                textBox1.Focus();
            };
        }
Пример #11
0
        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();
            }
        }
Пример #13
0
        protected void Invoke()
        {
            if (invoked)
            {
                return;
            }

            if (Reset != null)
            {
                Reset.Invoke();
            }

            invoked = true;
        }
Пример #14
0
        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();
        }
Пример #15
0
        private void InitTimer()
        {
            if (Config.Settings.resetTime == null)
            {
                return;
            }

            resetTimer = new ResetTimer(Config.Settings.resetTime, delegate()
            {
                LoadConfig();
                Reset?.Invoke(this, null);
                return(0);
            });
        }
Пример #16
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);
        }
Пример #17
0
        /// <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);
        }
Пример #18
0
 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();
 }
Пример #19
0
 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();
 }
Пример #20
0
        /// <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();
        }
Пример #21
0
        /// <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);
        }
Пример #22
0
        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);
        }
Пример #23
0
        protected override ICalculatorState OnReset(Reset reset)
        {
            var newCtx = reset.Invoke(Ctx);

            return(new OperandState(newCtx));
        }
Пример #24
0
 protected virtual void OnReset()
 {
     Reset?.Invoke();
 }
 public static void ResetSkill(Skill sk)
 {
     Reset?.Invoke(sk);
 }
Пример #26
0
 public void TriggerReset()
 {
     Reset?.Invoke(this, EventArgs.Empty);
 }
Пример #27
0
 void OnReset()
 {
     Reset?.Invoke(this, EventArgs.Empty);
 }
Пример #28
0
 public static void InvokeReset() => Reset?.Invoke();
Пример #29
0
 private void ResetButton_Click(object sender, RoutedEventArgs e)
 {
     Reset?.Invoke();
     ClearHexGrid();
 }
Пример #30
0
 private void M_resetall_Click(object sender, EventArgs e)
 {
     RcCore.It.EngineSettings.DefaultSettings();
     Reset?.Invoke(this, EventArgs.Empty);
 }