Exemplo n.º 1
0
		public override void RunStarted(object automationObject, Dictionary<string, string> replacementsDictionary, WizardRunKind runKind, object[] customParams)
		{
			var doc = Helpers.LoadWizardXml(replacementsDictionary);
			var ns = Helpers.WizardNamespace;

			var model = new OptionsPageModel(doc.Root.Elements(ns + "Options").FirstOrDefault());

			var view = new OptionsPageView(model);
			var dialog = new BaseDialog { Content = view, Title = model.Title };
			if (dialog.ShowModal(Helpers.MainWindow))
			{
				foreach (var option in model.Options)
				{
					var selected = option.Selected;
					if (selected != null)
					{
						foreach (var replacement in selected.Replacements)
						{
							if (replacementsDictionary.MatchesCondition(replacement.Condition))
							{
								replacementsDictionary[replacement.Name] = replacement.Content;
							}
						}
					}
				}
			}
			else
				throw new WizardBackoutException();
			
		}
Exemplo n.º 2
0
		public OptionsPageView(OptionsPageModel model)
		{
			var layout = new DynamicLayout();

			var infoLayout = new StackLayout { Spacing = 10 };

			foreach (var option in model.Options)
			{
				var currentOption = option;
				option.Selected = option.Values.FirstOrDefault();
                var infoLabel = new Label { Text = option.Selected?.Description };
				infoLayout.Items.Add(infoLabel);

                layout.Add(new Label { Text = option.Name });
				layout.BeginVertical();
				layout.BeginHorizontal();

				layout.Add(new Panel { Size = new Size(40, -1) }, xscale: false);

				var radioList = new RadioButtonList();
				radioList.Orientation = Orientation.Vertical;
				radioList.ItemTextBinding = Binding.Property((OptionValue v) => v.Name);
				radioList.DataStore = option.Values;
				radioList.SelectedValueChanged += (sender, e) =>
				{
					currentOption.Selected = radioList.SelectedValue as OptionValue;
					infoLabel.Text = currentOption.Selected?.Description;
				};
				radioList.SelectedIndex = 0;
				layout.Add(radioList);

				layout.EndHorizontal();
				layout.EndVertical();
			}

			Information = infoLayout;
            Content = layout;
		}