Пример #1
0
        public void UpdateStatusAsync(TLBool offline, Action <TLBool> callback, Action <TLRPCError> faultCallback = null)
        {
            if (_activeTransport.AuthKey == null)
            {
                return;
            }

#if WIN_RT
            if (_deviceInfo != null && _deviceInfo.IsBackground)
            {
                var message = string.Format("::{0} {1} account.updateStatus {2}", _deviceInfo.BackgroundTaskName, _deviceInfo.BackgroundTaskId, offline);
                Logs.Log.Write(message);
#if DEBUG
                AddToast("task", message);
#endif
            }
#endif
            var obj = new TLUpdateStatus {
                Offline = offline
            };

            SendInformativeMessage("account.updateStatus", obj, callback, faultCallback);
        }
        public void UpdateStatusAsync(TLBool offline, Action <TLBool> callback, Action <TLRPCError> faultCallback = null)
        {
            if (_activeTransport.AuthKey == null)
            {
                return;
            }

#if WIN_RT
            if (_deviceInfo != null && _deviceInfo.IsBackground)
            {
                var message = string.Format("::{0} {1} account.updateStatus {2}", _deviceInfo.BackgroundTaskName, _deviceInfo.BackgroundTaskId, offline);
                Logs.Log.Write(message);
#if DEBUG && WNS_PUSH_SERVICE
                AddToast("task", message);
#endif
            }
#endif

            TLObject obj = null;
            if (_deviceInfo != null && _deviceInfo.IsBackground)
            {
                obj = new TLInvokeWithoutUpdates {
                    Object = new TLUpdateStatus {
                        Offline = offline
                    }
                };
            }
            else
            {
                obj = new TLUpdateStatus {
                    Offline = offline
                };
            }

            System.Diagnostics.Debug.WriteLine("account.updateStatus offline=" + offline.Value);
            SendInformativeMessage("account.updateStatus", obj, callback, faultCallback);
        }