private void Api_OnStatusChanged(WechatAPIService sender, StatusChangedEvent e) { switch (sender.CurrentStatus) { case ClientStatusType.GetUUID: break; case ClientStatusType.GetQRCode: break; case ClientStatusType.Login: break; case ClientStatusType.QRCodeScaned: m_SyncContext.Post(UpdateInfo, "请在手机上点击\"登陆\"按钮"); break; case ClientStatusType.WeixinInit: break; case ClientStatusType.SyncCheck: break; case ClientStatusType.WeixinSync: break; case ClientStatusType.None: break; default: break; } }
/// <summary> /// Обновление статуса. /// </summary> /// <param name="statusEnum">Новое значение статуса.</param> public void UpdateStatus(ItemStatusEnum statusEnum, string comment = null) { if (Status == null || Status.StatusEnum != statusEnum) { Status = new ItemStatus(statusEnum, comment); StatusChangedEvent?.Invoke(); } }
private void RaiseStatusChanged(ListenerStatus status) { if (Status != status) { Status = status; StatusChangedEvent?.Invoke(this, new StatusChangedEventArgs(Status)); } }
public BusyCursor() { DispatcherHelper.CheckBeginInvokeOnUI(() => { Interlocked.Increment(ref busyCount); StatusChangedEvent?.Invoke(this, EventArgs.Empty); Mouse.OverrideCursor = Cursors.Wait; }); }
public BusyCursor() { Application.Current.Dispatcher.Invoke(() => { Interlocked.Increment(ref BusyCount); StatusChangedEvent?.Invoke(null, EventArgs.Empty); Mouse.OverrideCursor = Cursors.Wait; }); }
/// <summary> /// Event that is fired when the Process Status has changed. /// </summary> /// <param name="status"></param> protected virtual void OnStatusChangedEvent(string status) { var eventArgs = new ProcessChangedEventArgs { ProcessName = ProcessName, ProcessId = _processId, Status = status }; StatusChangedEvent?.Invoke(this, eventArgs); }
public void Dispose() { DispatcherHelper.CheckBeginInvokeOnUI(() => { Interlocked.Decrement(ref busyCount); StatusChangedEvent?.Invoke(this, EventArgs.Empty); if (busyCount == 0) { Mouse.OverrideCursor = null; } }); }
public void Dispose() { Application.Current.Dispatcher.Invoke(() => { Interlocked.Decrement(ref BusyCount); StatusChangedEvent?.Invoke(null, EventArgs.Empty); if (BusyCount == 0) { Mouse.OverrideCursor = null; } }); }
private void OnStatusChanged(StatusChangedEvent e) { if (e != null && e.Statuses != null) { lock (statusLocker) { foreach (var newStatus in e.Statuses) { var oldStatus = Statuses.FirstOrDefault(st => st.Equals(newStatus)); if (oldStatus != null) { oldStatus.Update(newStatus); } } } } }
/// <summary> /// Sets the <see cref="IAuthableSession"/>s <see cref="IAuthToken"/> field <see cref="Token"/> /// if the token is valid. /// </summary> /// <param name="ticket">A valid authentication token.</param> /// <exception cref="ArgumentNullException">If the token is null.</exception> /// <exception cref="InvalidOperationException">If the token is in an invalid state.</exception> public void SetAuthenticationTicket(AuthTicketContainer ticket) { #if DEBUG || DEBUGBUILD Debug.Log($"Successfully used oAuth token to authenticate on game servers."); #endif Throw <ArgumentNullException> .If.IsNull(ticket)?.Now(nameof(ticket), $"Recieved a null {nameof(AuthTicket)} during auth token set."); AuthenticationTicketContainer = ticket; //There was no reason to reauth if (CurrentSessionState.HasFlag(SessionState.HasValidAuthTicket)) { return; } CurrentSessionState = CurrentSessionState | SessionState.HasValidAuthTicket; //Call the event handler if it's not null StatusChangedEvent?.Invoke(CurrentSessionState); }
/// <summary> /// Sets the <see cref="IAuthableSession"/>s <see cref="IAuthToken"/> field <see cref="Token"/> /// if the token is valid. /// </summary> /// <param name="token">A valid authentication token.</param> /// <exception cref="ArgumentNullException">If the token is null.</exception> /// <exception cref="InvalidOperationException">If the token is in an invalid state.</exception> public void SetAuthenticationToken(IAuthToken token) { #if DEBUG || DEBUGBUILD Debug.Log($"Successfully authenticated and recieved valid oAuth."); #endif Throw <ArgumentNullException> .If.IsNull(token)?.Now(nameof(token), $"Recieved a null {nameof(IAuthToken)} during auth token set."); if (!token.isValid) { Throw <InvalidOperationException> .If.Now(); //TODO: Add Easyception exception message } Token = token; //There was no reason to reauth if (CurrentSessionState.HasFlag(SessionState.Authenticated)) { return; } CurrentSessionState = CurrentSessionState | SessionState.Authenticated; //Call the event handler if it's not null StatusChangedEvent?.Invoke(CurrentSessionState); }
public void UpdateStatus() { StatusEventArgs eventArgs = new StatusEventArgs(this.Status1, this.StatusDetails); StatusChangedEvent?.Invoke(this, eventArgs); }
private void RaiseStatusChangedEvent(StatusChanged status) { StatusChangedEvent?.Invoke(status); }