public async Task AddServerAsync(ServerSetting server)
        {
            if (!_isInitialized)
            {
                await InitializeAsync();
            }

            if (!String.IsNullOrWhiteSpace(server.ServerName) && !String.IsNullOrWhiteSpace(server.ServerHost))
            {
                ServerSetting old =
                    ServerList.FirstOrDefault(
                        item => item.ServerHost.Equals(server.ServerHost, StringComparison.CurrentCultureIgnoreCase));
                if (old != null)
                {
                    old.ServerHost = server.ServerHost;
                }
                else
                {
                    server.CanDelete = true;
                    ServerList.Add(server);
                }
                await SaveConfigAsync();
            }
        }
 private void StartLoginFlow(ServerSetting server)
 {
     if (server != null)
     {
         VisualStateManager.GoToState(this, LoggingUserInViewState, true);
         SDKManager.ResetClientManager();
         SalesforceConfig config = SDKManager.ServerConfiguration;
         var options = new LoginOptions(server.ServerHost, config.ClientId, config.CallbackUrl, config.Scopes);
         SalesforceConfig.LoginOptions = new LoginOptions(server.ServerHost, config.ClientId, config.CallbackUrl,
             config.Scopes);
         DoAuthFlow(options);
     }
 }
        private async void addCustomHostBtn_Click(object sender, RoutedEventArgs e)
        {
            string hname = HostName.Text;
            string haddress = HostAddress.Text;
            if (String.IsNullOrWhiteSpace(haddress))
            {
                return;
            }
            if (String.IsNullOrWhiteSpace(hname))
            {
                hname = haddress;
            }
            var server = new ServerSetting
            {
                ServerHost = haddress,
                ServerName = hname
            };
            await SDKManager.ServerConfiguration.AddServerAsync(server);

            TryShowFlyout(ServerFlyout, ApplicationLogo);
        }