private void rbtn_Toggled(object sender, EventArgs e) { RadioButton rbtn = (RadioButton)sender; if (!rbtn.Active) { return; } algImage.DestroyChild(); PurposeBase purpose = rbtn.Data ["PurposeBase"] as PurposeBase; if (purpose == null) { return; } Image img = purpose.Image; if (img == null) { return; } img.Show(); algImage.Add(img); }
protected override void CreateBody() { CreateBody(Translator.GetString("What is the main purpose of this workstation?")); List <PurposeBase> allPurposes = new List <PurposeBase> (); foreach (TypeExtensionNode node in AddinManager.GetExtensionNodes("/Warehouse/Presentation/SetupAssistant/Purpose")) { object instance = node.CreateInstance(); PurposeBase purpose = instance as PurposeBase; if (purpose != null) { allPurposes.Add(purpose); } } allPurposes.Sort((p1, p2) => Math.Max(-1, Math.Min(1, p1.Ordinal - p2.Ordinal))); HBox hbo = new HBox(); hbo.Show(); vboBody.PackStart(hbo, true, true, 6); VBox vbo = new VBox(); vbo.Show(); hbo.PackStart(vbo, true, true, 4); algImage = new Alignment(.5f, .5f, 1f, 1f) { WidthRequest = 220 }; algImage.Show(); hbo.PackStart(algImage, false, true, 4); RadioButton group = null; bool activeSet = false; foreach (PurposeBase purpose in allPurposes) { Widget rbtn = purpose.GetSelectionWidget(ref group); rbtn.Show(); purpose.Toggled += rbtn_Toggled; vbo.PackStart(rbtn, false, true, 4); choices.Add(purpose); if (activeSet) { continue; } activeSet = true; purpose.Active = true; rbtn_Toggled(rbtn, EventArgs.Empty); } WrapLabel footer = new WrapLabel { Markup = string.Format(Translator.GetString( "The selection here will determine the content displayed when {1} is started. To change this later please go to:{0}{2}"), Environment.NewLine, DataHelper.ProductName, new PangoStyle { Italic = true, Bold = true, Text = Translator.GetString("Other->Settings->Special->Startup->Startup page") }) }; footer.Show(); vboBody.PackStart(footer, true, true, 4); }