Пример #1
0
        public void Run(FileInfo model)
        {
            var is3MF = model?.Extension.ToUpper() == ".3MF";

            if (model == null || is3MF)
            {
                // System.CommandLine parses and executes the CLI arguments
                // in a new Task. Because of this, it is necessary to execute
                // a new STA Thread to run the webview. Will throw exceptions otherwise.
                Thread thread = new Thread(() =>
                {
                    var initScript =
                        @"window.printProject = {};
                        window.printProject.dropCallback = dropCallback;";
                    if (is3MF)
                    {
                        ClearCreateExtractionPath();
                        var model3mf = new Model3MF(model.FullName);
                        model3mf.ExtractPrintProject(_extractionPath);
                        initScript += "window.printProject.projectFolderUrl='/extracted';";
                    }

                    var hostedContent = new HostedContent();
                    using (_webview = new Webview(false, true))
                    {
                        _webview
                        .SetTitle("3D2P")
                        .SetSize(1024, 800, WebviewHint.None)
                        .SetSize(800, 800, WebviewHint.Min)
                        .Bind("dropCallback", DropCallback)
                        .InitScript(initScript)
                        .Navigate(hostedContent)
                        .Run();
                    }
                });
                #if Windows
                thread.SetApartmentState(ApartmentState.STA);
                #endif
                thread.Start();
                thread.Join();
            }
            else
            {
                Console.WriteLine("This is a 3MF viewer. Please provide a '.3mf' file! Or use '-h' for help.");
            }
        }
Пример #2
0
    public override void OnSet(object data)
    {
        base.OnSet(data);

        count = 0;

        GameObject temp     = GameObject.Find(Config.GAMEOBJECT_TEMP);
        GameObject gridList = GameObject.Find(Config.GAMEOBJECT_GRIDLIST);

        listGObj = new List <GameObject> ();
        for (int i = 0; i < mainData.Count; i++)
        {
            GameObject gObj = Instantiate(temp, new Vector3(0, 0, 0), Quaternion.identity) as GameObject;
            gObj.transform.parent        = gridList.transform;
            gObj.transform.localScale    = new Vector3(1f, 1f, 1f);
            gObj.transform.localPosition = new Vector3(i * 100, 0, 0);

            gObj.name = mainData [i].id.ToString();
            UIButton uIButton = gObj.GetComponent <UIButton> ();
            uIButton.defaultColor = color [i % color.Length];
            uIButton.hover        = color [i % color.Length];
            Logic.GetChildObject(gObj, Config.GAMEOBJECT_LABEL).GetComponent <UILabel> ().text = mainData [i].name;

            listGObj.Add(gObj);
        }

        normalS = new Vector3(1f, 1f, 1f);
        bigS    = new Vector3(1f, 1.2f, 1f);

        listGObj [0].transform.localScale = bigS;
        temp.SetActive(false);
        gridList.GetComponent <UIGrid> ().Reposition();

        googleMobileAdsManager = gameObject.GetComponentInParent <GoogleMobileAdsManager> ();
        webview = GameObject.Find(PANEL_1000).GetComponent <Webview> ();

#if UNITY_IOS
        googleMobileAdsManager.bannerView.Hide();
        StartCoroutine(TimeAd());
#endif
    }
Пример #3
0
        // public IObservable<string> NavigateToPage => _navigateToPage;

        public HtmlPageViewerControl()
        {
            this.InitializeComponent();

            _navigateToPage = new Subject <string>();

            this.WhenActivated(disposable =>
            {
                ViewModel.Content.Subscribe(x => { Webview.NavigateToString(x); })
                .DisposeWith(disposable);

                ViewModel.OnScrollToTop
                .Subscribe(_ => Webview.InvokeScriptAsync("eval", new[] { "window.scrollTo(0,0);" }))
                .DisposeWith(disposable);

                ViewModel.RenderContent.Execute(Unit.Default)
                .Subscribe(DisplayPage)
                .DisposeWith(disposable);

                Webview.Events().NavigationStarting
                .Select(a => a.args)
                .Subscribe(WebViewNavigationStarting)
                .DisposeWith(disposable);

                Webview.Events().ScriptNotify
                .Select(x => KeyboardShortcutConverter.Parse(x.Value))
                .InvokeCommand(ViewModel, x => x.KeyPressed)
                .DisposeWith(disposable);

                Webview.Events().UnsupportedUriSchemeIdentified
                .Select(a => a.args)
                .Subscribe(WebViewUnsupportedUriSchemeIdentified)
                .DisposeWith(disposable);

                Webview.Events().ContainsFullScreenElementChanged
                .Select(_ => Unit.Default)
                .Subscribe(x => WebView_OnContainsFullscreenElementChanged())
                .DisposeWith(disposable);
            });
        }
Пример #4
0
 public void OpenWebviewPopup(string url)
 {
     Webview.Show();
     Webview.Open(url);
 }
Пример #5
0
 public void OpenWebviewPopup(GithubAuthenticationData data)
 {
     Webview.Show();
     Webview.Open(data);
 }
Пример #6
0
 public itinerary()
 {
     InitializeComponent();
     Webview.Reload();
     Webview.Source = "https://mm-app.co.za/itinerary/";
 }
        private void ComputeWebView(string url)
        {
            Uri feedUri = new Uri(url, UriKind.Absolute);

            Webview.Navigate(feedUri);
        }
        private void Webview_NewWindowRequested(WebView sender, WebViewNewWindowRequestedEventArgs e)
        {
            Webview.Navigate(e.Uri);

            e.Handled = true;
        }
Пример #9
0
 private void PerformFakeAction(string obj)
 {
     Webview.InjectJavascriptAsync("returnValue = \"NewReturnValue\";").ConfigureAwait(false);
 }
Пример #10
0
        private void UpdateLocation(string latitud, string longitud)
        {
            string method = "updateMarker(" + latitud + ", " + longitud + ")";

            Webview.InjectJavascriptAsync(method);
        }