public ValidationContext(object instance, IServiceProvider serviceProvider, IDictionary <object, object> items)
        {
            if (instance == null)
            {
                throw new ArgumentNullException("instance");
            }

            if (serviceProvider != null)
            {
                this.InitializeServiceProvider(serviceType => serviceProvider.GetService(serviceType));
            }

            System.ComponentModel.Design.IServiceContainer container = serviceProvider as System.ComponentModel.Design.IServiceContainer;

            if (container != null)
            {
                this._serviceContainer = new ValidationContextServiceContainer(container);
            }
            else
            {
                this._serviceContainer = new ValidationContextServiceContainer();
            }

            if (items != null)
            {
                this._items = new Dictionary <object, object>(items);
            }
            else
            {
                this._items = new Dictionary <object, object>();
            }

            this._objectInstance = instance;
        }
Beispiel #2
0
        public HmeServer(string name, Uri applicationPrefix, HmeServerOptions options, IHmeApplicationPump pump, IServiceProvider parentProvider)
        {
            _name             = name;
            ApplicationPrefix = applicationPrefix;
            _pump             = pump;
            iconUri           = applicationPrefix.AbsolutePath + "icon.png";
            _advertise        = (options & HmeServerOptions.AdvertiseOnLocalNetwork) == HmeServerOptions.AdvertiseOnLocalNetwork;
            _serviceContainer = new System.ComponentModel.Design.ServiceContainer(parentProvider);
            _serviceContainer.AddService(typeof(IHttpApplicationHostPool), new HttpApplicationHostPool());

            _usePort = 7688;
            if (applicationPrefix.IsAbsoluteUri)
            {
                _usePort = (short)applicationPrefix.Port;
            }

            // everything important to initialization must happen before here since the events can
            // be raised immediately.
            lock (_portServers)
            {
                HmePortServer portServer;
                if (!_portServers.TryGetValue(_usePort, out portServer))
                {
                    portServer = new HmePortServer(_usePort);
                    _portServers.Add(_usePort, portServer);
                }
                portServer.ConnectionReceived += HttpServer_HttpConnectionReceived;
            }
        }
Beispiel #3
0
        /// <summary>
        /// Initializes the package.
        /// </summary>
        /// <remarks>This method is called right after the package is sited, so this is the place to initialize
        /// code that relies on services provided by Visual Studio.</remarks>
        protected override void Initialize()
        {
            base.Initialize();

            if (!this.SetupMode)
            {
                System.ComponentModel.Design.IServiceContainer sc = (System.ComponentModel.Design.IServiceContainer) this;
                sc.AddService(typeof(IVsPackage), this, false);

                // Ensure that the IDE enviroment is available.
                EnvDTE.DTE dte = (EnvDTE.DTE) this.GetService(typeof(EnvDTE.DTE));
                if (dte == null)
                {
                    throw new InvalidOperationException(Strings.CouldNotGetVSEnvironment);
                }

                this.Core.Initialize(null, true);

                this.Helper.Initialize();

                // Ensuring that the form is created on the UI thread.
                if (InvisibleForm.Instance == null)
                {
                    throw new InvalidOperationException(Strings.NoInvisbileForm);
                }

                // Set up the menu items.
                this.AddMenuItems();
            }
        }
Beispiel #4
0
        public ConflictResolutionResult Resolve(
            System.ComponentModel.Design.IServiceContainer serviceContainer,
            MigrationConflict conflict,
            ConflictResolutionRule rule,
            out List <MigrationAction> actions)
        {
            actions = null;

            if (rule.ActionRefNameGuid.Equals(new ManualConflictResolutionAction().ReferenceName))
            {
                return(ManualResolve(conflict, rule, out actions));
            }

            return(new ConflictResolutionResult(false, ConflictResolutionType.Other));
        }
        public ConflictResolutionResult Resolve(
            System.ComponentModel.Design.IServiceContainer serviceContainer,
            MigrationConflict conflict,
            ConflictResolutionRule rule,
            out List <MigrationAction> actions)
        {
            actions = null;

            if (rule.ActionRefNameGuid.Equals(new ManualConflictResolutionAction().ReferenceName))
            {
                return(ManualResolve(conflict, rule, out actions));
            }
            else if (rule.ActionRefNameGuid.Equals(new TFSModifyLockedWorkItemLinkConflict_ResolveByForceDelete().ReferenceName))
            {
                return(ForceDelete(conflict, rule, out actions));
            }
            else if (rule.ActionRefNameGuid.Equals(new SkipConflictedActionResolutionAction().ReferenceName))
            {
                return(SkipConflictedAction(conflict, rule, out actions));
            }

            return(new ConflictResolutionResult(false, ConflictResolutionType.Other));
        }
 public ConflictResolutionResult Resolve(System.ComponentModel.Design.IServiceContainer serviceContainer, MigrationConflict conflict, ConflictResolutionRule rule, out List <MigrationAction> actions)
 {
     actions = null;
     return(new ConflictResolutionResult(false, ConflictResolutionType.Other));
 }
 internal ValidationContextServiceContainer(System.ComponentModel.Design.IServiceContainer parentContainer)
 {
     this._parentContainer = parentContainer;
 }