protected virtual void OpenNewRoom(Room room) { selectionLease = SelectedRoom.BeginLease(false); Debug.Assert(selectionLease != null); selectionLease.Value = room; this.Push(CreateRoomSubScreen(room)); }
/// <summary> /// Begins tracking a new online operation. /// </summary> /// <returns> /// An <see cref="IDisposable"/> that will automatically mark the operation as ended on disposal. /// </returns> /// <exception cref="InvalidOperationException">An operation has already been started.</exception> public IDisposable BeginOperation() { if (leasedInProgress != null) { throw new InvalidOperationException("Cannot begin operation while another is in progress."); } leasedInProgress = inProgress.BeginLease(true); leasedInProgress.Value = true; // for extra safety, marshal the end of operation back to the update thread if necessary. return(new InvokeOnDisposal(() => Scheduler.Add(endOperation, false))); }
public override void OnEntering(IScreen last) { EnteredFrom = last; Entered?.Invoke(); if (shouldTakeOutLease) { DummyBindable.BindTo(((TestScreen)last).DummyBindable); LeasedCopy = DummyBindable.BeginLease(true); } base.OnEntering(last); if (last != null) { //only show the pop button if we are entered form another screen. popButton.Alpha = 1; } this.MoveTo(new Vector2(0, -DrawSize.Y)); this.MoveTo(Vector2.Zero, transition_time, Easing.OutQuint); this.FadeIn(1000); }
public void TestLeaseAndReturn(bool revert) { var leased = original.BeginLease(revert); Assert.AreEqual(original.Value, leased.Value); leased.Value = 2; Assert.AreEqual(original.Value, 2); Assert.AreEqual(original.Value, leased.Value); leased.Return(); Assert.AreEqual(original.Value, revert ? 1 : 2); }