protected override ProjectRunConfiguration OnCreateRunConfiguration(string name) { InitLaunchSettingsProvider(); if (aspNetCoreRunConfs.TryGetValue(name, out var aspNetCoreRunConfiguration)) { return(aspNetCoreRunConfiguration); } var profile = new LaunchProfileData(); var key = name != "Default" ? name : this.Project.DefaultNamespace; if (!launchProfileProvider.Profiles.TryGetValue(key, out var _)) { profile = launchProfileProvider.AddNewProfile(key); launchProfileProvider.Profiles [key] = profile; } else { profile = launchProfileProvider.Profiles [key]; } var aspnetconf = new AspNetCoreRunConfiguration(name, profile); aspnetconf.LaunchProfileProvider = launchProfileProvider; aspnetconf.SaveRequested += Aspnetconf_Save; aspNetCoreRunConfs.Add(name, aspnetconf); return(aspnetconf); }
/// <summary> /// Updates Project.RunConfigurations /// </summary> internal void SyncRunConfigurations() { foreach (var profile in this.Profiles) { if (profile.Value.CommandName != "Project") { continue; } var key = string.Empty; if (profile.Key == project.DefaultNamespace) { key = "Default"; } else { key = profile.Key; } var runConfig = project.RunConfigurations.FirstOrDefault(x => x.Name == key); if (runConfig == null) { var projectRunConfiguration = new AspNetCoreRunConfiguration(key, profile.Value) { StartAction = "Project", StoreInUserFile = false }; project.RunConfigurations.Add(projectRunConfiguration); } else if (runConfig is AspNetCoreRunConfiguration aspNetCoreRunConfiguration) { var index = project.RunConfigurations.IndexOf(runConfig); aspNetCoreRunConfiguration.UpdateProfile(profile.Value); project.RunConfigurations [index] = runConfig; } } var itemsRemoved = new RunConfigurationCollection(); foreach (var config in project.RunConfigurations) { var key = config.Name; if (config.Name == "Default") { key = project.DefaultNamespace; } if (Profiles.TryGetValue(key, out var _)) { continue; } itemsRemoved.Add(config); } project.RunConfigurations.RemoveRange(itemsRemoved); }
protected override ProjectRunConfiguration OnCreateRunConfiguration(string name) { if (aspNetCoreRunConf == null) { aspNetCoreRunConf = new AspNetCoreRunConfiguration(name, this.Project); } return(aspNetCoreRunConf); }
protected override ProjectRunConfiguration OnCreateRunConfiguration(string name) { InitLaunchSettingsProvider(); if (aspNetCoreRunConfs.TryGetValue(name, out var aspNetCoreRunConfiguration)) { return(aspNetCoreRunConfiguration); } var profile = new LaunchProfileData(); var key = name != "Default" ? name : this.Project.DefaultNamespace; if (!launchProfileProvider.Profiles.TryGetValue(key, out var _)) { profile = launchProfileProvider.AddNewProfile(key); launchProfileProvider.Profiles [key] = profile; } else { profile = launchProfileProvider.Profiles [key]; } var aspnetconf = new AspNetCoreRunConfiguration(name, profile) { LaunchProfileProvider = launchProfileProvider }; if (aspNetCoreRunConfs.TryGetValue(name, out var existingConf)) { // This can be called a few times with the same config at load time, // so make sure we clean up the previous version existingConf.SaveRequested -= Aspnetconf_Save; } aspnetconf.SaveRequested += Aspnetconf_Save; aspNetCoreRunConfs [name] = aspnetconf; return(aspnetconf); }
public void LoadCore(Project project, AspNetCoreRunConfiguration config) { this.config = config; base.Load(project, config); var mainBox = new VBox(); mainBox.Margin = 24; var appUrlTable = new Table(); appUrlTable.Add(new Label(GettextCatalog.GetString("App URL:")), 0, 0); var applicationUrlBox = new HBox(); applicationUrlWarningTooltip = new XwtBoxTooltip(new Xwt.ImageView(ImageService.GetIcon(Ide.Gui.Stock.Warning, Gtk.IconSize.Menu))) { ToolTip = GettextCatalog.GetString("Invalid URL"), Severity = Ide.Tasks.TaskSeverity.Warning }; applicationUrlBox.PackStart(applicationUrl = new TextEntry(), true, true); applicationUrlBox.PackStart(applicationUrlWarningTooltip); appUrlTable.Add(applicationUrlBox, 1, 0, hexpand: true); appUrlTable.Add(new Label(GettextCatalog.GetString("Where your app should listen for connections")) { Sensitive = false }, 1, 1, hexpand: true); mainBox.PackStart(appUrlTable); mainBox.PackStart(launchBrowser = new CheckBox(GettextCatalog.GetString("Open URL in web browser when app starts:")), marginTop: 16); var browserTable = new Table(); browserTable.MarginLeft = 16; var offset = 0; //offset = 1; // just so uncommenting Browser Combobox works as expected //browserTable.Add (new Label (GettextCatalog.GetString ("Web Browser:")), 0, 0, hpos: WidgetPlacement.End); //var browsersCombobox = new ComboBox (); //browsersCombobox.Items.Add ("Chrome"); //browsersCombobox.Items.Add ("Firefox"); //browsersCombobox.Items.Add ("Opera"); //browsersCombobox.Items.Add ("Safari"); //browserTable.Add (browsersCombobox, 1, 0, hpos: WidgetPlacement.Start); browserTable.Add(launchUrl = new TextEntry(), 1, offset, hexpand: true); browserTable.Add(new Label(GettextCatalog.GetString("URL:")), 0, offset, hpos: WidgetPlacement.End); browserTable.Add(new Label(GettextCatalog.GetString("Absolute or relative to App URL")) { Sensitive = false }, 1, offset + 1); mainBox.PackStart(browserTable); Add(mainBox, GettextCatalog.GetString("ASP.NET Core")); launchBrowser.Active = config.LaunchBrowser; launchUrl.Text = config.LaunchUrl; applicationUrl.Text = config.ApplicationURL; UpdateUI(); launchBrowser.Toggled += delegate { NotifyChanged(); UpdateUI(); }; launchUrl.Changed += delegate { NotifyChanged(); }; applicationUrl.Changed += delegate { NotifyChanged(); UpdateUI(); }; }