Exemple #1
0
        /// <summary>
        /// Queries the user for the remote endpoint to send messages to.
        /// </summary>
        /// <param name="defaultEndpoint">The user's own endpoint, to use for loopback demos in the event the user has no friend to talk to.</param>
        /// <returns>A task whose result is the remote endpoint to use.</returns>
        private async Task <Endpoint> GetFriendEndpointAsync(Endpoint defaultEndpoint)
        {
            do
            {
                Console.Write("Enter your friend's public endpoint URL (leave blank for loopback): ");
                string url = Console.ReadLine();
                if (string.IsNullOrWhiteSpace(url))
                {
                    return(defaultEndpoint);
                }

                var addressBook = new DirectEntryAddressBook(this.CryptoProvider, new System.Net.Http.HttpClient());
                var endpoint    = await addressBook.LookupAsync(url);

                if (endpoint != null)
                {
                    return(endpoint);
                }
                else
                {
                    Console.WriteLine("Unable to find endpoint.");
                    continue;
                }
            } while (true);
        }
        private async void ChatWithAuthor_OnClick(object sender, RoutedEventArgs e)
        {
            var chatroomWindow = this.ChatroomWindowFactory.CreateExport();

            chatroomWindow.Value.Show();

            var addressBook = new DirectEntryAddressBook(this.CryptoProvider, new HttpClient());
            var endpoint    = await addressBook.LookupAsync("http://tinyurl.com/omhxu6l#-Rrs7LRrCE3bV8x58j1l4JUzAT3P2obKia73k3IFG9k");

            chatroomWindow.Value.AddMember("App author", endpoint);
        }
Exemple #3
0
        private async void ChatWithAuthor_OnClick(object sender, RoutedEventArgs e)
        {
            var chatroomWindow = this.container.Resolve <ChatroomWindow>();

            chatroomWindow.Show();

            var addressBook = new DirectEntryAddressBook(new HttpClient());
            var endpoint    = await addressBook.LookupAsync("http://tinyurl.com/omhxu6l#-Rrs7LRrCE3bV8x58j1l4JUzAT3P2obKia73k3IFG9k");

            chatroomWindow.AddMember("App author", endpoint);
        }
Exemple #4
0
        internal async Task InvitingMemberAsync(InviteMember inviteWindow)
        {
            var addressBook = new DirectEntryAddressBook(this.CryptoProvider, new HttpClient());
            var endpoint    = await addressBook.LookupAsync(inviteWindow.PublicEndpointUrlBox.Text);

            if (endpoint != null)
            {
                try {
                    this.AddMember(inviteWindow.FriendlyNameBox.Text, endpoint);
                } catch (InvalidOperationException ex) {
                    MessageBox.Show(ex.Message);
                }
            }

            inviteWindow.Close();
        }