예제 #1
0
 private void ShowUpdatingTime()
 {
     IsUpdating
     .Select(x => new { Value = x, DateTime.Now.Ticks })
     .Pairwise()
     .Where(x => x.OldItem.Value && !x.NewItem.Value)
     .Select(x => (x.NewItem.Ticks - x.OldItem.Ticks) / TimeSpan.TicksPerMillisecond)
     .Subscribe(x => Debug.WriteLine($"Updating Time: {x}"))
     .AddTo(this.Subscription);
 }
예제 #2
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hash = 23;
         hash = hash * 37 + (Servers != null ? Servers.GetHashCode() : 0);
         hash = hash * 37 + IsUpdating.GetHashCode();
         hash = hash * 37 + (Username != null ? Username.GetHashCode() : 0);
         hash = hash * 37 + (Password != null ? Password.GetHashCode() : 0);
         hash = hash * 37 + Port.GetHashCode();
         hash = hash * 37 + (OperationInProgress != null ? OperationInProgress.GetHashCode() : 0);
         hash = hash * 37 + ShowPassword.GetHashCode();
         return(hash);
     }
 }
예제 #3
0
        private async Task UpdateAsync(Func <Task> perform)
        {
            bool isEntered = false;

            try
            {
                if (!(isEntered = _updateSemaphore.Wait(TimeSpan.Zero)))
                {
                    return;
                }

                IsUpdating.TurnOn();

                await perform.Invoke();
            }
            finally
            {
                if (isEntered)
                {
                    _updateSemaphore.Release();
                    IsUpdating.TurnOff();
                }
            }
        }