/* * Method for controller to put new chips * ----------------------------------------- * x - x coordinate of new chip * y - y coordinate of new chip */ public void PutChip(int x, int y) { Chip newChip = new Chip(turnHolder.CurrentTurnColor, new Cell(x, y)); if (!NewChipIsAllowed(newChip)) { return; } board.AddChip(newChip); List<Chip> changedChips = board.GetChangedChips(newChip, turnHolder.CurrentTurnColor); countHolder.Increase(turnHolder.CurrentTurnColor, changedChips.Count + 1); countHolder.Decrease(turnHolder.OppositeTurnColor, changedChips.Count); SetChips?.Invoke(this, new SetChipsEventArgs { NewChip = newChip, ChangedChips = changedChips }); turnHolder.Switch(); CountChanged?.Invoke(this, new CountChangedEventArgs { CountWhite = countHolder.GetPlayerCount(Color.White), CountBlack = countHolder.GetPlayerCount(Color.Black), }); FinishTurnAndMoveOn(); }
private void OnCountChanged(long id, decimal oldValue, decimal newValue) { CountChanged?.Invoke(this, new DecimalValueChangedEventArgs(id, oldValue, newValue, MenuItemName.Basket)); }
private void InboxOnCountChanged(object sender, EventArgs e) { _config.Tracer?.TraceVerbose($"<CountChanged>", $"{this}"); if (sender is IMailFolder folder) { CountChanged?.Invoke(this, new FolderEventArgs(folder)); } }
/// <summary> /// Called when items count changed. /// </summary> /// <param name="count">The count.</param> protected virtual void OnCountChanged(int count) { CountChanged?.Invoke(this, count); if (Current >= count) { ToAbsolutePosition(count - 1); } }
private void OnCountChanged(object sender, DecimalValueChangedEventArgs e) { DecimalValueChangedEventArgs args = new DecimalValueChangedEventArgs(e.Id, e.OldValue, e.NewValue, MenuItemName.Orders); CountChanged?.Invoke(this, args); OrderChanged?.Invoke(sender, e); }
private void OnCountChanged() { if (_oldCount == Count) { return; } _oldCount = Count; CountChanged?.Invoke(this); }
protected void BindBaseCreateElements(Button cancelButton, Button createButton, TextField nameField, IntegerField countField, Toggle maxCountToggle) { cancelButton.clickable.clicked += OnCancelClicked; createButton.clickable.clicked += OnCreateClicked; if (GetDefaultName != null) { m_CurrentName = GetDefaultName(); } m_NameField = nameField; m_NameField.isDelayed = true; m_NameField.SetValueWithoutNotify(m_CurrentName); m_NameIsCustom = false; m_NameField.RegisterValueChangedCallback(evt => { if (evt.newValue.Length > 0) { m_CurrentName = evt.newValue; m_NameIsCustom = true; } else if (GetDefaultName != null) { m_CurrentName = GetDefaultName(); m_NameField?.SetValueWithoutNotify(m_CurrentName); m_NameIsCustom = false; } if (NameChanged != null) { NameChanged(m_CurrentName); } }); maxCountToggle.RegisterValueChangedCallback(evt => { m_CountField.value = evt.newValue ? 1 : 0; m_CountField.SetEnabled(evt.newValue); }); m_CountField = countField; m_CountField.RegisterValueChangedCallback(evt => { var newValue = evt.newValue; if (newValue < 0) { newValue = 0; m_CountField.SetValueWithoutNotify(newValue); } var maxEnabled = newValue > 0; maxCountToggle.SetValueWithoutNotify(maxEnabled); m_CountField.SetEnabled(maxEnabled); CountChanged?.Invoke(newValue); }); }
public void Redo() { if (_redoCommandStack.Count > 0) { ICommand command = _redoCommandStack.Pop(); command.Execute(); _undoCommandStack.Push(command); CountChanged?.Invoke(); } }
// тестовый набор записей. В вашей программе записи должны читаться из файла public void GetTestData() { for (int i = 0; i < 105; i++) { humans.Add(new Human { FName = $"Test name {i}", LName = $"Test lastname {i}" }); } CountChanged?.Invoke(this, new EventArgs()); }
public void Save() { BinaryFormatter bf = new BinaryFormatter(); using (FileStream fs = new FileStream(fileName, FileMode.Create, FileAccess.Write)) { bf.Serialize(fs, advertisements); } CountChanged?.Invoke(this, new EventArgs()); }
private void Increment(object source, ElapsedEventArgs e) { Debug.WriteLine("Interval: " + Timer.Interval); Debug.WriteLine("Count: " + Count); Count++; if (Count == 8) { CountChanged?.Invoke(this, null); RemoveListener(); Count = 1; } }
public void IncrementClicked() { _killCount++; UpdateCount(); Instantiate(_clickParticlesPrefab); _audioSource.pitch = _baseAudioPitch + UnityEngine.Random.Range(-_audioPitchVariance, _audioPitchVariance); _audioSource.PlayOneShot(_shotgunClip); LeaderboardRepo.Instance.UpdateScore(_killCount); CountChanged?.Invoke(_killCount); }
public void OpenProvider(LinesProvider linesProvider) { _linesProvider = linesProvider; // Handles when the number of columns we need to display the data changes _linesProvider.MaxColumnsChanged += (s, e) => ColumnCount = e.MaxColumns; ColumnCount = 0; var fileLines = new VirtualizingCollectionDynamicAsync <BigFileLine>(_linesProvider, 100 /*page size*/, 60000 /*timeout*/, 1000 /* loadCountInterval*/); FileLines = fileLines; fileLines.CountChanged += (s, e) => { CountChanged?.Invoke(this, e); RaisePropertyChanged("RowCount"); }; }
void Update() { if (_commandBuffer.Count > 0) { ICommand command = _commandBuffer.Dequeue(); command.Execute(); if (command.IsUndoable()) { _undoCommandStack.Push(command); _redoCommandStack.Clear(); } else { ResetHistory(); } CountChanged?.Invoke(); } }
/// <summary> /// Add object to global list /// </summary> /// <param name="proxy">com wrapper instance</param> internal void AddObjectToList(ICOMObject proxy) { try { lock (_thisLock) { Add(proxy); if (null != Added) { IEnumerable <ICOMObject> ownerPath = GetOwnerPath(proxy); Added?.Invoke(Parent, ownerPath, proxy); } } CountChanged?.Invoke(Parent, Count); } catch (Exception throwedException) { Parent.Console.WriteException(throwedException); } }
/* * Method for controller to start new game */ public void NewGame() { playerHasPassed[Color.White] = false; playerHasPassed[Color.Black] = false; turnHolder.Reset(); NewGameStarted?.Invoke(this, new EventArgs()); SetStartBoardPosition(); countHolder.Reset(); CountChanged?.Invoke(this, new CountChangedEventArgs { CountWhite = countHolder.GetPlayerCount(Color.White), CountBlack = countHolder.GetPlayerCount(Color.Black), }); FinishTurnAndMoveOn(); }
/// <summary> /// Remove object from global list /// </summary> /// <param name="proxy">com wrapper instance</param> /// <param name="ownerPath">optional owner path</param> internal void RemoveObjectFromList(ICOMObject proxy, IEnumerable <ICOMObject> ownerPath) { try { bool removed = false; lock (_thisLock) { removed = Remove(proxy); if (removed) { Removed?.Invoke(Parent, ownerPath, proxy); } } if (removed) { CountChanged?.Invoke(Parent, Count); } } catch (Exception throwedException) { Parent.Console.WriteException(throwedException); } }
private void OnCountChanged(object sender, DecimalValueChangedEventArgs e) { CountChanged?.Invoke(this, e); }
public new void Add(T item) { base.Add(item); CountChanged?.Invoke(this, new Ext_list <T> .ListEventArgs(this.Count)); }
public Models.Tag ProcessTag(Models.Tag tag) { switch (tag.Server) { case "CoDeSys.OPC.DA": if (_FestoTags.Count < 37 && !_FestoTags.Any(x => x.Name == tag.Name)) { if (!string.IsNullOrEmpty(tag.Name)) { _FestoTags.Add(tag); } return(null); } else if (!_initialized) { _FestoTags.Where(x => x.Name.StartsWith("PLC1.Application.GVL.HMI_bShowAuto_")).ToList().ForEach(x => { if (bool.Parse(x.Value)) { int.TryParse(x.Name.Replace("PLC1.Application.GVL.HMI_bShowAuto_", ""), out var auto); UpdateSteps(auto == 1 ? 8 : auto == 2 ? 16 : 32); } }); _initialized = true; } var t = _FestoTags.FirstOrDefault(x => x.Handle == tag.Handle); if (t != null) { t.Value = tag.Value; } break; case "GaugeToolsXL OPC Server": double.TryParse(tag.Value, out _gaugeLastVal); CountChanged?.Invoke(_gaugeLastVal); return(null); default: break; } switch (tag.Name) { case "PLC1.Application.GVL.Record1.lrTarget": var ipos = _FestoTags.FirstOrDefault(x => x.Value == tag.Value); var miniPos = _FestoTags.Where(x => x.Name.StartsWith("PLC1.Application.GVL_1.HMI_iPos") && x.Value != "0").Min(x => int.Parse(x.Value)).ToString(); var maxiPos = _FestoTags.Where(x => x.Name.StartsWith("PLC1.Application.GVL_1.HMI_iPos") && x.Value != "0").Max(x => int.Parse(x.Value)).ToString(); if (ipos.Value == maxiPos) { LapCompleted?.Invoke(true); } if (ipos.Value == miniPos) { LapCompleted?.Invoke(false); } TagValidated?.Invoke(new Models.Tag { Handle = int.Parse(tag.Value), Name = ipos.Name, Value = _gaugeLastVal.ToString() }); break; case "PLC1.Application.GVL.HMI_bShowAuto_1": case "PLC1.Application.GVL.HMI_bShowAuto_2": case "PLC1.Application.GVL.HMI_bShowAuto_3": if (bool.Parse(tag.Value)) { int.TryParse(tag.Name.Replace("PLC1.Application.GVL.HMI_bShowAuto_", ""), out var auto); UpdateSteps(auto == 1 ? 8 : auto == 2 ? 16 : 32); } break; case "PLC1.Application.GVL_1.HMI_rDelay": DelayUpdated?.Invoke(tag); break; default: break; } if (!_FestoTags.Any(x => x.Name == "PLC1.Application.PLC_PRG.bHOME_OK" && bool.Parse(x.Value))) { return(null); } return(null); }
protected virtual void OnCountChanged(int count) { CountChanged?.Invoke(count); }
protected virtual void OnCountChanged(int previousCount) { CountChanged?.Invoke(previousCount, Count); }
public void SetCurrentData(List <Advertisement> advertisements) { filter = advertisements; CountChanged?.Invoke(this, null); }
private void OnCountChanged(decimal oldValue, decimal newValue) { CountChanged?.Invoke(this, new DecimalValueChangedEventArgs(Id, oldValue, newValue, MenuItemName.PriceList)); }
public virtual void OnCountChange() { CountChanged?.Invoke(); }
public new void AddRange(IEnumerable <T> collection) { base.AddRange(collection); CountChanged?.Invoke(this, new Ext_list <T> .ListEventArgs(this.Count)); }
public new void Clear() { base.Clear(); CountChanged?.Invoke(this, new Ext_list <T> .ListEventArgs(this.Count)); }
private void OnAmountChanged(object sender, DecimalValueChangedEventArgs e) { Amount = Amount - e.OldValue + e.NewValue; CountChanged?.Invoke(this, e); }
private void OnCountChanged(PropertyChangedEventArgs arg) { OnPropertyChanged(arg); CountChanged?.Invoke(this, arg); }
public void Save() { dB.Save(); CountChanged?.Invoke(this, new EventArgs()); }