Ejemplo n.º 1
0
        public PortableRuntimeOptionsPanelWidget(PortableDotNetProject project, IEnumerable <ItemConfiguration> configurations)
        {
            this.project = project;
            this.Build();

            SortedDictionary <string, List <Framework> > options = new SortedDictionary <string, List <Framework> > ();

            foreach (var fx in Runtime.SystemAssemblyService.GetTargetFrameworks())
            {
                if (fx.Hidden || fx.Id.Identifier != ".NETPortable" || !project.TargetRuntime.IsInstalled(fx))
                {
                    continue;
                }

                foreach (var sfx in fx.SupportedFrameworks)
                {
                    List <Framework> list;

                    if (!options.TryGetValue(sfx.DisplayName, out list))
                    {
                        list = new List <Framework> ();
                        options.Add(sfx.DisplayName, list);
                    }

                    list.Add(sfx);
                }
            }

            foreach (var opt in options)
            {
                var alignment = new Alignment(0.0f, 0.5f, 1.0f, 1.0f)
                {
                    LeftPadding = 18
                };
                List <Framework> versions = opt.Value;
                CheckButton      check;

                // FIXME: VS11 introduces comboboxes for some of these... which I suspect will need to sort based on version
                //versions.Sort (CompareFrameworksByVersion);
                check           = new CheckButton(versions[0].DisplayName + " " + versions[0].MinimumVersionDisplayName);
                check.Sensitive = false;                 // Desensitize until we support changing these values...
                foreach (var ver in versions)
                {
                    if (ver.TargetFramework == project.TargetFramework)
                    {
                        check.Active = true;
                        break;
                    }
                }
                check.Show();

                alignment.Add(check);
                alignment.Show();

                vbox1.PackStart(alignment, false, false, 0);
            }
        }
 public PortableFrameworkSubset(PortableDotNetProject project)
 {
     this.Project = project;
 }
        public PortableRuntimeOptionsPanelWidget(PortableDotNetProject project, IEnumerable <ItemConfiguration> configurations)
        {
            this.target  = project.TargetFramework;
            this.project = project;
            this.Build();

            // Aggregate all SupportedFrameworks from .NETPortable TargetFrameworks
            targetFrameworks = GetPortableTargetFrameworks().ToList();
            targetFrameworks.Sort(CompareFrameworks);
            supportedFrameworks = new SortedDictionary <string, List <SupportedFramework> > ();

            if (!targetFrameworks.Contains(project.TargetFramework))
            {
                missingFramework = project.TargetFramework;
                targetFrameworks.Insert(0, project.TargetFramework);
            }

            foreach (var fx in targetFrameworks)
            {
                foreach (var sfx in fx.SupportedFrameworks)
                {
                    List <SupportedFramework> list;

                    if (!supportedFrameworks.TryGetValue(sfx.DisplayName, out list))
                    {
                        list = new List <SupportedFramework> ();
                        supportedFrameworks.Add(sfx.DisplayName, list);
                    }

                    list.Add(sfx);
                }
            }

            // Now create a list of config options from our supported frameworks
            options = new List <OptionCombo> ();
            foreach (var fx in supportedFrameworks)
            {
                var combo = new OptionCombo(fx.Key);

                var dict = new SortedDictionary <string, OptionComboItem> ();
                foreach (var sfx in fx.Value)
                {
                    var label = GetDisplayName(sfx);

                    OptionComboItem item;
                    if (!dict.TryGetValue(label, out item))
                    {
                        item = new OptionComboItem(label, sfx);
                        dict.Add(label, item);
                    }

                    item.Targets.Add(sfx.TargetFramework);
                }

                combo.Items = dict.Values.ToList();

                options.Add(combo);
            }

            CreateUI();

            CurrentProfileChanged(project.TargetFramework);
        }
        public PortableRuntimeOptionsPanelWidget(PortableDotNetProject project, IEnumerable <ItemConfiguration> configurations)
        {
            this.target  = project.TargetFramework;
            this.project = project;
            this.Build();

            // Aggregate all SupportedFrameworks from .NETPortable TargetFrameworks
            SortedDictionary <string, List <SupportedFramework> > frameworks = new SortedDictionary <string, List <SupportedFramework> > ();

            foreach (var fx in GetPortableTargetFrameworks())
            {
                foreach (var sfx in fx.SupportedFrameworks)
                {
                    List <SupportedFramework> list;

                    if (!frameworks.TryGetValue(sfx.DisplayName, out list))
                    {
                        list = new List <SupportedFramework> ();
                        frameworks.Add(sfx.DisplayName, list);
                    }

                    list.Add(sfx);
                }
            }

            // Now create a list of config options from our supported frameworks
            var options = new List <SortedDictionary <string, List <TargetFramework> > > ();

            foreach (var fx in frameworks)
            {
                var dict = new SortedDictionary <string, List <TargetFramework> > ();
                List <SupportedFramework> versions = fx.Value;
                List <TargetFramework>    targets;
                string label;

                foreach (var sfx in versions)
                {
                    if (!string.IsNullOrEmpty(sfx.MinimumVersionDisplayName))
                    {
                        label = sfx.DisplayName + " " + sfx.MinimumVersionDisplayName;
                    }
                    else
                    {
                        label = sfx.DisplayName;
                    }

                    if (!dict.TryGetValue(label, out targets))
                    {
                        targets = new List <TargetFramework> ();
                        dict.Add(label, targets);
                    }

                    targets.Add(sfx.TargetFramework);
                }

                options.Add(dict);
            }

            // Add multi-option combo boxes first
            foreach (var opt in options)
            {
                if (opt.Count > 1)
                {
                    AddMultiOptionCombo(opt);
                }
            }

            // Now add the single-option check boxes
            foreach (var opt in options)
            {
                if (opt.Count == 1)
                {
                    var kvp = opt.FirstOrDefault();

                    AddSingleOptionCheckbox(kvp.Key, kvp.Value);
                }
            }
        }