public void OldOrderCancelsReplace() { DomainObject[] domainObjectEventSources = new DomainObject[] { _customer, _oldCustomerOfNewOrder, _oldOrder, _newOrder }; DomainObjectCollection[] collectionEventSources = new DomainObjectCollection[] { _customer.Orders, _oldCustomerOfNewOrder.Orders }; SequenceEventReceiver eventReceiver = new SequenceEventReceiver(domainObjectEventSources, collectionEventSources, 1); int replaceIndex = _customer.Orders.IndexOf(_oldOrder); try { _customer.Orders[replaceIndex] = _newOrder; Assert.Fail("EventReceiverCancelException should be raised."); } catch (EventReceiverCancelException) { ChangeState[] expectedChangeStates = new ChangeState[] { new RelationChangeState(_oldOrder, "Remotion.Data.DomainObjects.UnitTests.TestDomain.Order.Customer", _customer, null, "1. Changing event of old order from old customer to null") }; eventReceiver.Check(expectedChangeStates); Assert.That(_customer.State, Is.EqualTo(StateType.Unchanged)); Assert.That(_oldCustomerOfNewOrder.State, Is.EqualTo(StateType.Unchanged)); Assert.That(_oldOrder.State, Is.EqualTo(StateType.Unchanged)); Assert.That(_newOrder.State, Is.EqualTo(StateType.Unchanged)); Assert.That(_customer.Orders[replaceIndex], Is.SameAs(_oldOrder)); Assert.That(_oldOrder.Customer, Is.SameAs(_customer)); Assert.That(_oldCustomerOfNewOrder.Orders.ContainsObject(_newOrder), Is.True); Assert.That(_newOrder.Customer, Is.SameAs(_oldCustomerOfNewOrder)); } }
public void setStart() { changeState = ChangeState.Start; time = 0; alpha = 255; mapLeft = true; }
public void OrderCancelsChangeEvent() { DomainObject[] domainObjectEventSources = new DomainObject[] { _oldCustomer, _newCustomer, _order1 }; DomainObjectCollection[] collectionEventSources = new DomainObjectCollection[] { _oldCustomer.Orders, _newCustomer.Orders }; SequenceEventReceiver eventReceiver = new SequenceEventReceiver(domainObjectEventSources, collectionEventSources, 1); try { _newCustomer.Orders.Add(_order1); Assert.Fail("EventReceiverCancelException should be raised."); } catch (EventReceiverCancelException) { ChangeState[] expectedChangeStates = new ChangeState[] { new RelationChangeState(_order1, "Remotion.Data.DomainObjects.UnitTests.TestDomain.Order.Customer", _oldCustomer, _newCustomer, "1. Changing event of order from old to new customer") }; eventReceiver.Check(expectedChangeStates); Assert.That(_order1.State, Is.EqualTo(StateType.Unchanged)); Assert.That(_oldCustomer.State, Is.EqualTo(StateType.Unchanged)); Assert.That(_newCustomer.State, Is.EqualTo(StateType.Unchanged)); Assert.That(_order1.Customer, Is.SameAs(_oldCustomer)); Assert.That(_oldCustomer.Orders[_order1.ID], Is.SameAs(_order1)); Assert.That(_newCustomer.Orders[_order1.ID], Is.Null); } }
public LineDiff AddLine(ChangeState state, string text, int removedLineNumber, int addedLineNumber) { LineDiff line = new LineDiff(state, text, removedLineNumber, addedLineNumber); Lines.Add(line); return(line); }
public bool Equals(MeshInfo other) { return (MeshId.Equals(other.MeshId) && ChangeState.Equals(other.ChangeState) && PriorityHint.Equals(other.PriorityHint)); }
public void SendChangeState() { if (IsEnabled) { ChangeState?.Invoke(this, EventArgs.Empty); } }
public override void Start(bool AtFirst) { try { if (AtFirst) { LState.Reset(); FirstInit(); } else { ActiveOrdersInfo(); } if (CStrategyPrices.StartUpdateTicker()) { LState.IsStartegyRun = true; ChangeState?.Invoke(true, true, LParam.StrategyName); } else { LState.IsStartegyRun = false; ChangeState?.Invoke(true, false, LParam.StrategyName); } SaveData(); } catch (Exception ex) { System.Media.SystemSounds.Beep.Play(); Print("Error in start: " + ex.Message); ChangeState?.Invoke(true, false, LParam.StrategyName); } }
public override void Start(bool AtFirst) { //if (LState.IsStartegyRun == true) //{ // Print("Стратегия уже запущена!", true); // return; //} if (AtFirst) { LState.Reset(); } if (CStrategyPrices.StartUpdateCandles()) { LState.IsStartegyRun = true; ChangeState?.Invoke(true, true, LParam.StrategyName); } else { LState.IsStartegyRun = false; ChangeState?.Invoke(true, false, LParam.StrategyName); } SaveData(); }
/// <summary> /// Maintains the state of the change. /// </summary> /// <param name="oldValue">The old value.</param> /// <param name="newValue">The new value.</param> private void MaintainChangeState(object oldValue, object newValue) { if (oldValue != newValue) { this.changeState = ChangeState.Modified; } }
protected virtual void OnChangeState(object sender, System.EventArgs e) { if (!firstInitial) { var selected = (MetroRadioButton)sender; var isInvoke = false; if (selected.Text == "To Do" && selected.Checked) { _taskStateNames = TaskStateBaseNames.ToDo; isInvoke = true; } else if (selected.Text == "Doing" && selected.Checked) { _taskStateNames = TaskStateBaseNames.Doing; isInvoke = true; } else if (selected.Text == "Done" && selected.Checked) { _taskStateNames = TaskStateBaseNames.Done; isInvoke = true; } if (isInvoke) { ChangeState?.Invoke(_taskStateNames, new ChangeStateEventArgs(TaskId)); } } else { firstInitial = false; } }
public override void Start(bool AtFirst) { if (AtFirst) { LState.Reset(); } else { ActiveOrdersInfo(); } ErrorsCount = 0; InitLLStrategies(); if (CStrategyPrices.StartUpdateTicker()) { LState.IsStartegyRun = true; ChangeState?.Invoke(true, true, LParam.StrategyName); } else { LState.IsStartegyRun = false; ChangeState?.Invoke(true, false, LParam.StrategyName); } SaveData(); }
/// <summary> Call this when you remove some characters of the tag area. Return true if need to be deleted. Can return a new tag to add. </summary> public bool ClearCharacters(int id, int length, out Tag otherTag) { otherTag = null; ChangeState state = Contains(id, length); switch (state) { case ChangeState.Before: return(false); case ChangeState.After: return(false); case ChangeState.Inside: if ((end - (id + length)) > 0) { otherTag = new Tag(this, id + length, end); } end = id; break; case ChangeState.ContainsAll: return(true); case ChangeState.ContainsStart: start += id + length - start; break; case ChangeState.ContainsEnd: end -= end - id; break; } return(end - start <= 0); }
public override void ForceStop() { try { CStrategyPrices.StopUpdates(); LState.IsStartegyRun = false; var ActiveOrdersE = new ActiveOrdersGridEventArgs() { StrategyType = LParam.StrategyType, StrategyName = LParam.StrategyName }; ChangeActiveOrders?.Invoke(this, ActiveOrdersE); ClosePosition(); LState.Reset(); Stop(); } catch (Exception ex) { System.Media.SystemSounds.Beep.Play(); Print(String.Format("Ошибка при принудительной остановке стратегии: {0}", ex.Message), true); ChangeState?.Invoke(false, false, LParam.StrategyName); } }
public void SetStateRecursive(ChangeState newState) { foreach (TreeViewItem Node in this) { if (newState == ChangeState.CSUnselect) { Node.Selected = false; } else if (newState == ChangeState.CSClose) { if (Node.Items.Count > 0) { Node.Open = false; } } else if (newState == ChangeState.CSSelect) { Node.Selected = true; } else if (newState == ChangeState.CSOpen) { if (Node.Items.Count > 0) { Node.Open = true; } } Node.Items.SetStateRecursive(newState); } }
public void mapLoad(Vector2 loadedPos) { changeState = ChangeState.Start; time = 0; alpha = 255; mapLeft = true; newPosition = loadedPos; }
internal static void FlDone() { FileDone++; EventFileDone?.Invoke(null, EventArgs.Empty); ChangeState?.Invoke(null, EventArgs.Empty); //SessionDone = 0; //SessionCount = 0; }
internal static void Done() { WorkIsDone?.Invoke(null, EventArgs.Empty); ChangeState?.Invoke(null, EventArgs.Empty); FileCount = 0; FileDone = 0; SessionCount = 0; SessionDone = 0; }
public LineDiff(ChangeState state, string text, int removedLineNumber, int addedLineNumber) { Changed = state; Text = text; RemovedLineNumber = removedLineNumber; AddedLineNumber = addedLineNumber; Id = removedLineNumber + "_" + addedLineNumber; }
public DetectorFocus() { _stateOut = new OutState(this, this); _stateFirst = new FirstState(this, this); _stateEquals = new EqualsState(this, this); _stateChange = new ChangeState(this, this); _stateCurrent = _stateOut; }
private Change( ChangeState changeState, TKey id, TValue value) { this.CurrentState = changeState; this.Id = id; this.Value = value; }
/// <summary> /// Indicates that the state has been saved, and sets HasUnsavedChanges to false if the user has not made intermediate changes to the state. /// </summary> /// <param name="preSaveState"></param> public void Saved(ChangeState preSaveState) { lock (this) { if (preSaveState.Counter == counter) { HasUnsavedChanges = false; } } }
public void LoadContext(Form formComponent, BindingSource bindingSource, EventHandler saveMethod) { if (_formChangeStates.Keys.Contains(formComponent.Name)) { _formChangeStates.Remove(formComponent.Name); } ChangeState thisState = new ChangeState(formComponent, bindingSource, saveMethod); _formChangeStates.Add(formComponent.Name, thisState); }
public ObjectState(object entity, List <PropertyManager> props) { this.entity = entity; this.propList = props; state = ChangeState.Retrieved; if (entity is System.ComponentModel.INotifyPropertyChanged) { System.ComponentModel.INotifyPropertyChanged i = (System.ComponentModel.INotifyPropertyChanged)entity; i.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(i_PropertyChanged); } }
public void AddEntry(T key, ChangeState function) { if (enterDel.ContainsKey(key)) { enterDel[key] = function; } else { enterDel.Add(key, function); } }
public void AddExit(T key, ChangeState function) { if (exitDel.ContainsKey(key)) { exitDel[key] = function; } else { exitDel.Add(key, function); } }
} //3 Oben 4 unten 5 rechts 6 links public void changePosition(ref Vector2 posi) { if (changeState != ChangeState.Start) { posi = newPosition; } else { changeState = ChangeState.Leave; } }
public void Descend() { _state = ChangeState.Descending; _t = 0; _from = transform.position; _to = transform.position - Vector3.up * 10; _colorFrom = GetComponent<Renderer>().material.color; _colorTo = Color.black; Level.CurrentLevel.AddPromise(_tilePromise = new Promise()); }
void Ascend() { _state = ChangeState.Ascending; _t = 0; _to = Grid.CoordToPosition(_tile.Coordinate) + (_tile.Elevation * Vector3.up); _from = transform.position; _colorFrom = GetComponent<Renderer>().material.color; _colorTo = Color.white; Level.CurrentLevel.AddPromise(_tilePromise = new Promise()); }
public void i_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { PropertyManager pm = (from p in propList where p.HasChanged == false && p.PropertyName == e.PropertyName select p).FirstOrDefault(); if (pm != null) { pm.HasChanged = true; if (state == ChangeState.Retrieved) { state = ChangeState.Updated; } } }
public void Update(ChangeState state) { switch (state) { case ChangeState.Changed: this.Change(); break; case ChangeState.Removed: this.Remove(); break; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsMasterUser) { HandleSecurityException(); } _ManagePoliticiansPanel = Master.FindMainContentControl("ManagePoliticiansPanel") as ManagePoliticiansPanel; if (_ManagePoliticiansPanel != null) { _ManagePoliticiansPanel.Mode = ManagePoliticiansPanel.DataMode.AddPoliticians; _ManagePoliticiansPanel.PageFeedback = FeedbackAddCandidates; } if (!IsPostBack) { const string title = "Update Politicians"; Title = title; H1.InnerHtml = title; SetSubHeading(); if (AdminPageLevel != AdminPageLevel.State && AdminPageLevel != AdminPageLevel.President) { UpdateControls.Visible = false; } if (AdminPageLevel == AdminPageLevel.Unknown) { NoJurisdiction.CreateStateLinks("/admin/UpdatePoliticians.aspx?state={StateCode}"); NoJurisdiction.ShowHeadOptional(false); NoJurisdiction.Visible = true; } else { ChangeState.Items.Clear(); ChangeState.Items.Add(new ListItem { Text = "All States", Value = "US" }); foreach (var stateCode in StateCache.All51StateCodes) { ChangeState.Items.Add(new ListItem { Text = $"{stateCode} - {StateCache.GetStateName(stateCode)}", Value = stateCode }); } ChangeState.SetValue(QueryState); } } }
private void Update() { if (ChangeFlg) { switch (State) { case ChangeState.SELECTING: Cursor.lockState = CursorLockMode.None; break; case ChangeState.PREVCHANGING: Cursor.lockState = CursorLockMode.Locked; if (NowStage.localPosition.x < 1855) { NowStage.localPosition += new Vector3(35f, 0f, 0f); } if (NowStage.localPosition.x >= 1855) { State = ChangeState.WAITING; } break; case ChangeState.WAITING: // 時間まで静止 if (count >= 0.5f) { count = 0; State = ChangeState.NEXTCHANGING; } count += Time.deltaTime; break; case ChangeState.NEXTCHANGING: if (SubStage.localPosition.x > 0) { SubStage.localPosition += new Vector3(-35f, 0f, 0f); } if (SubStage.localPosition.x <= 0) { // ステージ関係の入れ替え RectTransform w; w = NowStage; NowStage = SubStage; SubStage = w; State = ChangeState.SELECTING; } break; } } }
public GutterIconDescriptor GetGutterIconDescriptor(ChangeState state) { GutterIconDescriptor descriptor = null; try { descriptor = descriptors?[state]; } catch (Exception) { } return(descriptor); }
void Awake() { _prev = SeeState.Hidden; _state = ChangeState.None; _ascended = false; }
/// <summary> /// Initializes a new instance of the <see cref="PersistChangesEntry"/> class. /// </summary> /// <param name="modifiedEntity">The modified entity.</param> /// <param name="changeState">The change state.</param> /// <param name="flattenedEntityGraph">The flattened entity graph.</param> public PersistChangesEntry(object modifiedEntity, ChangeState changeState, IEnumerable<object> flattenedEntityGraph) { this.ModifiedEntity = modifiedEntity; this.ChangeState = changeState; this.FlattenedEntityGraph = flattenedEntityGraph; }
//----------------------------------------------------------------------------- // changeItemState //----------------------------------------------------------------------------- /// <summary> /// Change a dictionary definition's state. This routine is used to determine if /// the dictionary item can be deleted. It may also be used to force the /// definition to be deleted - once the database has determined that the /// definition is not in use anywhere. This should only be used for /// element definitions and attribute definitions definitions. /// </summary> /// <param name="dictType"> /// Type of dictionary definition whose state is being changed. /// </param> /// <param name="uiDictNumber"> /// Number of element or attribute definition whose state /// is to be changed /// </param> /// <param name="eStateToChangeTo"> /// State the definition is to be changed to. /// </param> public void changeItemState( ReservedElmTag dictType, uint uiDictNumber, ChangeState eStateToChangeTo) { RCODE rc; string sState = ""; switch (eStateToChangeTo) { case ChangeState.STATE_CHECKING: sState = "checking"; break; case ChangeState.STATE_PURGE: sState = "purge"; break; case ChangeState.STATE_ACTIVE: sState = "active"; break; default: throw new XFlaimException( RCODE.NE_XFLM_INVALID_PARM); } if ((rc = xflaim_Db_changeItemState( m_pDb, dictType, uiDictNumber, sState)) != 0) { throw new XFlaimException(rc); } }
protected override void initialize() { this._state = ChangeState.Enable; this._cap = EnableCap.AutoNormal; }
void Light() { _state = ChangeState.Lighting; _from = transform.position; _to = transform.position; _colorFrom = GetComponent<Renderer>().material.color; _colorTo = Color.white; _t = 0; }
public void FadeOut() { Material mat = GetComponent<Renderer>().material; _prevSrcBlend = mat.GetInt("_SrcBlend"); _prevDstBlend = mat.GetInt("_DstBlend"); _prevZWrite = mat.GetInt("_ZWrite"); _prevRenderQueue = mat.renderQueue; mat.SetFloat("_Mode", 2); mat.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha); mat.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha); mat.SetInt("_ZWrite", 0); mat.DisableKeyword("_ALPHATEST_ON"); mat.EnableKeyword("_ALPHABLEND_ON"); mat.DisableKeyword("_ALPHAPREMULTIPLY_ON"); mat.renderQueue = 3000; _state = ChangeState.FadingOut; _isFadedOut = true; _colorFrom = GetComponent<Renderer>().material.color; _colorTo = new Color(_colorFrom.r, _colorFrom.g, _colorFrom.b, 0.5f); _t = 0; GetComponent<Collider>().enabled = false; }
public void FadeIn() { if (!_isFadedOut) { return; } _state = ChangeState.FadingIn; GetComponent<Collider>().enabled = true; _colorFrom = GetComponent<Renderer>().material.color; _colorTo = new Color(_colorFrom.r, _colorFrom.g, _colorFrom.b, 1f); _t = 0; }
public void Update() { if (_t < 0) return; switch (_state) { case ChangeState.None: break; case ChangeState.Descending: case ChangeState.Ascending: transform.position = Vector3.Lerp(_from, _to, _t); GetComponent<Renderer>().material.color = Color.Lerp(_colorFrom, _colorTo, _t); break; case ChangeState.Shading: case ChangeState.Lighting: case ChangeState.FadingIn: case ChangeState.FadingOut: GetComponent<Renderer>().material.color = Color.Lerp(_colorFrom, _colorTo, _t); GetComponent<Renderer>().material.color = Color.Lerp(_colorFrom, _colorTo, _t); break; } _t += Time.deltaTime * 1.5f; if (_t < 1) return; transform.position = _to; _t = -1; switch (_state) { case ChangeState.Descending: _tilePromise.Fulfill(); _tilePromise = null; break; case ChangeState.Ascending: _ascended = true; GetComponent<Collider>().enabled = true; Level.CurrentLevel.Reveal(_tile.Coordinate); _tilePromise.Fulfill(); _tilePromise = null; break; case ChangeState.FadingIn: Material mat = GetComponent<Renderer>().material; mat.SetFloat("_Mode", 0); mat.SetInt("_SrcBlend", _prevSrcBlend); mat.SetInt("_DstBlend", _prevDstBlend); mat.SetInt("_ZWrite", _prevZWrite); mat.EnableKeyword("_ALPHATEST_ON"); mat.DisableKeyword("_ALPHABLEND_ON"); mat.EnableKeyword("_ALPHAPREMULTIPLY_ON"); mat.renderQueue = _prevRenderQueue; break; } _state = ChangeState.None; }
public EditChangeHistoryRecord(ChangeState changeState, Account.Account changedBy) { ChangeState = changeState; ChangedBy = changedBy; ChangedAt = DateTime.Now; }
void Shade() { _state = ChangeState.Shading; _from = transform.position; _to = transform.position; _colorFrom = GetComponent<Renderer>().material.color; _colorTo = Color.gray; _t = 0; }