public override void Finish() { if (currentSamplePage != null) { currentSamplePage.Destroy(); currentSamplePage = null; } base.Finish(); }
public void OnBackButtonPressed() { if (currentSamplePage != null) { currentSamplePage.Destroy(); currentSamplePage = null; } Finish(); base.OnBackPressed(); }
void RefreshSample(Sample selectedSample) { FrameLayout layout = (FrameLayout)FindViewById(Resource.Id.samplearea); layout.SetPadding(5, 5, 5, 5); layout.SetBackgroundColor(Color.White); selectedPageSample = selectedSample; ImageView settingsImage = (ImageView)FindViewById(Resource.Id.settings); if (propertyIndent != null && propertyWindow != null) { propertyWindow.Finish(); } if (sample != null) { sample.Destroy(); } propertyIndent = new Intent(this, typeof(PropertyWindow)); TextView textView = (TextView)FindViewById(Resource.Id.title_text); textView.Text = selectedSample.Title; RelativeLayout settingButton = (RelativeLayout)FindViewById(Resource.Id.settingsParent); RelativeLayout textParent = (RelativeLayout)FindViewById(Resource.Id.textParent); textParent.Click += (object sender, EventArgs e) => { OnBackButtonPressed(); }; bool isClassExists = Type.GetType("SampleBrowser." + selectedSample.Name) != null; if (isClassExists) { var handle = Activator.CreateInstance(null, "SampleBrowser." + selectedSample.Name); sample = (SamplePage)handle.Unwrap(); layout.RemoveAllViews(); layout.AddView(sample.GetSampleContent(this)); if (sample.GetPropertyWindowLayout(this) == null) { settingsImage.Visibility = ViewStates.Invisible; settingButton.Clickable = false; } else { settingsImage.Visibility = ViewStates.Visible; settingButton.Clickable = true; } } }