protected virtual void AccountOnRegisterStateChanged(ISipAccount account) { if (account == null) { return; } var enabled = _enabled; _enabled = ValidRegisterState?.Equals(account.RegisterState) ?? true; if (enabled == _enabled) { return; } RaiseUIChangedEvent(); if (!_enabled) { Checked = false; } else { var target = account.PresenceStatus?.Code == TargetState; if (Checked != target) { Checked = target; } } }
void OnAccountPresenceStatusChanged(ISipAccount account) { if (account?.PresenceStatus == null) { return; } if (InvokeRequired) { Invoke(new Action <ISipAccount>(OnAccountPresenceStatusChanged), account); return; } labelUserName.Text = $"{account.FullName} ({account.UserName})"; _mainFormPhoneStatusControl.Text = account.PresenceStatus?.Message ?? @"-"; //if (account.PresenceStatus.Code == PresenceStatusCode.NotAvailable || account.PresenceStatus.Code == PresenceStatusCode.DND || account.PresenceStatus.Code == PresenceStatusCode.Away) //{ // // Removed shading for UI issues // Controls.Add(_shade); // grpMain.Enabled = false; // _shade.BringToFront(); //} //else //{ // if (Controls.Contains(_shade)) // { // Controls.Remove(_shade); // } // grpMain.Enabled = true; //} }
private void AccountPresenceStatusChanged(ISipAccount account) { if (_isActive && account.PresenceStatus.Code == _targetState) { try { var uri = _substFunc(_uri, account); using (var client = new WebClient { CachePolicy = new RequestCachePolicy(RequestCacheLevel.NoCacheNoStore), Proxy = _proxy }) { if ("GET".Equals(_httpMethod, StringComparison.InvariantCultureIgnoreCase)) { client.DownloadString(uri); } else { using (var stream = client.OpenWrite(uri, _httpMethod)) { stream.Flush(); } } } } catch (Exception e) { Logger.LogWarn(e, "Error sending state update"); } } else { _isActive = true; } }
protected override void AccountOnRegisterStateChanged(ISipAccount account) { if (account == null) { return; } SetEnabled(true); RaiseUIChangedEvent(); }
void OnAccountStateChanged(ISipAccount account) { if (InvokeRequired) { Invoke(new Action <ISipAccount>(OnAccountStateChanged), account); return; } RefreshStatus(); }
void Account_PresenceStatusChanged(ISipAccount obj) { if (obj.PresenceStatus.Code == PresenceStatusCode.NotAvailable) { Checked = true; } else { Checked = false; } }
//void Shade_ButtonClicked(object sender, EventArgs e) //{ // _core.Sip.Account.PresenceStatus = new PresenceStatus(PresenceStatusCode.Available); //} void OnAccountRegisterStateChanged(ISipAccount account) { if (account == null) { return; } if (InvokeRequired) { BeginInvoke(new Action <ISipAccount>(OnAccountRegisterStateChanged), account); return; } labelUserName.Text = $"{account.FullName} ({account.UserName})"; switch (account.RegisterState) { case SipAccountState.Connecting: Header = string.Format(_baseTitle, CaptionStrings.CaptionStrings.StateConnecting.ToLower()); btnReconnect.Visible = false; break; case SipAccountState.Online: btnReconnect.Visible = false; if (!string.IsNullOrEmpty(CallOnStartup?.Destination)) { CallInternal(CallOnStartup); CallOnStartup = null; } UpdateAccountStateUi(Core); break; default: Header = string.Format(_baseTitle, CaptionStrings.CaptionStrings.StateDisconnected.ToLower()); btnReconnect.Visible = true; btnReconnect.Enabled = true; CallOnStartup = null; break; } }
protected override void AccountOnRegisterStateChanged(ISipAccount account) { Checked = account?.PresenceStatus?.Code == TargetState; base.AccountOnRegisterStateChanged(account); }
protected override void AccountOnPresenceStatusChanged(ISipAccount account) { }
protected virtual void AccountOnPresenceStatusChanged(ISipAccount account) { Checked = account?.PresenceStatus?.Code == TargetState; }