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); }
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); }
private void SetSample(SampleBase newSample) { // clean up the old sample if (sample != null) { sample.RefreshRequested -= OnRefreshRequested; sample.Destroy(); } sample = newSample; // set the title titleBar.Text = sample?.Title ?? "SkiaSharp for Windows"; // prepare the sample if (sample != null) { sample.RefreshRequested += OnRefreshRequested; sample.Init(); } // refresh the view OnRefreshRequested(null, null); }