Esempio n. 1
0
        private async void TerminateExecute(ConnectedWebsite session)
        {
            var bot = ProtoService.GetUser(session.BotUserId);

            if (bot == null)
            {
                return;
            }

            var dialog = new MessagePopup();

            dialog.Title               = Strings.Resources.AppName;
            dialog.Message             = string.Format(Strings.Resources.TerminateWebSessionQuestion, session.DomainName);
            dialog.PrimaryButtonText   = Strings.Resources.OK;
            dialog.SecondaryButtonText = Strings.Resources.Cancel;
            dialog.CheckBoxLabel       = string.Format(Strings.Resources.TerminateWebSessionStop, bot.FirstName);

            var terminate = await dialog.ShowQueuedAsync();

            if (terminate == ContentDialogResult.Primary)
            {
                var response = await ProtoService.SendAsync(new DisconnectWebsite(session.Id));

                if (response is Ok)
                {
                    Items.Remove(session);
                }
                else if (response is Error error)
                {
                    Logs.Logger.Error(Logs.Target.API, "auth.resetWebAuthotization error " + error);
                }

                ProtoService.Send(new BlockUser(bot.Id));
            }
        }
Esempio n. 2
0
        public void UpdateConnectedWebsite(IProtoService protoService, ConnectedWebsite session)
        {
            var bot = protoService.GetUser(session.BotUserId);

            if (bot == null)
            {
                return;
            }

            Photo.Source = PlaceholderHelper.GetUser(protoService, bot, 18, 18);

            Domain.Text   = session.DomainName;
            Title.Text    = string.Format("{0}, {1}, {2}", bot.FirstName, session.Browser, session.Platform);
            Subtitle.Text = string.Format("{0} — {1}", session.Ip, session.Location);

            LastActiveDate.Text = BindConvert.Current.DateExtended(session.LastActiveDate);
        }