示例#1
0
        public void SetSample(SampleBase newSample)
        {
            // clean up the old sample
            if (sample != null)
            {
                sample.RefreshRequested -= OnRefreshRequested;
                sample.Destroy();
            }

            sample = newSample;

            // set the title
            var title = sample?.Title ?? "SkiaSharp for MacOS";

            Title = title;
            var window = View?.Window;

            if (window != null)
            {
                window.Title = title;
            }

            // prepare the sample
            if (sample != null)
            {
                sample.RefreshRequested += OnRefreshRequested;
                sample.Init();
            }

            // refresh the view
            OnRefreshRequested(null, null);
        }
示例#2
0
        private void SetSample(SampleBase newSample)
        {
            // clean up the old sample
            if (sample != null)
            {
                sample.RefreshRequested -= OnRefreshRequested;
                sample.Destroy();
            }

            sample = newSample;

            var runtimeMode = string.Empty;

#if __WASM__
            runtimeMode = Environment.GetEnvironmentVariable("UNO_BOOTSTRAP_MONO_RUNTIME_MODE");
            if (runtimeMode.Equals("Interpreter", StringComparison.InvariantCultureIgnoreCase))
            {
                runtimeMode = " (Interpreted)";
            }
            else if (runtimeMode.Equals("FullAOT", StringComparison.InvariantCultureIgnoreCase))
            {
                runtimeMode = " (AOT)";
            }
            else if (runtimeMode.Equals("InterpreterAndAOT", StringComparison.InvariantCultureIgnoreCase))
            {
                runtimeMode = " (Mixed)";
            }
#endif

            // set the title
            titleBar.Text = (sample?.Title ?? $"SkiaSharp for Uno Platform") + runtimeMode;

            // prepare the sample
            if (sample != null)
            {
                sample.RefreshRequested += OnRefreshRequested;
                sample.Init();
            }

            // refresh the view
            OnRefreshRequested(null, null);
        }
示例#3
0
        private void OnSampleSelected(SampleBase sample)
        {
            // clean up the old sample
            if (currentSample != null)
            {
                currentSample.RefreshRequested -= OnRefreshRequested;
                currentSample.Destroy();
            }

            // update the selected sample
            currentSample = sample;

            // prepare the sample
            if (sample != null)
            {
                sample.RefreshRequested += OnRefreshRequested;
                sample.Init();
            }

            // refresh the view
            OnRefreshRequested(null, null);
        }
示例#4
0
        private void SetSample(SampleBase newSample)
        {
            // clean up the old sample
            if (sample != null)
            {
                sample.RefreshRequested -= OnRefreshRequested;
                sample.Destroy();
            }

            sample = newSample;

            // set the title
            Title = sample?.Title ?? "SkiaSharp for WPF";

            // prepare the sample
            if (sample != null)
            {
                sample.RefreshRequested += OnRefreshRequested;
                sample.Init();
            }

            // refresh the view
            OnRefreshRequested(null, null);
        }