예제 #1
0
        public void ShowUrl(string sourceUrl, string gmiFile, string htmlFile, string themePath, SiteIdentity siteIdentity, System.Windows.Navigation.NavigatingCancelEventArgs e)
        {
            string hash;

            hash = HashService.GetMd5Hash(sourceUrl);

            var usedShowWebHeaderInfo = false;

            var settings = new Settings();
            var uri      = new UriBuilder(sourceUrl);

            //only show web header for self generated content, not proxied
            usedShowWebHeaderInfo = uri.Scheme.StartsWith("http") && settings.HandleWebLinks != "Gemini HTTP proxy";

            //create the html file
            var result = ConverterService.GmiToHtml(gmiFile, htmlFile, sourceUrl, siteIdentity, themePath, usedShowWebHeaderInfo);

            if (!File.Exists(htmlFile))
            {
                ToastNotify("GMIToHTML did not create content for " + sourceUrl + "\n\n" + "File: " + gmiFile, ToastMessageStyles.Error);

                ToggleContainerControlsForBrowser(true);
                e.Cancel = true;
            }
            else
            {
                _urlsByHash[hash] = sourceUrl;

                //no further navigation right now
                e.Cancel = true;

                //instead tell the browser to load the content
                BrowserControl.Navigate(@"file:///" + htmlFile);
            }
        }
예제 #2
0
        private void LogoutFb()
        {
            var fb         = new FacebookClient();
            var parameters = new Dictionary <string, object>();

            parameters["access_token"] = (string)App.appSettings[HikeConstants.AppSettings.FB_ACCESS_TOKEN];
            parameters["next"]         = "https://www.facebook.com/connect/login_success.html";
            var logoutUrl = fb.GetLogoutUrl(parameters);

            BrowserControl.Navigate(logoutUrl);
        }
예제 #3
0
 private void GoToPage_Executed(object sender, ExecutedRoutedEventArgs e)
 {
     if (UriTester.TextIsUri(txtUrl.Text))
     {
         BrowserControl.Navigate(txtUrl.Text);
     }
     else
     {
         ToastNotify("Not a valid URI: " + txtUrl.Text, ToastMessageStyles.Error);
     }
 }
예제 #4
0
        public void ShowImage(string sourceUrl, string imgFile, NavigatingCancelEventArgs e)
        {
            var hash = HashService.GetMd5Hash(sourceUrl);

            _urlsByHash[hash] = sourceUrl;

            //no further navigation right now
            e.Cancel = true;

            //instead tell the browser to load the content
            BrowserControl.Navigate(@"file:///" + imgFile);
        }
예제 #5
0
 void CallBackToken(OAuthRequestToken rt, TwitterResponse response)
 {
     if (rt != null)
     {
         Uri uri = service.GetAuthorizationUri(rt);
         _requestToken = rt;
         BrowserControl.Dispatcher.BeginInvoke(() => BrowserControl.Navigate(uri));
     }
     else
     {
         MessageBox.Show("Sorry, can not access the data.Please try again later.");
         return;
     }
 }
예제 #6
0
        private void TwitterRequestTokenCompleted(RestRequest request, RestResponse response, object userstate)
        {
            _oAuthToken       = GetQueryParameter(response.Content, "oauth_token");
            _oAuthTokenSecret = GetQueryParameter(response.Content, "oauth_token_secret");
            var authorizeUrl = TwitterSettings.AuthorizeUri + "?oauth_token=" + _oAuthToken;

            if (String.IsNullOrEmpty(_oAuthToken) || String.IsNullOrEmpty(_oAuthTokenSecret))
            {
                Dispatcher.BeginInvoke(() => MessageBox.Show("error calling twitter"));
                return;
            }

            Dispatcher.BeginInvoke(() => BrowserControl.Navigate(new Uri(authorizeUrl)));
        }
예제 #7
0
 private void txtUrl_KeyUp(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         if (UriTester.TextIsUri(txtUrl.Text))
         {
             BrowserControl.Navigate(txtUrl.Text);
         }
         else
         {
             ToastNotify("Not a valid URI: " + txtUrl.Text, ToastMessageStyles.Error);
         }
     }
 }
예제 #8
0
        private void MenuViewSource_Click(object sender, RoutedEventArgs e)
        {
            var    menu = (MenuItem)sender;
            string hash;

            //use the current session folder
            var sessionPath = Session.Instance.SessionPath;

            hash = HashService.GetMd5Hash(txtUrl.Text);

            //uses .txt as extension so content loaded as text/plain not interpreted by the browser
            var gmiFile = sessionPath + "\\" + hash + ".txt";

            BrowserControl.Navigate(gmiFile);
        }
예제 #9
0
        private void ViewThemeItem_Click(object sender, RoutedEventArgs e)
        {
            var menu      = (MenuItem)sender;
            var themeName = menu.Header.ToString();

            var settings = new Settings();

            if (settings.Theme != themeName)
            {
                settings.Theme = themeName;
                settings.Save();

                TickSelectedThemeMenu();

                //redisplay
                BrowserControl.Navigate(txtUrl.Text);
            }
        }
예제 #10
0
        public MainWindow()
        {
            InitializeComponent();

            _notifier = new Notifier(cfg =>
            {
                //place the notifications approximately inside the main editing area
                //(not over the toolbar area) on the top-right hand side
                cfg.PositionProvider = new WindowPositionProvider(
                    parentWindow: Application.Current.MainWindow,
                    corner: Corner.TopRight,
                    offsetX: 15,
                    offsetY: 90);

                cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor(
                    notificationLifetime: TimeSpan.FromSeconds(5),
                    maximumNotificationCount: MaximumNotificationCount.FromCount(5));

                cfg.Dispatcher = Application.Current.Dispatcher;
            });

            _urlsByHash      = new Dictionary <string, string>();
            _bookmarkManager = new BookmarkManager(this, BrowserControl);

            AppInit.UpgradeSettings();
            AppInit.CopyAssets();

            _bookmarkManager.RefreshBookmarkMenu();

            var settings  = new Settings();
            var launchUri = settings.HomeUrl;


            String[] args = App.Args;
            if (args != null)
            {
                launchUri = App.Args[0];
            }

            BrowserControl.Navigate(launchUri);

            BuildThemeMenu();
            TickSelectedThemeMenu();
        }
예제 #11
0
        protected override void OnBackKeyPress(CancelEventArgs e)
        {
            base.OnBackKeyPress(e);

            if (ViewModel.BrowserHistoryUrls.Count <= 1)
            {
                return;
            }

            var uri = ViewModel.BrowserHistoryUrls.Last();

            ViewModel.BrowserHistoryUrls.Remove(uri);

            if (ViewModel.BrowserHistoryUrls.Count < 1)
            {
                return;
            }

            BrowserControl.Navigate(new Uri(ViewModel.BrowserHistoryUrls[ViewModel.BrowserHistoryUrls.Count - 1]));
            e.Cancel = true;
        }
예제 #12
0
        private void LogInFb()
        {
            string perms;

            if (fromEnterName)
            {
                perms = extendedPermissionsEnterName;
            }
            else
            {
                perms = extendedPermissions;
            }
            var parameters = new Dictionary <string, object>();

            parameters["client_id"]     = Misc.Social.FacebookSettings.AppID;
            parameters["redirect_uri"]  = "https://www.facebook.com/connect/login_success.html";
            parameters["response_type"] = "token";
            parameters["display"]       = "touch";
            parameters["scope"]         = perms;
            BrowserControl.Navigate(_fb.GetLoginUrl(parameters));
        }
예제 #13
0
        public SocialPages()
        {
            InitializeComponent();
            object sn;

            if (PhoneApplicationService.Current.State.TryGetValue(HikeConstants.SOCIAL, out sn))
            {
                socialNetwork = (string)sn;
            }

            if (socialNetwork == HikeConstants.TWITTER)
            {
                PhoneApplicationService.Current.State["FromSocialPage"] = true;
                BrowserControl.IsScriptEnabled = false;
                AuthenticateTwitter();
            }
            else if (socialNetwork == HikeConstants.FACEBOOK)
            {
                PhoneApplicationService.Current.State["FromSocialPage"] = true;
                if (PhoneApplicationService.Current.State.ContainsKey("fromEnterName"))
                {
                    fromEnterName = true;
                }
                if (App.appSettings.Contains(HikeConstants.FB_LOGGED_IN))
                {
                    LogoutFb();
                }
                else
                {
                    LogInFb();
                }
            }
            else
            {
                string url  = (AccountUtils.IsProd ? "http://hike.in/" : "http://staging.im.hike.in:8080/") + "rewards/wp7/" + (string)App.appSettings[HikeConstants.REWARDS_TOKEN];
                Uri    page = new Uri(url);
                BrowserControl.Navigate(page);
            }
        }
 private void Btn_LoginOther_Click(object sender, RoutedEventArgs e)
 {
     Sp_Login.Visibility       = Visibility.Hidden;
     BrowserControl.Visibility = Visibility.Visible;
     BrowserControl.Navigate("https://aliyundrive.com/sign/in");
 }
예제 #15
0
        private void BrowseHome_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            var settings = new Settings();

            BrowserControl.Navigate(settings.HomeUrl);
        }
예제 #16
0
 public void Navigate(string url)
 {
     BrowserControl.Navigate(url);
 }
예제 #17
0
 private void BrowserControl_Loaded(object sender, RoutedEventArgs e)
 {
     BrowserControl.Navigate(StartUri);
 }
예제 #18
0
 private void MenuHelpContents_Click(object sender, RoutedEventArgs e)
 {
     //this will be a look up into docs folder
     BrowserControl.Navigate("about://geminaut/help.gmi");
 }
예제 #19
0
        private void InitializeWelcomePage()
        {
            m_welcomePage = new BrowserControl();
            m_welcomePage.Dock = DockStyle.Fill;
            m_welcomePage.Navigate(PLAYCANVAS_DEVELOPER_URL, true);

            AddTabPage(m_welcomePage, TAB_NAME_WELCOME);
        }
예제 #20
0
        public void mnuMenuBookmarksGo_Click(object sender, RoutedEventArgs e)
        {
            var menuItem = (MenuItem)sender;

            BrowserControl.Navigate(menuItem.CommandParameter.ToString());
        }