Beispiel #1
0
        void AddSingleOptionCheckbox(OptionCombo option)
        {
            if (option.Items.Count != 1)
            {
                throw new InvalidOperationException();
            }

            option.Check = new CheckButton(option.Items[0].Name);

            option.Check.Toggled += (sender, e) => {
                TargetFrameworkChanged(option);
            };

            option.Check.Show();

            var alignment = new Alignment(0.0f, 0.5f, 1.0f, 1.0f)
            {
                LeftPadding  = 18,
                RightPadding = 18
            };

            alignment.Add(option.Check);
            alignment.Show();

            VBox.PackStart(alignment, false, true, 0);
        }
Beispiel #2
0
        void TargetFrameworkChanged(OptionCombo option)
        {
            if (disableEvents)
            {
                return;
            }

            try {
                disableEvents = true;
                TargetFrameworkChanged_internal(option);
            } finally {
                disableEvents = false;
            }
        }
Beispiel #3
0
        void TargetFrameworkChanged_internal(OptionCombo option)
        {
            ClearWarnings();
            selectorCombo.Active = -1;

            // The currently selected combo boxes.
            var selectedOptions = options.Where(o => o.Check.Active).ToList();

            if (selectedOptions.Count < 2)
            {
                SetWarning(GettextCatalog.GetString("Need to select at least two frameworks."));
                return;
            }

            // SupportedFramework from each of the currently selected combo boxes.
            var selectedFrameworks = selectedOptions.Select(s => s.Current.Framework).ToList();

            SelectFrameworks(selectedFrameworks);
        }
Beispiel #4
0
        public PortableRuntimeSelectorDialog(TargetFramework initialTarget)
        {
            this.Title = GettextCatalog.GetString("Change Targets");

            this.AddActionWidget(new Button(Stock.Cancel), ResponseType.Cancel);
            this.AddActionWidget(new Button(Stock.Ok), ResponseType.Ok);
            this.ActionArea.ShowAll();

            this.TargetFramework = initialTarget;

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

            if (!targetFrameworks.Contains(TargetFramework))
            {
                missingFramework = TargetFramework;
                targetFrameworks.Insert(0, 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);
                    }
                }

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

                options.Add(combo);
            }

            CreateUI();

            CurrentProfileChanged(TargetFramework);
        }
Beispiel #5
0
        void AddMultiOptionCombo(OptionCombo option)
        {
            if (option.Items.Count < 2)
            {
                throw new InvalidOperationException();
            }

            var model    = new ListStore(new Type[] { typeof(string), typeof(object) });
            var renderer = new CellRendererText();

            foreach (var item in option.Items)
            {
                var label = item.Name;
                var sfx   = item.Framework;

                bool hasOtherVersions = false;
                foreach (var other in option.Items)
                {
                    if (sfx == other.Framework)
                    {
                        continue;
                    }
                    if (!string.IsNullOrEmpty(other.Framework.MonoSpecificVersionDisplayName))
                    {
                        continue;
                    }
                    hasOtherVersions = true;
                    break;
                }

                if (hasOtherVersions && string.IsNullOrEmpty(sfx.MonoSpecificVersionDisplayName))
                {
                    label += " or later";
                }

                model.AppendValues(label);
            }

            option.Combo = new ComboBox(model);
            option.Check = new CheckButton();

            option.Combo.PackStart(renderer, true);
            option.Combo.AddAttribute(renderer, "text", 0);

            option.Combo.Active = 0;

            option.Check.Show();
            option.Combo.Show();

            option.Combo.Changed += (sender, e) => {
                if (option.Check.Active)
                {
                    TargetFrameworkChanged(option);
                }
            };
            option.Check.Toggled += (sender, e) => {
                TargetFrameworkChanged(option);
            };

            var hbox = new HBox();

            hbox.PackStart(option.Check, false, false, 0);
            hbox.PackStart(option.Combo, true, true, 0);
            hbox.Show();

            var alignment = new Alignment(0.0f, 0.5f, 1.0f, 1.0f)
            {
                LeftPadding  = 18,
                RightPadding = 18
            };

            alignment.Add(hbox);
            alignment.Show();

            VBox.PackStart(alignment, false, true, 0);
        }
		void TargetFrameworkChanged_internal (OptionCombo option)
		{
			ClearWarnings ();
			selectorCombo.Active = -1;

			// The currently selected combo boxes.
			var selectedOptions = options.Where (o => o.Check.Active).ToList ();

			if (selectedOptions.Count < 2) {
				SetWarning ("Need to select at least two frameworks.");
				return;
			}

			// SupportedFramework from each of the currently selected combo boxes.
			var selectedFrameworks = selectedOptions.Select (s => s.Current.Framework).ToList ();
			SelectFrameworks (selectedFrameworks);
		}
Beispiel #7
0
        public PortableRuntimeOptionsPanelWidget(DotNetProject 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);
        }
		void TargetFrameworkChanged (OptionCombo option)
		{
			if (disableEvents)
				return;

			try {
				disableEvents = true;
				TargetFrameworkChanged_internal (option);
			} finally {
				disableEvents = false;
			}
		}
		void AddSingleOptionCheckbox (OptionCombo option)
		{
			if (option.Items.Count != 1)
				throw new InvalidOperationException ();

			option.Check = new CheckButton (option.Items [0].Name);

			option.Check.Toggled += (sender, e) => {
				TargetFrameworkChanged (option);
			};

			option.Check.Show ();

			var alignment = new Alignment (0.0f, 0.5f, 1.0f, 1.0f) {
				LeftPadding = 18, RightPadding = 18
			};
			alignment.Add (option.Check);
			alignment.Show ();

			vbox1.PackStart (alignment, false, true, 0);
		}
		void AddMultiOptionCombo (OptionCombo option)
		{
			if (option.Items.Count < 2)
				throw new InvalidOperationException ();

			var model = new ListStore (new Type[] { typeof (string), typeof (object) });
			var renderer = new CellRendererText ();

			foreach (var item in option.Items) {
				var label = item.Name;
				var sfx = item.Framework;

				bool hasOtherVersions = false;
				foreach (var other in option.Items) {
					if (sfx == other.Framework)
						continue;
					if (!string.IsNullOrEmpty (other.Framework.MonoSpecificVersionDisplayName))
						continue;
					hasOtherVersions = true;
					break;
				}

				if (hasOtherVersions && string.IsNullOrEmpty (sfx.MonoSpecificVersionDisplayName))
					label += " or later";

				model.AppendValues (label, item.Targets);
			}

			option.Combo = new ComboBox (model);
			option.Check = new CheckButton ();

			option.Combo.PackStart (renderer, true);
			option.Combo.AddAttribute (renderer, "text", 0);

			option.Combo.Active = 0;

			option.Check.Show ();
			option.Combo.Show ();

			option.Combo.Changed += (sender, e) => {
				if (option.Check.Active)
					TargetFrameworkChanged (option);
			};
			option.Check.Toggled += (sender, e) => {
				TargetFrameworkChanged (option);
			};

			var hbox = new HBox ();
			hbox.PackStart (option.Check, false, false, 0);
			hbox.PackStart (option.Combo, true, true, 0);
			hbox.Show ();

			var alignment = new Alignment (0.0f, 0.5f, 1.0f, 1.0f) {
				LeftPadding = 18, RightPadding = 18
			};
			alignment.Add (hbox);
			alignment.Show ();

			vbox1.PackStart (alignment, false, true, 0);
		}
		public PortableRuntimeOptionsPanelWidget (DotNetProject 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 PortableRuntimeSelectorDialog (TargetFramework initialTarget)
		{
			this.Title = GettextCatalog.GetString ("Change Targets");

			this.AddActionWidget (new Button (Stock.Cancel), ResponseType.Cancel);
			this.AddActionWidget (new Button (Stock.Ok), ResponseType.Ok);
			this.ActionArea.ShowAll ();

			this.TargetFramework = initialTarget;

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

			if (!targetFrameworks.Contains (TargetFramework)) {
				missingFramework = TargetFramework;
				targetFrameworks.Insert (0, 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 (TargetFramework);
		}