void ParseXML() { XmlReader xtr =Resources.GetXml (Resource.Xml.samplelist); xtr.Read(); while (!xtr.EOF) { List<SampleBase> groups = new List<SampleBase> (); xtr.Read (); if (xtr.Name == "Samples" && !xtr.IsStartElement()) break; bool isGroup = false; while (!isGroup) { if (xtr.Name == "Group" && xtr.IsStartElement ()) { Group group = new Group (); SetSample (group, xtr); xtr.Read (); List<SampleBase> samples = new List<SampleBase>(); bool isSample = false; while (!isSample) { if (xtr.Name == "Sample" && xtr.IsStartElement ()) { Sample tc = new Sample (); SetSample (tc, xtr); samples.Add (tc); xtr.Read (); xtr.Read (); if (xtr.Name == "Group" && !xtr.IsStartElement ()) { isSample = true; xtr.Read (); group.samples = samples; groups.Add (group); } } else if (xtr.Name == "Group" && !xtr.IsStartElement ()) { isSample = true; xtr.Read (); groups.Add (group); } } if (xtr.Name == "Samples" && !xtr.IsStartElement()) { isGroup = true; xtr.Read(); } } } xtr.Read(); this.aSamples = groups; } xtr.Close(); }
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; } } }