Exemplo n.º 1
0
        public MainPage()
        {
            System.Diagnostics.Debug.WriteLine("UserAgent: " + getUserAgent());
            _instance   = this;
            _uiThreadID = System.Threading.Thread.CurrentThread.ManagedThreadId;
            updateScreenSize();
            InitializeComponent();
            ApplicationBar.IsVisible = false;
            _screenOrientation       = Orientation;
            try
            {
                // initialize C# extensions factories
                CSharpExtensions.InitializeExtensions();
                // create rhodes runtime object
                var _rhoruntime = CRhoRuntime.getInstance(new MainPageWrapper(this));
                _rhoruntime.setCryptoEngine(new CryptoEngineWrapper(new RhoCrypt()));
                // create and start rhodes main thread
                _rhoruntimeThread = new Thread(_rhoruntime.Execute);
                _rhoruntimeThread.Start();

                //temporary solutions, to do refactoring
                //Thread.Sleep(200);
                _rhoruntime.onActivate(0);
            }
            catch (Exception e)
            {
                RhodesWebBrowser.NavigateToString("<html><head><title>Exception</title></head><body>Exception: " + e.Message + "</body></html>");
            }
        }
Exemplo n.º 2
0
        private void RhodesWebBrowser_JSNotify(object sender, NotifyEventArgs e)
        {
            String answer = CRhoRuntime.getInstance().onJSInvoke(e.Value);

            RhodesWebBrowser.IsScriptEnabled = true;
            RhodesWebBrowser.InvokeScript("nativeCallback", new string[] { answer });
        }
Exemplo n.º 3
0
        // *** WEBVIEW ***

        public void navigate(string url, int index)
        {
            if (!isUIThread)
            {
                Dispatcher.BeginInvoke(delegate() { navigate(url, index); }); return;
            }
            RhodesWebBrowser.Navigate(new Uri(url));
        }
Exemplo n.º 4
0
 public void DisplayMessage(string msg)
 {
     if (!isUIThread)
     {
         Dispatcher.BeginInvoke(delegate() { DisplayMessage(msg); }); return;
     }
     RhodesWebBrowser.NavigateToString("<html><head><title>Message</title></head><body>" + msg + "</body></html>");
 }
Exemplo n.º 5
0
 public void Refresh(int index)
 {
     if (!isUIThread)
     {
         Dispatcher.BeginInvoke(delegate() { Refresh(index); }); return;
     }
     RhodesWebBrowser.Navigate(new Uri(RhodesWebBrowser.Source.AbsoluteUri, UriKind.Absolute));
     // another possible implementation: RhodesWebBrowser.InvokeScript("eval", "history.go()");
 }
Exemplo n.º 6
0
 // this method is used for updating UI controls from C++ non-UI thread
 public void UpdateWebView(int counter)
 {
     // perform this action on UI thread only
     if (!isUIThread)
     {
         Dispatcher.BeginInvoke(delegate() { UpdateWebView(counter); });  return;
     }
     // update WebView
     RhodesWebBrowser.NavigateToString("<html><head><title>Loading...</title></head><body>" + counter + "<input type=\"text\" name=\"test\" size=\"25\"/></body></html>");
 }
Exemplo n.º 7
0
 public void GoForward()
 {
     if (!isUIThread)
     {
         Dispatcher.BeginInvoke(delegate() { GoForward(); }); return;
     }
     if (RhodesWebBrowser.CanGoForward)
     {
         RhodesWebBrowser.GoForward();
     }
 }
Exemplo n.º 8
0
 public string executeScriptFunc(string script, int index)
 {
     string[] codeString = { script };
     if (isDefaultBrowser())
     {
         return(RhodesWebBrowser.InvokeScript("eval", codeString).ToString());
     }
     else
     {
         return(((WebBrowser)((PivotItem)TabbarPivot.Items[getValidTabbarIndex(index)]).Content).InvokeScript("eval", codeString).ToString());
     }
 }
Exemplo n.º 9
0
 public string executeScriptFunc(string script, int index)
 {
     string[] codeString = { script };
     if (TabbarPivot.Items.Count == 0 || _isCallbackFired)//_tabProps[index]._isInitialized == false)
     {
         _isCallbackFired = false;
         return(RhodesWebBrowser.InvokeScript("eval", codeString).ToString());
     }
     else
     {
         return(((WebBrowser)((PivotItem)TabbarPivot.Items[getValidTabbarIndex(index)]).Content).InvokeScript("eval", codeString).ToString());
     }
 }
Exemplo n.º 10
0
        // *** WEBVIEW ***

        public void navigate(string url, int index)
        {
            if (!isUIThread)
            {
                Dispatcher.BeginInvoke(delegate() { navigate(url, index); }); return;
            }
            if (isDefaultBrowser())
            {
                RhodesWebBrowser.Navigate(new Uri(url));
            }
            else
            {
                ((WebBrowser)((PivotItem)TabbarPivot.Items[getValidTabbarIndex(index)]).Content).Navigate(new Uri(url));
            }
        }
Exemplo n.º 11
0
 public void Refresh(int index)
 {
     if (!isUIThread)
     {
         Dispatcher.BeginInvoke(delegate() { Refresh(index); }); return;
     }
     if (isDefaultBrowser())
     {
         RhodesWebBrowser.Navigate(new Uri(RhodesWebBrowser.Source.AbsoluteUri, UriKind.Absolute));
     }
     // another possible implementation: RhodesWebBrowser.InvokeScript("eval", "history.go()");
     else
     {
         ((WebBrowser)((PivotItem)TabbarPivot.Items[getValidTabbarIndex(index)]).Content).Navigate(
             new Uri(((WebBrowser)((PivotItem)TabbarPivot.Items[getValidTabbarIndex(index)]).Content).Source.AbsoluteUri, UriKind.Absolute));
     }
 }
Exemplo n.º 12
0
        public MainPage()
        {
            _uiThreadID = System.Threading.Thread.CurrentThread.ManagedThreadId;
            InitializeComponent();
            try
            {
                // create rhodes runtime object
                var rhoruntime = new CRhoRuntime(this);

                // create and start rhodes main thread
                _rhoruntimeThread = new Thread(rhoruntime.Execute);
                _rhoruntimeThread.Start();
            }
            catch (Exception e)
            {
                RhodesWebBrowser.NavigateToString("<html><head><title>Exception</title></head><body>Exception: " + e.Message + "</body></html>");
            }
        }
Exemplo n.º 13
0
        // *** WEBVIEW ***

        public void navigate(string url, int index)
        {
            if (!isUIThread)
            {
                Dispatcher.BeginInvoke(delegate() { navigate(url, index); }); return;
            }

            /*if(url.Contains("http://") == false)
             * {
             *  String appdir = Windows.Storage.ApplicationData.Current.LocalFolder.Path;
             *  url = "file:///" + appdir.Replace(@"\", "/") +"/" + url;
             *
             * }*/

            if (_tabProps.Count == 0)
            {
                index = -1;
            }

            if (url == "")
            {
                return;
            }

            if (index == -1 && !_isBrowserInitialized)
            {
                initUri = url;
                return;
            }
            else if (index > -1 && _tabProps.ContainsKey(index) && _tabProps[index]._isInitialized == false)
            {
                _tabProps[index]._action = url;
                return;
            }

            if (TabbarPivot.Items.Count == 0)
            {
                RhodesWebBrowser.Navigate(new Uri(url, UriKind.RelativeOrAbsolute));
            }
            else
            {
                ((WebBrowser)((PivotItem)TabbarPivot.Items[getValidTabbarIndex(index)]).Content).Navigate(new Uri(url, UriKind.RelativeOrAbsolute));
            }
        }
Exemplo n.º 14
0
 public void GoForward()
 {
     if (!isUIThread)
     {
         Dispatcher.BeginInvoke(delegate() { GoForward(); }); return;
     }
     if (isDefaultBrowser())
     {
         if (RhodesWebBrowser.CanGoForward)
         {
             RhodesWebBrowser.GoForward();
         }
     }
     else
     {
         if (((WebBrowser)((PivotItem)TabbarPivot.Items[TabbarPivot.SelectedIndex]).Content).CanGoForward)
         {
             ((WebBrowser)((PivotItem)TabbarPivot.Items[TabbarPivot.SelectedIndex]).Content).GoForward();
         }
     }
 }
Exemplo n.º 15
0
 public void GoForward(int index)
 {
     if (!isUIThread)
     {
         Dispatcher.BeginInvoke(delegate() { GoForward(index); }); return;
     }
     if ((TabbarPivot.Items.Count == 0) || (index < 0) || (index >= TabbarPivot.Items.Count))
     {
         if (RhodesWebBrowser.CanGoForward)
         {
             RhodesWebBrowser.GoForward();
         }
     }
     else
     {
         if (((WebBrowser)((PivotItem)TabbarPivot.Items[index]).Content).CanGoForward)
         {
             ((WebBrowser)((PivotItem)TabbarPivot.Items[index]).Content).GoForward();
         }
     }
 }
Exemplo n.º 16
0
 public void GoBack(int index)
 {
     if (!isUIThread)
     {
         Dispatcher.BeginInvoke(delegate() { GoBack(index); }); return;
     }
     if ((TabbarPivot.Items.Count == 0) /* || (index < 0) || (index >= TabbarPivot.Items.Count)*/)
     {
         if (RhodesWebBrowser.CanGoBack)
         {
             RhodesWebBrowser.GoBack();
         }
     }
     else
     {
         if (((WebBrowser)((PivotItem)TabbarPivot.Items[getValidTabbarIndex(index)]).Content).CanGoBack)
         {
             ((WebBrowser)((PivotItem)TabbarPivot.Items[getValidTabbarIndex(index)]).Content).GoBack();
         }
     }
 }
Exemplo n.º 17
0
        public MainPage()
        {
            _uiThreadID           = System.Threading.Thread.CurrentThread.ManagedThreadId;
            _screenWidth          = Application.Current.Host.Content.ActualWidth;
            _screenHeight         = Application.Current.Host.Content.ActualHeight;
            _screenPhysicalHeight = 4;                                                      // assuming 4 inches
            _screenPhysicalWidth  = (_screenPhysicalHeight / _screenHeight) * _screenWidth; // assuming square pixels

            InitializeComponent();
            try
            {
                // create rhodes runtime object
                var rhoruntime = new CRhoRuntime(this);
                // create and start rhodes main thread
                _rhoruntimeThread = new Thread(rhoruntime.Execute);
                _rhoruntimeThread.Start();
            }
            catch (Exception e)
            {
                RhodesWebBrowser.NavigateToString("<html><head><title>Exception</title></head><body>Exception: " + e.Message + "</body></html>");
            }
        }
Exemplo n.º 18
0
        public MainPage()
        {
            _uiThreadID = System.Threading.Thread.CurrentThread.ManagedThreadId;
            InitializeComponent();
            try
            {
                // create rhodes runtime object
                var rhoruntime = new CRhoRuntime();

                // set callback methods
                rhoruntime.SetWaitCallback(new WaitCallbackPointer(this.DoWait));
                rhoruntime.SetUpdateWebViewCallback(new UpdateWebViewCallbackPointer(this.UpdateWebView));
                rhoruntime.SetExitCallback(new ExitCallbackPointer(this.DoExit));

                // create and start rhodes main thread
                _rhoruntimeThread = new Thread(rhoruntime.Execute);
                _rhoruntimeThread.Start();
            }
            catch (Exception e)
            {
                RhodesWebBrowser.NavigateToString("<html><head><title>Exception</title></head><body>Exception: " + e.Message + "</body></html>");
            }
        }
Exemplo n.º 19
0
        public MainPage()
        {
            _uiThreadID = System.Threading.Thread.CurrentThread.ManagedThreadId;
            updateScreenSize();
            InitializeComponent();
            ApplicationBar.IsVisible = false;
            try
            {
                // create rhodes runtime object
                var _rhoruntime = CRhoRuntime.getInstance(new MainPageWrapper(this));
                // create and start rhodes main thread
                _rhoruntimeThread = new Thread(_rhoruntime.Execute);
                _rhoruntimeThread.Start();

                //temporary solutions, to do refactoring
                Thread.Sleep(5000);
                _rhoruntime.onActivate(0);
            }
            catch (Exception e)
            {
                RhodesWebBrowser.NavigateToString("<html><head><title>Exception</title></head><body>Exception: " + e.Message + "</body></html>");
            }
        }
Exemplo n.º 20
0
        // *** WEBVIEW ***

        public void navigate(string url, int index)
        {
            if (!isUIThread)
            {
                Dispatcher.BeginInvoke(delegate() { navigate(url, index); }); return;
            }

            if (_tabProps.Count == 0)
            {
                index = -1;
            }

            if (url == "")
            {
                return;
            }

            if (index == -1 && !_isBrowserInitialized)
            {
                initUri = url;
                return;
            }
            else if (index > -1 && _tabProps.ContainsKey(index) && _tabProps[index]._isInitialized == false)
            {
                _tabProps[index]._action = url;
                return;
            }

            if (TabbarPivot.Items.Count == 0)
            {
                RhodesWebBrowser.Navigate(new Uri(url, UriKind.RelativeOrAbsolute));
            }
            else
            {
                ((WebBrowser)((PivotItem)TabbarPivot.Items[getValidTabbarIndex(index)]).Content).Navigate(new Uri(url, UriKind.RelativeOrAbsolute));
            }
        }