Esempio n. 1
0
        //navigate to a url but get some user input first
        private bool NavigateGopherWithInput(Uri uri)
        {
            //position input box approx in middle of main window

            var windowCentre = WindowGeometry.WindowCentre(mMainWindow);
            var inputPrompt  = "Input request from Gopher server\n\n" +
                               "  " + uri.Host + uri.LocalPath + "\n\n" +
                               "Please provide your input:";

            string input = Interaction.InputBox(inputPrompt, "Server input request", "", windowCentre.Item1, windowCentre.Item2);

            if (input != "")
            {
                //encode the query
                var b = new UriBuilder();
                b.Scheme = uri.Scheme;
                b.Host   = uri.Host;
                if (uri.Port != -1)
                {
                    b.Port = uri.Port;
                }
                b.Path = uri.LocalPath;

                //!%22%C2%A3$%25%5E&*()_+1234567890-=%7B%7D:@~%3C%3E?[];'#,./

                //use an escaped tab then the content
                var query = b.ToString() + "%09" + Uri.EscapeDataString(input);      //escape the query result;
                //ToastNotify(query);

                mMainWindow.Navigate(query);
            }
            else
            {
                //dont do anything further with navigating the browser
                return(false);
            }

            return(true);
        }
Esempio n. 2
0
        //navigate to a url but get some user input first
        public bool NavigateGeminiWithInput(Uri uri, string message)
        {
            //position input box approx in middle of main window

            var windowCentre = WindowGeometry.WindowCentre(mMainWindow);
            var inputPrompt  = "Input request from Gemini server\n\n" +
                               "  " + uri.Host + uri.LocalPath + "\n\n" +
                               message;

            string input = Interaction.InputBox(inputPrompt, "Server input request", "", windowCentre.Item1, windowCentre.Item2);

            if (input != "")
            {
                //encode the query
                var b = new UriBuilder();
                b.Scheme = uri.Scheme;
                b.Host   = uri.Host;
                if (uri.Port != -1)
                {
                    b.Port = uri.Port;
                }
                b.Path = uri.LocalPath;
                //!%22%C2%A3$%25%5E&*()_+1234567890-=%7B%7D:@~%3C%3E?[];'#,./
                b.Query = Uri.EscapeDataString(input);      //escape the query result

                //ToastNotify(b.ToString());

                mMainWindow.Navigate(b.ToString());
            }
            else
            {
                //dont do anything further with navigating the browser
                return(false);
            }

            return(true);
        }