Пример #1
0
 private bool onKickMessage(IQMessage msg)
 {
     if (msg is IQErrorMessage)
     {
         IQErrorMessage errorMessage = msg as IQErrorMessage;
         Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
         {
             error_itbx.Text       = "Type: " + errorMessage.ERROR_OBJ.ERROR_NAME + "\nMessage: " + errorMessage.ERROR_OBJ.ERROR_MESSAGE;
             error_itbx.Visibility = Visibility.Visible;
             enableButtons();
         }).AsTask();
         return(true);
     }
     if (Equals(msg.TYPE, IQMessage.RESULT))
     {
         Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
         {
             done_itbx.Text             = "Success! Occupant got kicked.";
             done_itbx.Visibility       = Visibility.Visible;
             kickSingle_prgr.Visibility = Visibility.Collapsed;
         }).AsTask();
         return(true);
     }
     return(false);
 }
        private bool onRequestBanListMessage(MessageResponseHelper <IQMessage> helper, IQMessage iq)
        {
            if (iq is IQErrorMessage)
            {
                IQErrorMessage errorMessage = iq as IQErrorMessage;
                Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
                {
                    showErrorMessage("Type: " + errorMessage.ERROR_OBJ.ERROR_NAME + "\nMessage: " + errorMessage.ERROR_OBJ.ERROR_MESSAGE);
                    reload_btn.IsEnabled   = true;
                    reload_prgr.Visibility = Visibility.Collapsed;
                }).AsTask();
                return(true);
            }
            else if (iq is BanListMessage)
            {
                BanListMessage banListMessage = iq as BanListMessage;
                Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
                {
                    BANNED_USERS.Clear();
                    foreach (BanedUser user in banListMessage.BANED_USERS)
                    {
                        BANNED_USERS.Add(new MUCBanedUserTemplate {
                            banedUser = user
                        });
                    }
                    reload_btn.IsEnabled   = true;
                    reload_prgr.Visibility = Visibility.Collapsed;
                }).AsTask();
                return(true);
            }

            return(false);
        }
 private bool onUpdateBanListMessage(MessageResponseHelper <IQMessage> helper, IQMessage iq)
 {
     if (iq is IQErrorMessage)
     {
         IQErrorMessage errorMessage = iq as IQErrorMessage;
         Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
         {
             showErrorMessage("Type: " + errorMessage.ERROR_OBJ.ERROR_NAME + "\nMessage: " + errorMessage.ERROR_OBJ.ERROR_MESSAGE);
             unban_btn.IsEnabled   = true;
             reload_btn.IsEnabled  = true;
             unban_prgr.Visibility = Visibility.Collapsed;
         }).AsTask();
         return(true);
     }
     else
     {
         Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
         {
             requestBanList();
             unban_btn.IsEnabled   = true;
             reload_btn.IsEnabled  = true;
             unban_prgr.Visibility = Visibility.Collapsed;
         }).AsTask();
         return(true);
     }
 }
Пример #4
0
        private void showDiscoError(IQErrorMessage error)
        {
            loading_spnl.Visibility = Visibility.Collapsed;

            items_icon.Visibility = Visibility.Collapsed;
            if (error is null)
            {
                noneFound_tblck.Text = "Server didn't answer in time!";
            }
            else
            {
                noneFound_tblck.Text = "Request failed with: " + error.ERROR_OBJ.ToString();
            }
            noneFound_tblck.Visibility = Visibility.Visible;
        }