Esempio n. 1
0
        private void Configure(object parameter)
        {
            // need a host in the visual tree for our dialog boxes, so it is passed as the parameter
            InstallationDialogs installationDialogs = new InstallationDialogs((IInputElement)parameter);

            // gather information about warnings and get consent to install anyway, if applicable
            List <StatusReportItem> items = new List <StatusReportItem>();
            List <string>           lines = new List <string>();

            foreach (ViewportSetupFileViewModel model in CombinedMonitorSetup.Combined)
            {
                items.AddRange(GatherWarnings(model)
                               .Where(i => i.Severity >= StatusReportItem.SeverityCode.Warning));
            }

            if (items.Count > 0)
            {
                // need a header
                lines.Add("Problems will exist in the combined Monitor Setup 'Helios'");
                lines.Add("");
            }

            if (!Data.GenerateCombined)
            {
                IList <StatusReportItem> currentItems = GatherWarnings(CombinedMonitorSetup.CurrentViewportSetup)
                                                        .Where(i => i.Severity >= StatusReportItem.SeverityCode.Warning)
                                                        .ToList();
                if (currentItems.Any())
                {
                    lines.Add("Problems will exist in the separate Monitor Setup for this Profile");
                    lines.Add("");
                    items.AddRange(currentItems);
                }
            }

            if (items.Any())
            {
                string extraText = "";
                if (items.Any(i => !i.Flags.HasFlag(StatusReportItem.StatusFlags.ConfigurationUpToDate)))
                {
                    extraText = "  The Monitor Setup may work but it will be considered out of date until you resolve these problems, so Profile Editor will continue to prompt you to generate it again.";
                }
                lines.Add($"You can generate the Monitor Setup anyway and just use it with those limitations.{extraText}");

                // present
                InstallationPromptResult result = installationDialogs.DangerPrompt("Incomplete Monitor Setup",
                                                                                   string.Join(Environment.NewLine, lines),
                                                                                   items);
                if (result == InstallationPromptResult.Cancel)
                {
                    // don't do it
                    return;
                }
            }

            // install
            Data.Install(installationDialogs);
        }
 public AdditionalViewportsEditor()
 {
     InitializeComponent();
     _installationDialogs = new InstallationDialogs(this);
 }