public DependencyWidget (IConnectedService service, IConnectedServiceDependency dependency)
		{
			Dependency = dependency;
			Service = service;

			iconView = new ImageView (dependency.Icon.WithSize (Xwt.IconSize.Small));
			nameLabel = new Label (dependency.DisplayName);

			statusIconView = new ImageView ();
			statusLabel = new Label ();
			statusLabel.LinkClicked += (sender, e) => {
				if (dependency.Status == Status.NotAdded)
					dependency.AddToProject (CancellationToken.None);
				e.SetHandled ();
			};

			container = new HBox ();
			container.PackStart (iconView);
			container.PackStart (nameLabel);
			container.PackStart (statusIconView);
			container.PackStart (statusLabel);

			Content = container;
			Update ();

			dependency.StatusChanged += HandleDependencyStatusChange;
			service.StatusChanged += HandleServiceStatusChanged;
		}
        void HandleServiceAddedRemoved(IConnectedService service)
        {
            //TODO: sort the lists
            Runtime.RunInMainThread(delegate {
                if (service.Status == Status.Added)
                {
                    foreach (var widget in availableList.Children.Where((c) => c is ServiceWidget).Cast <ServiceWidget> ())
                    {
                        if (widget.Service == service)
                        {
                            availableList.Remove(widget);
                            enabledList.PackStart(widget);
                            break;
                        }
                    }
                }
                else
                {
                    foreach (var widget in enabledList.Children.Where((c) => c is ServiceWidget).Cast <ServiceWidget> ())
                    {
                        if (widget.Service == service)
                        {
                            enabledList.Remove(widget);
                            availableList.PackStart(widget);
                            break;
                        }
                    }
                }

                enabledLabel.Visible   = services.Any(s => s.Status == Status.Added);
                availableLabel.Visible = services.Any(s => s.Status == Status.NotAdded);
            });
        }
Example #3
0
        public DependencyWidget(IConnectedService service, IConnectedServiceDependency dependency)
        {
            Dependency = dependency;
            Service    = service;

            iconView  = new ImageView(dependency.Icon.WithSize(Xwt.IconSize.Small));
            nameLabel = new Label(dependency.DisplayName);

            statusIconView           = new ImageView();
            statusLabel              = new Label();
            statusLabel.LinkClicked += (sender, e) => {
                if (dependency.Status == Status.NotAdded)
                {
                    dependency.AddToProject(CancellationToken.None);
                }
                e.SetHandled();
            };

            container = new HBox();
            container.PackStart(iconView);
            container.PackStart(nameLabel);
            container.PackStart(statusIconView);
            container.PackStart(statusLabel);

            Content = container;
            Update();

            dependency.StatusChanged += HandleDependencyStatusChange;
            service.StatusChanged    += HandleServiceStatusChanged;
        }
Example #4
0
 public ServiceWidget(IConnectedService service, bool showDetails = false) : this(showDetails)
 {
     if (service == null)
     {
         throw new ArgumentNullException(nameof(service));
     }
     Service = service;
 }
Example #5
0
		protected CodeDependency (IConnectedService service, string displayName, string [] lookupTypes) : base (service, ConnectedServiceDependency.CodeDependencyCategory, displayName)
		{
			this.lookupTypes = new Dictionary<string, INamedTypeSymbol> ();

			foreach (var type in lookupTypes) {
				this.lookupTypes [type] = null;
			}
		}
Example #6
0
 protected override void Dispose(bool disposing)
 {
     if (service != null)
     {
         service.StatusChanged -= HandleServiceStatusChanged;
         service = null;
     }
     base.Dispose(disposing);
 }
Example #7
0
        async void AddSelectedServices(IConnectedService service, List <IConnectedService> others)
        {
            await service.AddToProject();

            foreach (var svc in others)
            {
                await svc.AddToProject();
            }
        }
Example #8
0
        /// <summary>
        /// Displays the service details tab for the given service
        /// </summary>
        public static Task OpenServicesTab(this IConnectedService service)
        {
            if (service == null)
            {
                throw new ArgumentNullException(nameof(service));
            }

            return(Runtime.RunInMainThread(() => OpenServicesTab(service.Project, service.Id)));
        }
Example #9
0
        protected CodeDependency(IConnectedService service, string displayName, string [] lookupTypes) : base(service, ConnectedServiceDependency.CodeDependencyCategory, displayName)
        {
            this.lookupTypes = new Dictionary <string, INamedTypeSymbol> ();

            foreach (var type in lookupTypes)
            {
                this.lookupTypes [type] = null;
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="T:MonoDevelop.ConnectedServices.GroupedCodeDependency"/> class.
        /// </summary>
        public GroupedCodeDependency(IConnectedService service, string displayName, GroupedDependencyKind kind, params ConnectedServiceDependency[] dependencies) : base(service, ConnectedServiceDependency.CodeDependencyCategory, displayName)
        {
            if (dependencies.Any(x => x.Category != ConnectedServiceDependency.CodeDependencyCategory))
            {
                throw new ArgumentException("All dependencies in a group must be Code dependencies", nameof(dependencies));
            }

            this.kind         = kind;
            this.dependencies = dependencies;
        }
Example #11
0
		/// <summary>
		/// Initializes a new instance of the <see cref="T:MonoDevelop.ConnectedServices.DependenciesSection"/> class.
		/// </summary>
		public DependenciesSection (IConnectedService service)
		{
			this.Service = service;
			this.DisplayName = GettextCatalog.GetString ("Dependencies");
			// dependencies are added when the service is added, therefore it's not really optional
			this.CanBeAdded = false;

			this.isAdded = this.Service.AreDependenciesInstalled;

			Service.StatusChanged += HandleServiceStatusChanged;
		}
Example #12
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:MonoDevelop.ConnectedServices.DependenciesSection"/> class.
        /// </summary>
        public DependenciesSection(IConnectedService service)
        {
            this.Service     = service;
            this.DisplayName = GettextCatalog.GetString("Dependencies");
            // dependencies are added when the service is added, therefore it's not really optional
            this.CanBeAdded = false;

            this.isAdded = this.Service.AreDependenciesInstalled;

            Service.StatusChanged += HandleServiceStatusChanged;
        }
        /// <summary>
        /// Loads the service details for the given service
        /// </summary>
        public void LoadService(IConnectedService service)
        {
            if (service != null)
            {
                service.StatusChanged -= HandleServiceStatusChanged;
                foreach (var child in sections.Children.ToArray())
                {
                    sections.Remove(child);
                    child.Dispose();
                }
            }

            this.service = details.Service = service;
            ConfigurationSectionWidget lastSection = null;

            if (service.DependenciesSection != null)
            {
                var dependencies = lastSection = new ConfigurationSectionWidget(service.DependenciesSection);
                dependencies.BorderLeft  = dependencies.BorderRight = dependencies.BorderBottom = true;
                dependencies.BorderTop   = false;
                dependencies.BorderWidth = 1;
                sections.PackStart(dependencies);
                if (service.Status != Status.Added)
                {
                    dependencies.Expanded = true;
                }
            }

            foreach (var section in service.Sections)
            {
                var w = lastSection = new ConfigurationSectionWidget(section);
                w.BorderLeft  = w.BorderRight = w.BorderBottom = true;
                w.BorderTop   = false;
                w.BorderWidth = 1;
                sections.PackStart(w);
            }

            if (lastSection != null)
            {
                lastSection.CornerRadius = new Components.RoundedFrameBox.BorderCornerRadius(0, 0, 6, 6);
            }


            service.StatusChanged += HandleServiceStatusChanged;

            // expand the first unconfigured section if the service is already added to the project
            if (service.Status == Status.Added)
            {
                ExpandFirstOrUnconfiguredSection();
            }

            Accessible.Label = service.DisplayName;
        }
Example #14
0
        /// <summary>
        /// Confirms with the user about removing the specified service
        /// </summary>
        static Task <bool> ConfirmServiceRemoval(IConnectedService service)
        {
            var msg1 = GettextCatalog.GetString("Remove {0}", service.DisplayName);
            var msg2 = GettextCatalog.GetString("{0}" +
                                                "References in your code need to be removed manually. " +
                                                "Are you sure you want to remove the service from project {1}?", BuildRemovalInfo(service), service.Project.Name);

            var result = new TaskCompletionSource <bool> ();

            Xwt.Toolkit.NativeEngine.Invoke(delegate {
                result.SetResult(Xwt.MessageDialog.Confirm(msg1, msg2, Xwt.Command.Remove));
            });
            return(result.Task);
        }
Example #15
0
        /// <summary>
        /// Shows the service details  and removes the gallery widget if it is visible
        /// </summary>
        public void ShowServiceDetails(IConnectedService service)
        {
            if (details == null)
            {
                details = new ServiceDetailsWidget();
                detailsScrollContainer.Content = details;
            }

            details.LoadService(service);

            header.Subtitle          = service?.Project?.Name;
            header.BackButtonVisible = true;

            ShowingService = service;
            detailsScrollContainer.Visible = true;
            galleryScrollContainer.Visible = false;
            ServiceShown?.Invoke(this, new ServiceEventArgs(service));
        }
Example #16
0
 protected override void Dispose(bool disposing)
 {
     if (Dependency != null)
     {
         Dependency.StatusChanged -= HandleDependencyStatusChange;
         Dependency = null;
     }
     if (Service != null)
     {
         Service.StatusChanged -= HandleServiceStatusChanged;
         Service = null;
     }
     if (disposing && statusIconAnimation != null)
     {
         statusIconAnimation.Dispose();
         statusIconAnimation = null;
     }
     base.Dispose(disposing);
 }
		/// <summary>
		/// Loads the service details for the given service
		/// </summary>
		public void LoadService (IConnectedService service)
		{
			if (service != null) {
				service.StatusChanged -= HandleServiceStatusChanged;
				foreach (var child in sections.Children.ToArray ()) {
					sections.Remove (child);
					child.Dispose ();
				}
			}
			
			this.service = details.Service = service;
			ConfigurationSectionWidget lastSection = null;

			if (service.DependenciesSection != null) {
				var dependencies = lastSection = new ConfigurationSectionWidget (service.DependenciesSection);
				dependencies.BorderLeft = dependencies.BorderRight = dependencies.BorderBottom = true;
				dependencies.BorderTop = false;
				dependencies.BorderWidth = 1;
				sections.PackStart (dependencies);
				if (service.Status != Status.Added)
					dependencies.Expanded = true;
			}

			foreach (var section in service.Sections) {
				var w = lastSection = new ConfigurationSectionWidget (section);
				w.BorderLeft = w.BorderRight = w.BorderBottom = true;
				w.BorderTop = false;
				w.BorderWidth = 1;
				sections.PackStart (w);
			}

			if (lastSection != null)
				lastSection.CornerRadius = new Components.RoundedFrameBox.BorderCornerRadius (0, 0, 6, 6);


			service.StatusChanged += HandleServiceStatusChanged;

			// expand the first unconfigured section if the service is already added to the project
			if (service.Status == Status.Added) {
				ExpandFirstOrUnconfiguredSection ();
			}
		}
Example #18
0
        /// <summary>
        /// Shows the services gallery and removes the details widget if it is visible
        /// </summary>
        public void ShowGallery(IConnectedService[] services, Project project)
        {
            if (gallery == null)
            {
                gallery = new ServicesGalleryWidget();
                galleryScrollContainer.Content = gallery;
                gallery.ServiceSelected       += HandleServiceSelected;
            }

            gallery.LoadServices(services);

            header.Image             = ImageService.GetIcon("md-service");
            header.Subtitle          = project?.Name;
            header.BackButtonVisible = false;

            ShowingService = null;
            detailsScrollContainer.Visible = false;
            galleryScrollContainer.Visible = true;
            GalleryShown?.Invoke(this, EventArgs.Empty);
        }
		/// <summary>
		/// Loads the given services into the gallery
		/// </summary>
		public void LoadServices(IConnectedService [] services)
		{
			this.services = services;

			ClearServices ();

			//TODO: sort the lists
			foreach (var service in services) {
				var serviceWidget = new ServiceWidget (service);
				serviceWidget.MarginTop = 5;

				if (service.Status == Status.Added) {
					enabledList.PackStart (serviceWidget);
					enabledLabel.Visible = true;
				} else {
					availableList.PackStart (serviceWidget);
					availableLabel.Visible = true;
				}
				serviceWidget.ButtonReleased += HandleServiceWidgetButtonReleased;
				service.StatusChanged += HandleServiceStatusChanged;
				serviceWidget.Cursor = CursorType.Hand;
			}
		}
Example #20
0
        /// <summary>
        /// Builds up the text describing what will happen when the service is removed. This just lists
        /// package dependencies
        /// </summary>
        static string BuildRemovalInfo(IConnectedService service)
        {
            var sb = new StringBuilder();

            if (service.Dependencies.Length > 0)
            {
                sb.AppendLine(GettextCatalog.GetString("The following packages and their dependencies will be removed:"));
                sb.AppendLine();
                for (int i = 0; i < service.Dependencies.Length; i++)
                {
                    if (service.Dependencies [i].Category == ConnectedServiceDependency.PackageDependencyCategory)
                    {
                        if (i > 0)
                        {
                            sb.AppendLine();
                        }
                        sb.Append("   • ").Append(service.Dependencies [i].DisplayName);
                    }
                }
                sb.Append("\n\n");
            }

            return(sb.ToString());
        }
 protected GettingStartedConfigurationSection(IConnectedService service, int snippetCount) : base(service, GettextCatalog.GetString(ConnectedServices.GettingStartedSectionDisplayName), false)
 {
     this.SnippetCount = snippetCount;
 }
Example #22
0
 public ServiceEventArgs(IConnectedService service)
 {
     Service = service;
 }
Example #23
0
		public TestDebugConfigurationSection (IConnectedService service) : base (service, "Configure a setting")
		{
		}
		public ServiceEventArgs (IConnectedService service)
		{
			Service = service;
		}
Example #25
0
		/// <summary>
		/// Confirms with the user about removing the specified service
		/// </summary>
		static Task<bool> ConfirmServiceRemoval(IConnectedService service)
		{
			var msg1 = GettextCatalog.GetString ("Remove {0}", service.DisplayName);
			var msg2 = GettextCatalog.GetString ("{0}" +
			                                     "References in your code need to be removed manually. " +
			                                     "Are you sure you want to remove the service from project {1}?", BuildRemovalInfo(service), service.Project.Name);

			var result = new TaskCompletionSource<bool> ();
			Xwt.Toolkit.NativeEngine.Invoke (delegate {
				result.SetResult (Xwt.MessageDialog.Confirm (msg1, msg2, Xwt.Command.Remove));
			});
			return result.Task;
		}
Example #26
0
		/// <summary>
		/// Builds up the text describing what will happen when the service is removed. This just lists
		/// package dependencies
		/// </summary>
		static string BuildRemovalInfo(IConnectedService service)
		{
			var sb = new StringBuilder ();

			if (service.Dependencies.Length > 0) {
				sb.AppendLine (GettextCatalog.GetString ("The following packages and their dependencies will be removed:"));
				sb.AppendLine ();
				for (int i = 0; i < service.Dependencies.Length; i++) {

					if (service.Dependencies [i].Category == ConnectedServiceDependency.PackageDependencyCategory) {
						if (i > 0)
							sb.AppendLine ();
						sb.Append ("   • " + service.Dependencies [i].DisplayName);
					}
				}
				sb.Append ("\n\n");
			}

			return sb.ToString ();
		}
		protected GettingStartedConfigurationSection (IConnectedService service, int snippetCount) : base (service, GettextCatalog.GetString (ConnectedServices.GettingStartedSectionDisplayName), false)
		{
			this.SnippetCount = snippetCount;
		}
		/// <summary>
		/// Initializes a new instance of the <see cref="T:MonoDevelop.ConnectedServices.ConnectedServiceDependency"/> class.
		/// </summary>
		protected ConnectedServiceDependency (IConnectedService service, ConnectedServiceDependencyCategory category, string displayName)
		{
			this.Service = service;
			this.Category = category;
			this.DisplayName = displayName;
		}
Example #29
0
 public TestDebugConfigurationSection(IConnectedService service) : base(service, "Configure a setting")
 {
 }
		void HandleServiceAddedRemoved (IConnectedService service)
		{
			//TODO: sort the lists
			Runtime.RunInMainThread (delegate {
				if (service.Status == Status.Added) {
					foreach (var widget in availableList.Children.Where ((c) => c is ServiceWidget).Cast<ServiceWidget> ()) {
						if (widget.Service == service) {
							availableList.Remove (widget);
							enabledList.PackStart (widget);
							break;
						}
					}
				} else {
					foreach (var widget in enabledList.Children.Where ((c) => c is ServiceWidget).Cast<ServiceWidget> ()) {
						if (widget.Service == service) {
							enabledList.Remove (widget);
							availableList.PackStart (widget);
							break;
						}
					}
				}

				enabledLabel.Visible = services.Any (s => s.Status == Status.Added);
				availableLabel.Visible = services.Any (s => s.Status == Status.NotAdded);
			});
		}
		public ConnectedServiceNode GetServiceNode (IConnectedService service)
		{
			return childNodes.Find (node => node.Id == service.Id);
		}
 public PackageDependency(IConnectedService service, string id, string displayName, string version = null) : base(service, ConnectedServiceDependency.PackageDependencyCategory, displayName)
 {
     this.PackageId      = id;
     this.PackageVersion = version;
 }
Example #33
0
 protected GettingStartedConfigurationSection(IConnectedService service, int snippetCount) : base(service, ConnectedServices.GettingStartedSectionDisplayName, false)
 {
     this.SnippetCount = snippetCount;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="T:MonoDevelop.ConnectedServices.ConnectedServiceDependency"/> class.
 /// </summary>
 protected ConnectedServiceDependency(IConnectedService service, ConnectedServiceDependencyCategory category, string displayName)
 {
     this.Service     = service;
     this.Category    = category;
     this.DisplayName = displayName;
 }
		protected override void Dispose (bool disposing)
		{
			if (service != null) {
				service.StatusChanged -= HandleServiceStatusChanged;
				service = null;
			}
			base.Dispose (disposing);
		}
Example #36
0
		public PackageDependency (IConnectedService service, string id, string displayName, string version = null) : base(service, ConnectedServiceDependency.PackageDependencyCategory, displayName)
		{
			this.PackageId = id;
			this.PackageVersion = version;
		}
Example #37
0
 public ConnectedServiceNode GetServiceNode(IConnectedService service)
 {
     return(childNodes.Find(node => node.Id == service.Id));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="T:MonoDevelop.ConnectedServices.ConfigurationSection"/> class.
 /// </summary>
 protected ConfigurationSection(IConnectedService service, string displayName, bool canBeAdded = true)
 {
     this.Service     = service;
     this.DisplayName = displayName;
     this.CanBeAdded  = canBeAdded;
 }
		protected override void Dispose (bool disposing)
		{
			if (Dependency != null) {
				Dependency.StatusChanged -= HandleDependencyStatusChange;
				Dependency = null;
			}
			if (Service != null) {
				Service.StatusChanged -= HandleServiceStatusChanged;
				Service = null;
			}
			if (disposing && statusIconAnimation != null) {
				statusIconAnimation.Dispose ();
				statusIconAnimation = null;
			}
			base.Dispose (disposing);
		}