Exemplo n.º 1
0
 public void Remove(User account)
 {
     Accounts.Remove(account);
     MainPage.RunActionOnUiThread(() => {
         OnPropertyChanged("ContactsByGroups");
         OnPropertyChanged("ByGroups");
     });
 }
Exemplo n.º 2
0
 public AddAccountViewModel()
 {
     groupList = new List<string>() { User.DEFAULT_GROUP };
     account = new User();
     saveAccount = new RelayCommand(SaveAccountAction, CanSaveAccount);
     createGroup = new RelayCommand(CreateGroupAction, () => true);
     baseDomainSuggestions = XmppDomainList.GetList();
     xmppDomainSuggestions = new ObservableCollection<string>(baseDomainSuggestions);
 }
Exemplo n.º 3
0
        public static void Delete(User user)
        {
            Files.Settings settings = Files.Settings.Instance;

            User deletedUser = settings.Configuration.Accounts.FirstOrDefault(p => p.MyJID == user.MyJID);
            if (deletedUser != null)
            {
                settings.Configuration.Remove(deletedUser);
                settings.WriteSettings(settings.Configuration);
                DeleteUserEvent?.Invoke();
            }
        }
Exemplo n.º 4
0
 public void ConnectOrChangeStatus(User selectedUser, Show type)
 {
     selectedUser.Command.RegisterOnLogin(Connect_OnLogin);
     selectedUser.Show = type;
     if (selectedUser.Connected == false)
     {
         selectedUser.Status = selectedUser.DefaultStatus;
         selectedUser.DefaultPriority = selectedUser.DefaultPriority;
         if (selectedUser.RegisterNewAccount)
         {
             if (!selectedUser.StorePassword)
                 selectedUser.Password = selectedUser.RegisterPassword;
             selectedUser.Command.Connect();
             if (!selectedUser.StorePassword)
                 selectedUser.Password = null;
             selectedUser.RegisterPassword = null;
             return;
         }
         else if (!selectedUser.StorePassword)
         {
             Views.PasswordBox box = new Views.PasswordBox();
             MainPage.RunActionOnUiThread(async () =>
             {
                 await box.ShowAsync();
                 if (box.pwd != null)
                 {
                     selectedUser.Password = Encryption.Protect(box.pwd).Result;
                     box.pwd = null;
                     selectedUser.Command.Connect();
                     selectedUser.Password = null;
                 }
             });
             return;
         }
         selectedUser.Command.Connect();
     }
     else
         selectedUser.Command.Presence();
 }
Exemplo n.º 5
0
 public static string Set(User user)
 {
     if (string.IsNullOrEmpty(user.DisplayName))
         return string.Format("{0}@{1}", user.Username, user.XmppDomain);
     return user.DisplayName;
 }
Exemplo n.º 6
0
 public Commands(User user)
 {
     action = new Actions();
     action.User = user;
 }