コード例 #1
0
 //--------------------------------------------------------Misc Methods:---------------------------------------------------------------\\
 #region --Misc Methods (Public)--
 public async Task CreateAccount()
 {
     await Task.Run(() =>
     {
         XMPPUser user       = new XMPPUser(MODEL.BareJidText, Utils.getRandomResourcePart());
         XMPPAccount account = new XMPPAccount(user)
         {
             color = UiUtils.GenRandomHexColor()
         };
         account.generateOmemoKeys();
         SetAccount(account);
     });
 }
コード例 #2
0
        //--------------------------------------------------------Misc Methods:---------------------------------------------------------------\\
        #region --Misc Methods (Public)--
        public async Task CreateAccountAsync()
        {
            await Task.Run(async() =>
            {
                XMPPUser user       = new XMPPUser(MODEL.BareJidText, Utils.getRandomResourcePart());
                XMPPAccount account = new XMPPAccount(user)
                {
                    color = UiUtils.GenRandomHexColor(),
                };

                // Look up the DNS SRV record:
                await account.dnsSrvLookupAsync();

                account.generateOmemoKeys();
                SetAccount(account);
            });
        }
コード例 #3
0
        private async void PickColor_btn_Click(object sender, RoutedEventArgs e)
        {
            Color color;

            if (UiUtils.IsHexColor(VIEW_MODEL.MODEL.Account.color))
            {
                color = UiUtils.HexStringToColor(VIEW_MODEL.MODEL.Account.color);
            }
            else
            {
                color = UiUtils.HexStringToColor(UiUtils.GenRandomHexColor());
            }
            ColorPickerDialog dialog = new ColorPickerDialog(color);
            await UiUtils.ShowDialogAsync(dialog);

            VIEW_MODEL.ColorSelected(dialog.VIEW_MODEL.MODEL);
        }
コード例 #4
0
        //--------------------------------------------------------Constructor:----------------------------------------------------------------\\
        #region --Constructors--


        #endregion
        //--------------------------------------------------------Set-, Get- Methods:---------------------------------------------------------\\
        #region --Set-, Get- Methods--


        #endregion
        //--------------------------------------------------------Misc Methods:---------------------------------------------------------------\\
        #region --Misc Methods (Public)--
        public Task CreateAccountAsync()
        {
            return(Task.Run(async() =>
            {
                JidModel jid = new JidModel
                {
                    localPart = XMPP_API.Classes.Utils.getJidLocalPart(MODEL.BareJidText),
                    domainPart = XMPP_API.Classes.Utils.getJidDomainPart(MODEL.BareJidText),
                    resourcePart = XMPP_API.Classes.Utils.getRandomResourcePart()
                };
                AccountModel account = new AccountModel(jid, UiUtils.GenRandomHexColor());
                account.omemoInfo.GenerateOmemoKeys();

                // Look up the DNS SRV record:
                SRVLookupResult result = await XMPPAccount.dnsSrvLookupAsync(jid.domainPart);
                if (result.SUCCESS)
                {
                    account.server.address = result.SERVER_ADDRESS;
                    account.server.port = result.PORT;
                }
                MODEL.Account = account;
            }));
        }