Ejemplo n.º 1
0
 public virtual IServiceContainer CreateServiceContainer(Type dataServiceType, IPrincipal principal) 
 { 
     var serviceContainer = new ServiceContainer();
     var authorizer = new AuthorizerClass(dataServiceType, principal);
     serviceContainer.AddService(typeof(IAuthorizer), authorizer);
     var valueConverter = new ValueConverter(serviceContainer);
     serviceContainer.AddService(typeof(IValueConverter), valueConverter);
     var dataHelper =  new DataHelper(serviceContainer);
     serviceContainer.AddService(typeof(IDataHelper), dataHelper);
     var validationHelper = new ValidationHelper(serviceContainer);
     serviceContainer.AddService(typeof(IValidationHelper), validationHelper);
     var queryHelper = new QueryHelper(serviceContainer);
     serviceContainer.AddService(typeof(IQueryHelper), queryHelper);
     return serviceContainer;
 }
Ejemplo n.º 2
0
        public Project()
        {
            Uid = Guid.NewGuid();
            _services = new ServiceContainer();

            Name = "Project";

            _levels = new NamedResourceCollection<Level>();
            _levels.Modified += (s, e) => OnModified(EventArgs.Empty);

            _libraryManager = new LibraryManager();
            _libraryManager.Libraries.Modified += (s, e) => OnModified(EventArgs.Empty);

            Library defaultLibrary = new Library();

            _libraryManager.Libraries.Add(defaultLibrary);

            Extra = new List<XmlElement>();

            _texturePool = new MetaTexturePool();
            _texturePool.AddPool(defaultLibrary.Uid, defaultLibrary.TexturePool);

            _tilePools = new MetaTilePoolManager(_texturePool);
            _tilePools.AddManager(defaultLibrary.Uid, defaultLibrary.TilePoolManager);
            _objectPools = new MetaObjectPoolManager(_texturePool);
            _objectPools.AddManager(defaultLibrary.Uid, defaultLibrary.ObjectPoolManager);
            _tileBrushes = new MetaTileBrushManager();
            _tileBrushes.AddManager(defaultLibrary.Uid, defaultLibrary.TileBrushManager);

            SetDefaultLibrary(defaultLibrary);

            _services.AddService(typeof(TilePoolManager), _tilePools);

            ResetModified();
        }
Ejemplo n.º 3
0
        public MoveCreatorForm()
        {
            //set up defaults
            this.movelist = new Dictionary<String, Move>();
            this.directoryHome = "../../../HeroesOfRock";
            this.FormClosing += ContentList_FormClosing; ;
            this.appClose = true;

            //set up content manager
            GraphicsDeviceService gds = GraphicsDeviceService.AddRef(this.Handle,
                     this.ClientSize.Width, this.ClientSize.Height);
            ServiceContainer services = new ServiceContainer();
            services.AddService<IGraphicsDeviceService>(gds);
            this.content = new ContentManager(services, String.Concat(directoryHome, "/HeroesOfRock/bin/x86/Debug/Content"));

            //Load and/or parse predefined objects
            LoadMoveList(content.Load<Move[]>("Movelist"));
            this.audioClips = Directory.GetFiles(String.Concat(content.RootDirectory, "/Audio")).ToList<string>();
            this.particleFX = Directory.GetFiles(String.Concat(content.RootDirectory, "/ParticleFX")).ToList<string>();
            //if null, will back up to the content default
            BackUpMoveList(null);
            InitializeComponent();

            RefreshList();
        }
Ejemplo n.º 4
0
        public Workspace()
        {
            Services = new ServiceContainer();
            Services.AddService<IIconReaderService>(new IconReaderService());
            buildLogger = new BuildLogger(Tracer.TraceSource);

            LoadPlugins();

            AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
        }
Ejemplo n.º 5
0
        public void GenerateBabylonFile(string file, string outputFile, bool skinned, bool rightToLeft)
        {
            if (OnImportProgressChanged != null)
                OnImportProgressChanged(0);


            var scene = new BabylonScene(Path.GetDirectoryName(outputFile));

            var services = new ServiceContainer();

            // Create a graphics device
            var form = new Form();
            
            services.AddService<IGraphicsDeviceService>(GraphicsDeviceService.AddRef(form.Handle, 1, 1));

            var contentBuilder = new ContentBuilder(ExtraPipelineAssemblies);
            var contentManager = new ContentManager(services, contentBuilder.OutputDirectory);

            // Tell the ContentBuilder what to build.
            contentBuilder.Clear();
            contentBuilder.Add(Path.GetFullPath(file), "Model", Importer, skinned ? "SkinnedModelProcessor" : "ModelProcessor");

            // Build this new model data.
            string buildError = contentBuilder.Build();

            if (string.IsNullOrEmpty(buildError))
            {
                var model = contentManager.Load<Model>("Model");
                ParseModel(model, scene, rightToLeft);
            }
            else
            {
                throw new Exception(buildError);
            }

            // Output
            scene.Prepare();
            using (var outputStream = new FileStream(outputFile, FileMode.Create, FileAccess.Write))
            {
                var ser = new DataContractJsonSerializer(typeof(BabylonScene));
                ser.WriteObject(outputStream, scene);
            }

            // Cleaning
            foreach (var path in exportedTexturesFilename.Values)
            {
                File.Delete(path);
            }

            if (OnImportProgressChanged != null)
                OnImportProgressChanged(100);
        }
Ejemplo n.º 6
0
        public void instance(string[] args)
        {
            try
            {

                Form form = new Form();
                GraphicsDeviceService gds = GraphicsDeviceService.AddRef(form.Handle, form.ClientSize.Width, form.ClientSize.Height);
                ServiceContainer services = new ServiceContainer();
                services.AddService<IGraphicsDeviceService>(gds);
                var content = new ContentManager(services);

                foreach (string p in args)
                {
                    Console.WriteLine(System.Reflection.Assembly.GetExecutingAssembly().GetName().Name + " " + p);
                    if (File.Exists(p))
                    {
                        if (Path.GetExtension(p).Equals(".xnb"))
                        {
                            ConvertToPng(content, p);
                        }
                    }
                    else
                    {
                        Console.WriteLine("Invalid file path or file");
                    }
                }

                foreach (string f in filesToDelete)
                {
                    File.Delete(f);
                }
                content.Unload();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
        public void AdaptShouldReturnValidationContextAdapter()
        {
            // arrange
            var instance = new object();
            var service = new object();
            var serviceProvider = new ServiceContainer();
            var items = new Dictionary<object, object>() { { "Test", "Test" } };
            var expected = new ValidationContext( instance, serviceProvider, items );

            expected.MemberName = "Foo";
            serviceProvider.AddService( typeof( object ), service );

            // act
            var actual = expected.Adapt();

            // assert
            Assert.Equal( expected.DisplayName, actual.DisplayName );
            Assert.Same( expected.Items["Test"], actual.Items["Test"] );
            Assert.Equal( expected.MemberName, actual.MemberName );
            Assert.Same( expected.ObjectInstance, actual.ObjectInstance );
            Assert.Equal( expected.ObjectType, actual.ObjectType );
            Assert.Same( expected.GetService( typeof( object ) ), actual.GetService( typeof( object ) ) );
        }
        IServiceProvider CreateServiceProvider()
        {
            var container = new ServiceContainer(this.Application.RootServiceProvider);

            container.AddService(typeof(ToolsUIWindow), this);
            this.documentTracker = new WindowDocumentTracker(this, this.Application.RootServiceProvider);
            container.AddService(typeof(IActiveDocumentTracker), this.documentTracker);
            return container;
        }
Ejemplo n.º 9
0
        //private void Given_Platform(IPlatform platform)
        //{
        //    this.oe = new Mock<OperatingEnvironment>();
        //    this.platform = platform;
        //    this.cfgSvc.Setup(c => c.GetEnvironment("testOS")).Returns(oe);
        //    oe.Setup(e => e.Load(sc, null)).IgnoreArguments().Returns(platform);
        //}

        private void Given_TypeLibraryLoaderService()
        {
            this.tlSvc = new Mock <ITypeLibraryLoaderService>();
            sc.AddService <ITypeLibraryLoaderService>(this.tlSvc.Object);
        }
Ejemplo n.º 10
0
 public X86DisassemblerTests()
 {
     sc = new ServiceContainer();
     sc.AddService <IFileSystemService>(new FileSystemServiceImpl());
 }
Ejemplo n.º 11
0
Archivo: Program.cs Proyecto: qcyb/reko
        public int Execute(string [] args)
        {
            TextReader input   = Console.In;
            Stream     output  = Console.OpenStandardOutput();
            var        sc      = new ServiceContainer();
            var        rekoCfg = RekoConfigurationService.Load(sc);

            sc.AddService <IConfigurationService>(rekoCfg);

            var docopt = new Docopt();
            IDictionary <string, ValueObject> options;

            try {
                options = docopt.Apply(usage, args);
            } catch (Exception ex)
            {
                Console.Error.WriteLine(ex);
                return(1);
            }

            var arch = rekoCfg.GetArchitecture(options["-a"].ToString());

            if (arch == null)
            {
                Console.WriteLine(
                    "c2xml: unknown architecture '{0}'. Check the c2xml config file for supported architectures.",
                    options["-a"]);
                return(-1);
            }
            var envElem = rekoCfg.GetEnvironment(options["-e"].ToString());

            if (envElem == null)
            {
                Console.WriteLine(
                    "c2xml: unknown environment '{0}'. Check the c2xml config file for supported architectures.",
                    options["-e"]);
                return(-1);
            }

            var platform = envElem.Load(sc, arch);

            try
            {
                input = new StreamReader(options["<inputfile>"].ToString());
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine("c2xml: unable to open file {0} for reading. {1}", options["<inputfile>"], ex.Message);
                return(1);
            }

            if (options.ContainsKey("<outputfile>") && options["<outputfile>"] != null)
            {
                try
                {
                    output = new FileStream(options["<outputfile>"].ToString(), FileMode.Create, FileAccess.Write);
                }
                catch (Exception ex)
                {
                    Console.Error.WriteLine("c2xml: unable to open file {0} for writing. {1}", options["<outputfile>"], ex.Message);
                    return(1);
                }
            }
            string dialect = null;

            if (options.TryGetValue("-d", out var optDialect))
            {
                dialect = (string)optDialect.Value;
            }
            var xWriter = new XmlTextWriter(output, new UTF8Encoding(false))
            {
                Formatting = Formatting.Indented
            };

            XmlConverter c = new XmlConverter(input, xWriter, platform, dialect);

            c.Convert();
            output.Flush();
            output.Close();
            return(0);
        }
Ejemplo n.º 12
0
 public void AddService(Type serviceType, object serviceInstance)
 {
     sc.AddService(serviceType, serviceInstance);
 }
        internal void ValidateDefinition(Activity root, bool isNewType, ITypeProvider typeProvider)
        {
            if (!this.validateOnCreate)
            {
                return;
            }

            ValidationErrorCollection errors = new ValidationErrorCollection();

            // For validation purposes, create a type provider in the type case if the
            // host did not push one.
            if (typeProvider == null)
            {
                typeProvider = WorkflowRuntime.CreateTypeProvider(root);
            }

            // Validate that we are purely XAML.
            if (!isNewType)
            {
                if (!string.IsNullOrEmpty(root.GetValue(WorkflowMarkupSerializer.XClassProperty) as string))
                {
                    errors.Add(new ValidationError(ExecutionStringManager.XomlWorkflowHasClassName, ErrorNumbers.Error_XomlWorkflowHasClassName));
                }

                Queue compositeActivities = new Queue();
                compositeActivities.Enqueue(root);
                while (compositeActivities.Count > 0)
                {
                    Activity activity = compositeActivities.Dequeue() as Activity;

                    if (activity.GetValue(WorkflowMarkupSerializer.XCodeProperty) != null)
                    {
                        errors.Add(new ValidationError(ExecutionStringManager.XomlWorkflowHasCode, ErrorNumbers.Error_XomlWorkflowHasCode));
                    }

                    CompositeActivity compositeActivity = activity as CompositeActivity;
                    if (compositeActivity != null)
                    {
                        foreach (Activity childActivity in compositeActivity.EnabledActivities)
                        {
                            compositeActivities.Enqueue(childActivity);
                        }
                    }
                }
            }

            ServiceContainer serviceContainer = new ServiceContainer();

            serviceContainer.AddService(typeof(ITypeProvider), typeProvider);

            ValidationManager validationManager = new ValidationManager(serviceContainer);

            using (WorkflowCompilationContext.CreateScope(validationManager))
            {
                foreach (Validator validator in validationManager.GetValidators(root.GetType()))
                {
                    foreach (ValidationError error in validator.Validate(validationManager, root))
                    {
                        if (!error.UserData.Contains(typeof(Activity)))
                        {
                            error.UserData[typeof(Activity)] = root;
                        }

                        errors.Add(error);
                    }
                }
            }
            if (errors.HasErrors)
            {
                throw new WorkflowValidationFailedException(ExecutionStringManager.WorkflowValidationFailure, errors);
            }
        }
Ejemplo n.º 14
0
 public void Setup()
 {
     sc     = new ServiceContainer();
     cfgSvc = new Mock <IConfigurationService>();
     sc.AddService <IConfigurationService>(cfgSvc.Object);
 }
Ejemplo n.º 15
0
 public void Setup()
 {
     this.sc = new ServiceContainer();
     sc.AddService <DecompilerEventListener>(new FakeDecompilerEventListener());
 }
Ejemplo n.º 16
0
        /*
         * ITemplate implementation
         * This implementation of ITemplate is only used in the designer
         */

        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public virtual void InstantiateIn(Control container)
        {
            IServiceProvider builderServiceProvider = null;

            // Use the designer host to get one at designtime as the service provider
            if (_designerHost != null)
            {
                builderServiceProvider = _designerHost;
            }
            else if (!IsNoCompile)
            {
                // Otherwise, create a ServiceContainer and try using the container as the service provider
                ServiceContainer serviceContainer = new ServiceContainer();
                if (container is IThemeResolutionService)
                {
                    serviceContainer.AddService(typeof(IThemeResolutionService), (IThemeResolutionService)container);
                }

                if (container is IFilterResolutionService)
                {
                    serviceContainer.AddService(typeof(IFilterResolutionService), (IFilterResolutionService)container);
                }
                builderServiceProvider = serviceContainer;
            }

            HttpContext     context = null;
            TemplateControl savedTemplateControl = null;

            TemplateControl templateControl = container as TemplateControl;

            if (templateControl != null)
            {
                context = HttpContext.Current;
                if (context != null)
                {
                    savedTemplateControl = context.TemplateControl;
                }
            }

            try {
                if (!IsNoCompile)
                {
                    SetServiceProvider(builderServiceProvider);
                }

                if (context != null)
                {
                    context.TemplateControl = templateControl;
                }

                BuildChildren(container);
            }
            finally {
                if (!IsNoCompile)
                {
                    SetServiceProvider(null);
                }

                // Restore the previous template control
                if (context != null)
                {
                    context.TemplateControl = savedTemplateControl;
                }
            }
        }
Ejemplo n.º 17
0
        public void SysV_TerminatingFunction()
        {
            var mr     = new MockRepository();
            var sc     = new ServiceContainer();
            var arch   = mr.Stub <IProcessorArchitecture>();
            var tlSvc  = mr.Stub <ITypeLibraryLoaderService>();
            var cfgSvc = mr.Stub <IConfigurationService>();

            sc.AddService <IConfigurationService>(cfgSvc);
            sc.AddService <ITypeLibraryLoaderService>(tlSvc);
            cfgSvc.Stub(c => c.GetEnvironment(null))
            .IgnoreArguments()
            .Return(new OperatingEnvironmentElement
            {
                TypeLibraries =
                {
                    new TypeLibraryElement
                    {
                        Name = "libc.xml"
                    }
                },
                CharacteristicsLibraries =
                {
                    new TypeLibraryElement
                    {
                        Name = "libcharacteristics.xml",
                    }
                }
            });
            tlSvc.Stub(t => t.LoadCharacteristics(null))
            .IgnoreArguments()
            .Return(new CharacteristicsLibrary
            {
                Entries =
                {
                    {
                        "exit",
                        new ProcedureCharacteristics {
                            Terminates = true
                        }
                    }
                }
            });
            tlSvc.Stub(t => t.LoadLibrary(null, null))
            .IgnoreArguments()
            .Return(new TypeLibrary
            {
                Signatures =
                {
                    {
                        "exit",
                        new ProcedureSignature(null)
                    }
                }
            });
            mr.ReplayAll();

            var sysv = new SysVPlatform(sc, arch);
            var proc = sysv.LookupProcedureByName(null, "exit");

            Assert.IsTrue(proc.Characteristics.Terminates, "exit should have been marked as terminating.");
        }
Ejemplo n.º 18
0
        static void Main()
        {
                        #if TRACE
            System.Diagnostics.TextWriterTraceListener listener
                = new System.Diagnostics.TextWriterTraceListener(System.Console.Out);
            System.Diagnostics.Trace.Listeners.Add(listener);
                        #endif

            Application.Init();

            #region Packing and layout

            Window window = new Window("AspNetEdit Host Sample");
            window.SetDefaultSize(1000, 700);
            window.DeleteEvent += new DeleteEventHandler(window_DeleteEvent);

            VBox outerBox = new VBox();
            window.Add(outerBox);

            HPaned leftBox = new HPaned();
            outerBox.PackEnd(leftBox, true, true, 0);
            HPaned rightBox = new HPaned();
            leftBox.Add2(rightBox);

            geckoFrame        = new Frame();
            geckoFrame.Shadow = ShadowType.In;
            rightBox.Pack1(geckoFrame, true, false);

            #endregion

            #region Toolbar

            // * Save/Open

            Toolbar buttons = new Toolbar();
            outerBox.PackStart(buttons, false, false, 0);

            ToolButton saveButton = new ToolButton(Stock.Save);
            buttons.Add(saveButton);
            saveButton.Clicked += new EventHandler(saveButton_Clicked);

            ToolButton openButton = new ToolButton(Stock.Open);
            buttons.Add(openButton);
            openButton.Clicked += new EventHandler(openButton_Clicked);

            buttons.Add(new SeparatorToolItem());

            // * Clipboard

            ToolButton undoButton = new ToolButton(Stock.Undo);
            buttons.Add(undoButton);
            undoButton.Clicked += new EventHandler(undoButton_Clicked);

            ToolButton redoButton = new ToolButton(Stock.Redo);
            buttons.Add(redoButton);
            redoButton.Clicked += new EventHandler(redoButton_Clicked);

            ToolButton cutButton = new ToolButton(Stock.Cut);
            buttons.Add(cutButton);
            cutButton.Clicked += new EventHandler(cutButton_Clicked);

            ToolButton copyButton = new ToolButton(Stock.Copy);
            buttons.Add(copyButton);
            copyButton.Clicked += new EventHandler(copyButton_Clicked);

            ToolButton pasteButton = new ToolButton(Stock.Paste);
            buttons.Add(pasteButton);
            pasteButton.Clicked += new EventHandler(pasteButton_Clicked);

            buttons.Add(new SeparatorToolItem());

            // * Text style

            ToolButton boldButton = new ToolButton(Stock.Bold);
            buttons.Add(boldButton);
            boldButton.Clicked += new EventHandler(boldButton_Clicked);

            ToolButton italicButton = new ToolButton(Stock.Italic);
            buttons.Add(italicButton);
            italicButton.Clicked += new EventHandler(italicButton_Clicked);

            ToolButton underlineButton = new ToolButton(Stock.Underline);
            buttons.Add(underlineButton);
            underlineButton.Clicked += new EventHandler(underlineButton_Clicked);

            ToolButton indentButton = new ToolButton(Stock.Indent);
            buttons.Add(indentButton);
            indentButton.Clicked += new EventHandler(indentButton_Clicked);

            ToolButton unindentButton = new ToolButton(Stock.Unindent);
            buttons.Add(unindentButton);
            unindentButton.Clicked += new EventHandler(unindentButton_Clicked);

            buttons.Add(new SeparatorToolItem());

            // * Toolbox

            ToolButton toolboxAddButton = new ToolButton(Stock.Add);
            buttons.Add(toolboxAddButton);
            toolboxAddButton.Clicked += new EventHandler(toolboxAddButton_Clicked);

            #endregion

            #region Designer services and host

            //set up the services
            ServiceContainer services = new ServiceContainer();
            services.AddService(typeof(INameCreationService), new NameCreationService());
            services.AddService(typeof(ISelectionService), new SelectionService());
            services.AddService(typeof(IEventBindingService), new EventBindingService(window));
            services.AddService(typeof(ITypeResolutionService), new TypeResolutionService());
            ExtenderListService extListServ = new AspNetEdit.Editor.ComponentModel.ExtenderListService();
            services.AddService(typeof(IExtenderListService), extListServ);
            services.AddService(typeof(IExtenderProviderService), extListServ);
            services.AddService(typeof(ITypeDescriptorFilterService), new TypeDescriptorFilterService());
            toolboxService = new ToolboxService();
            services.AddService(typeof(IToolboxService), toolboxService);

            //create our host
            host = new DesignerHost(services);
            host.NewFile();
            host.Activate();

            #endregion

            #region Designer UI and panels

            IRootDesigner    rootDesigner = (IRootDesigner)host.GetDesigner(host.RootComponent);
            RootDesignerView designerView = (RootDesignerView)rootDesigner.GetView(ViewTechnology.Passthrough);
            geckoFrame.Add(designerView);

            PropertyGrid p = new PropertyGrid(services);
            p.WidthRequest = 200;
            rightBox.Pack2(p, false, false);

            Toolbox toolbox = new Toolbox(services);
            leftBox.Pack1(toolbox, false, false);
            toolboxService.PopulateFromAssembly(System.Reflection.Assembly.GetAssembly(typeof(System.Web.UI.Control)));
            toolboxService.AddToolboxItem(new TextToolboxItem("<table><tr><td></td><td></td></tr><tr><td></td><td></td></tr></table>", "Table"), "Html");
            toolboxService.AddToolboxItem(new TextToolboxItem("<div style=\"width: 100px; height: 100px;\"></div>", "Div"), "Html");
            toolboxService.AddToolboxItem(new TextToolboxItem("<hr />", "Horizontal Rule"), "Html");
            toolboxService.AddToolboxItem(new TextToolboxItem("<select><option></option></select>", "Select"), "Html");
            toolboxService.AddToolboxItem(new TextToolboxItem("<img src=\"\" />", "Image"), "Html");
            toolboxService.AddToolboxItem(new TextToolboxItem("<textarea cols=\"20\" rows=\"2\"></textarea>", "Textarea"), "Html");
            toolboxService.AddToolboxItem(new TextToolboxItem("<input type=\"hidden\" />", "Input [Hidden]"), "Html");
            toolboxService.AddToolboxItem(new TextToolboxItem("<input type=\"radio\" />", "Input [Radio]"), "Html");
            toolboxService.AddToolboxItem(new TextToolboxItem("<input type=\"checkbox\" />", "Input [Checkbox]"), "Html");
            toolboxService.AddToolboxItem(new TextToolboxItem("<input type=\"password\" />", "Input [Password]"), "Html");
            toolboxService.AddToolboxItem(new TextToolboxItem("<input type=\"file\" />", "Input [File]"), "Html");
            toolboxService.AddToolboxItem(new TextToolboxItem("<input type=\"text\" />", "Input [Text]"), "Html");
            toolboxService.AddToolboxItem(new TextToolboxItem("<input type=\"submit\" value=\"submit\" />", "Input [Submit]"), "Html");
            toolboxService.AddToolboxItem(new TextToolboxItem("<input type=\"reset\" value=\"reset\" />", "Input [Reset]"), "Html");
            toolboxService.AddToolboxItem(new TextToolboxItem("<input type=\"button\" value=\"button\" />", "Input [Button]"), "Html");
            toolbox.Refresh();

            #endregion

            window.ShowAll();
            Application.Run();
        }
Ejemplo n.º 19
0
 public override void SetConfiguration(AspectConfiguration config)
 {
     _container.AddService("SnapAspectConfiguration", config);
     Proxy.Configuration = config;
     config.Container    = this;
 }
 public void TestInitialize()
 {
     cmdService = new MockUIComandService();
     services = new ServiceContainer();
     services.AddService(typeof(IUICommandService), cmdService);
 }
        private static Control[] ParseControlsInternalHelper(DesignTimeParseData data, bool returnFirst)
        {
            TemplateParser parser = new PageParser();

            parser.FInDesigner  = true;
            parser.DesignerHost = data.DesignerHost;
            parser.DesignTimeDataBindHandler = data.DataBindingHandler;
            parser.Text = data.ParseText;
            parser.Parse();

            ArrayList parsedControls = new ArrayList();
            ArrayList subBuilders    = parser.RootBuilder.SubBuilders;

            if (subBuilders != null)
            {
                // Look for the first control builder
                IEnumerator en = subBuilders.GetEnumerator();

                for (int i = 0; en.MoveNext(); i++)
                {
                    object cur = en.Current;

                    if ((cur is ControlBuilder) && !(cur is CodeBlockBuilder))
                    {
                        // Instantiate the control
                        ControlBuilder controlBuilder = (ControlBuilder)cur;

                        System.Diagnostics.Debug.Assert(controlBuilder.CurrentFilterResolutionService == null);

                        IServiceProvider builderServiceProvider = null;

                        // If there's a designer host, use it as the service provider
                        if (data.DesignerHost != null)
                        {
                            builderServiceProvider = data.DesignerHost;
                        }
                        // If it doesn't exist, use a default ---- filter resolution service
                        else
                        {
                            ServiceContainer serviceContainer = new ServiceContainer();
                            serviceContainer.AddService(typeof(IFilterResolutionService), new SimpleDesignTimeFilterResolutionService(data.Filter));
                            builderServiceProvider = serviceContainer;
                        }

                        controlBuilder.SetServiceProvider(builderServiceProvider);
                        try {
                            Control control = (Control)controlBuilder.BuildObject(data.ShouldApplyTheme);
                            parsedControls.Add(control);
                        }
                        finally {
                            controlBuilder.SetServiceProvider(null);
                        }
                        if (returnFirst)
                        {
                            break;
                        }
                    }
                    // To preserve backwards compatibility, we don't add LiteralControls
                    // to the control collection when parsing for a single control
                    else if (!returnFirst && (cur is string))
                    {
                        LiteralControl literalControl = new LiteralControl(cur.ToString());
                        parsedControls.Add(literalControl);
                    }
                }
            }

            data.SetUserControlRegisterEntries(parser.UserControlRegisterEntries, parser.TagRegisterEntries);

            return((Control[])parsedControls.ToArray(typeof(Control)));
        }
        /// <summary>
        /// Initializes the control.
        /// </summary>
        protected override void OnCreateControl()
        {
            // Don't initialize the graphics device if we are running in the designer.
            if (!DesignMode)
            {
                Services = new ServiceContainer();

                graphicsDeviceService = GraphicsDeviceService.AddRef(profile, Handle, ClientSize.Width, ClientSize.Height);

                // Register the service, so components like ContentManager can find it.
                Services.AddService<IGraphicsDeviceService>(graphicsDeviceService);

                // Give derived classes a chance to initialize themselves.
                Initialize();
            }

            base.OnCreateControl();
        }
Ejemplo n.º 23
0
 public void TestInitialize()
 {
     svcContainer.AddService(typeof(IBuilderConfigurator <BuilderStage>), new ILAnalyzerTestBuilderConfigurator());
     svcContainer.AddService(typeof(CecilAnalyzerConfiguration), CecilAnalyzerConfiguration.CreateDefaultConfiguration(CreateFullPath("TestTarget.exe")));
     svcContainer.AddService(typeof(ILanguageModelAccessor), new LanguageModelAccessorMock());
 }
Ejemplo n.º 24
0
 public void AddService(Type serviceType, object serviceInstance)
 {
     System.Console.WriteLine("DesignerLoaderHost.AddService: " + serviceType.Name + " IsNull: " + (serviceInstance == null));
     serviceContainer.AddService(serviceType, serviceInstance);
 }
Ejemplo n.º 25
0
 public void AddService(Type serviceType, ServiceCreatorCallback callback, bool promote)
 {
     parentServices.AddService(serviceType, callback, promote);
 }
Ejemplo n.º 26
0
 public void TestInitialize()
 {
     cmdService = new MockUIComandService();
     services   = new ServiceContainer();
     services.AddService(typeof(IUICommandService), cmdService);
 }
Ejemplo n.º 27
0
        private void ExtractTemplateValuesRecursive(ArrayList subBuilders, OrderedDictionary table, Control container)
        {
            foreach (object subBuilderObject in subBuilders)
            {
                ControlBuilder subBuilderControlBuilder = subBuilderObject as ControlBuilder;
                if (subBuilderControlBuilder != null)
                {
                    ICollection entries;
                    // filter out device filtered bound entries that don't apply to this device
                    if (!subBuilderControlBuilder.HasFilteredBoundEntries)
                    {
                        entries = subBuilderControlBuilder.BoundPropertyEntries;
                    }
                    else
                    {
                        Debug.Assert(subBuilderControlBuilder.ServiceProvider == null);
                        Debug.Assert(subBuilderControlBuilder.TemplateControl != null, "TemplateControl should not be null in no-compile pages. We need it for the FilterResolutionService.");

                        ServiceContainer serviceContainer = new ServiceContainer();
                        serviceContainer.AddService(typeof(IFilterResolutionService), subBuilderControlBuilder.TemplateControl);

                        try {
                            subBuilderControlBuilder.SetServiceProvider(serviceContainer);
                            entries = subBuilderControlBuilder.GetFilteredPropertyEntrySet(subBuilderControlBuilder.BoundPropertyEntries);
                        }
                        finally {
                            subBuilderControlBuilder.SetServiceProvider(null);
                        }
                    }

                    string  previousControlName = null;
                    bool    newControl          = true;
                    Control control             = null;

                    foreach (BoundPropertyEntry entry in entries)
                    {
                        // Skip all entries that are not two-way
                        if (!entry.TwoWayBound)
                        {
                            continue;
                        }

                        // Reset the "previous" Property Entry if we're not looking at the same control.
                        // If we don't do this, Two controls that have conditionals on the same named property will have
                        // their conditionals incorrectly merged.
                        if (String.Compare(previousControlName, entry.ControlID, StringComparison.Ordinal) != 0)
                        {
                            newControl = true;
                        }
                        else
                        {
                            newControl = false;
                        }

                        previousControlName = entry.ControlID;

                        if (newControl)
                        {
                            control = container.FindControl(entry.ControlID);

                            if (control == null || !entry.ControlType.IsInstanceOfType(control))
                            {
                                Debug.Assert(false, "BoundPropertyEntry is of wrong control type or couldn't be found.  Expected " + entry.ControlType.Name);
                                continue;
                            }
                        }

                        string propertyName;
                        // map the property in case it's a complex property
                        object targetObject = PropertyMapper.LocatePropertyObject(control, entry.Name, out propertyName, InDesigner);

                        // FastPropertyAccessor uses ReflectEmit for lightning speed
                        table[entry.FieldName] = FastPropertyAccessor.GetProperty(targetObject, propertyName, InDesigner);
                    }

                    ExtractTemplateValuesRecursive(subBuilderControlBuilder.SubBuilders, table, container);
                }
            }
        }
Ejemplo n.º 28
0
 public void AddService(Type serviceType, ServiceCreatorCallback callback, bool promote)
 {
     _serviceContainer.AddService(serviceType, callback, promote);
 }
Ejemplo n.º 29
0
 public AnalysisTestBase()
 {
     //$TODO: this is a hard dependency on the file system.
     sc = new ServiceContainer();
     sc.AddService<IFileSystemService>(new FileSystemServiceImpl());
 }
Ejemplo n.º 30
0
 public TestContainer()
 {
     _services.AddService(typeof(TestService), new TestService());
 }
Ejemplo n.º 31
0
 private void Given_TypeLibraryLoaderService()
 {
     this.tlSvc = mr.Stub <ITypeLibraryLoaderService>();
     sc.AddService <ITypeLibraryLoaderService>(this.tlSvc);
 }
Ejemplo n.º 32
0
        public void Setup()
        {
            form   = new Mock <IMainForm>();
            sc     = new ServiceContainer();
            loader = new Mock <ILoader>();
            dec    = new Mock <IDecompiler>();
            sc     = new ServiceContainer();
            uiSvc  = new Mock <IDecompilerShellUiService>();
            host   = new Mock <IDecompiledFileService>();
            memSvc = new Mock <ILowLevelViewService>();
            fsSvc  = new Mock <IFileSystemService>();
            abSvc  = new Mock <IArchiveBrowserService>();

            var mem      = new ByteMemoryArea(Address.Ptr32(0x10000), new byte[1000]);
            var imageMap = new SegmentMap(
                mem.BaseAddress,
                new ImageSegment("code", mem, AccessMode.ReadWriteExecute));
            var arch = new Mock <IProcessorArchitecture>();

            arch.Setup(a => a.Name).Returns("FakeArch");
            var platform = new Mock <IPlatform>();

            program = new Program(imageMap, arch.Object, platform.Object);
            project = new Project {
                Programs = { program }
            };

            browserSvc = new Mock <IProjectBrowserService>();

            sc.AddService <IDecompilerUIService>(uiSvc.Object);
            sc.AddService <IDecompilerShellUiService>(new Mock <IDecompilerShellUiService>().Object);
            sc.AddService <IDecompilerService>(new DecompilerService());
            sc.AddService <IWorkerDialogService>(new FakeWorkerDialogService());
            sc.AddService <DecompilerEventListener>(new FakeDecompilerEventListener());
            sc.AddService <IProjectBrowserService>(browserSvc.Object);
            sc.AddService <ILowLevelViewService>(memSvc.Object);
            sc.AddService <ILoader>(loader.Object);
            sc.AddService <IDecompiledFileService>(host.Object);
            sc.AddService <IFileSystemService>(fsSvc.Object);
            sc.AddService <IArchiveBrowserService>(abSvc.Object);
            sc.AddService <IProcedureListService>(new Mock <IProcedureListService>().Object);
            i = new TestInitialPageInteractor(sc, dec.Object);
        }
Ejemplo n.º 33
0
 public DisassemblerTests()
 {
     this.sc = new ServiceContainer();
     sc.AddService <ITestGenerationService>(new UnitTestGenerationService(sc));
     this.arch = new Z80ProcessorArchitecture(sc, "z80", new Dictionary <string, object>());
 }
Ejemplo n.º 34
0
        public async Task SetUp()
        {
            const string Original     = @"original.config";
            const string OriginalMono = @"original.mono.config";

            if (Helper.IsRunningOnMono())
            {
                File.Copy("Website1/original.config", "Website1/web.config", true);
                File.Copy(OriginalMono, Current, true);
            }
            else
            {
                File.Copy("Website1\\original.config", "Website1\\web.config", true);
                File.Copy(Original, Current, true);
            }

            Environment.SetEnvironmentVariable(
                "JEXUS_TEST_HOME",
                Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));

            _server = new IisExpressServerManager(Current);

            var serviceContainer = new ServiceContainer();

            serviceContainer.RemoveService(typeof(IConfigurationService));
            serviceContainer.RemoveService(typeof(IControlPanel));
            var scope = ManagementScope.Site;

            serviceContainer.AddService(typeof(IControlPanel), new ControlPanel());
            serviceContainer.AddService(
                typeof(IConfigurationService),
                new ConfigurationService(
                    null,
                    _server.Sites[0].GetWebConfiguration(),
                    scope,
                    null,
                    _server.Sites[0],
                    null,
                    null,
                    null, _server.Sites[0].Name));

            serviceContainer.RemoveService(typeof(IManagementUIService));
            var mock = new Mock <IManagementUIService>();

            mock.Setup(
                action =>
                action.ShowMessage(
                    It.IsAny <string>(),
                    It.IsAny <string>(),
                    It.IsAny <MessageBoxButtons>(),
                    It.IsAny <MessageBoxIcon>(),
                    It.IsAny <MessageBoxDefaultButton>())).Returns(DialogResult.Yes);
            serviceContainer.AddService(typeof(IManagementUIService), mock.Object);

            var module = new HttpErrorsModule();

            module.TestInitialize(serviceContainer, null);

            _feature = new HttpErrorsFeature(module);
            _feature.Load();
        }
Ejemplo n.º 35
0
        /// <summary>
        /// Invoked after either control has created its graphics device.
        /// </summary>
        private void loadContent(object sender, GraphicsDeviceEventArgs e)
        {
            // Because this same event is hooked for both controls, we check if the Stopwatch
            // is running to avoid loading our content twice.
            if (!totalTime.IsRunning)
            {

                ServiceContainer = new ServiceContainer();
                contentBuilder = new ContentBuilder();
                ResourceBuilder.Instance.ContentBuilder = contentBuilder;

                resourceContent.Activate();

                errors = new List<Error>();
                outputTextBlock = output;
                EditorStatus = EditorStatus.STARTING;
                EditMode = AridiaEditor.EditMode.STANDARD;
                errorDataGrid.ItemsSource = errors;
                Output.AddToOutput("WELCOME TO ARIDIA WORLD EDITOR ------------");

                GameApplication.Instance.SetGraphicsDevice(e.GraphicsDevice);
                MouseDevice.Instance.ResetMouseAfterUpdate = false;
                ServiceContainer.AddService<IGraphicsDeviceService>(GraphicsDeviceService.AddRef(new IntPtr(), 100, 100));
                ResourceManager.Instance.Content = new ContentManager(ServiceContainer, contentBuilder.OutputDirectory);
                ResourceManager.Instance.Content.Unload();

                sceneGraph = new SceneGraphManager();
                sceneGraph.CullingActive = true;
                sceneGraph.LightingActive = false; //deactivate lighting on beginning!

                spriteBatch = new SpriteBatch(e.GraphicsDevice);
                grid = new GridComponent(e.GraphicsDevice, 2);

                e.GraphicsDevice.RasterizerState = RasterizerState.CullNone;

                var versionAttribute = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();

                AssemblyBuild.Content = "Build: (Alpha) " + versionAttribute;
                if (File.Exists(Settings.Default.LayoutFile))
                    dockManager.RestoreLayout(Settings.Default.LayoutFile);

                // after we initialized everything we need start loading the content
                // in a new thread!
                StartContentBuilding();

                // Start the watch now that we're going to be starting our draw loop
                totalTime.Start();
            }
        }
Ejemplo n.º 36
0
        public Toolbox(ServiceContainer parentServices)
        {
            this.parentServices = parentServices;

            //we need this service, so create it if not present
            toolboxService = parentServices.GetService(typeof(IToolboxService)) as ToolboxService;
            if (toolboxService == null)
            {
                toolboxService = new ToolboxService();
                parentServices.AddService(typeof(IToolboxService), toolboxService);
            }

            #region Toolbar
            toolbar = new Toolbar();
            toolbar.ToolbarStyle = ToolbarStyle.Icons;
            toolbar.IconSize     = IconSize.SmallToolbar;
            base.PackStart(toolbar, false, false, 0);

            filterToggleButton            = new ToggleToolButton();
            filterToggleButton.IconWidget = new Image(Stock.MissingImage, IconSize.SmallToolbar);
            filterToggleButton.Toggled   += new EventHandler(toggleFiltering);
            toolbar.Insert(filterToggleButton, 0);

            catToggleButton            = new ToggleToolButton();
            catToggleButton.IconWidget = new Image(Stock.MissingImage, IconSize.SmallToolbar);
            catToggleButton.Toggled   += new EventHandler(toggleCategorisation);
            toolbar.Insert(catToggleButton, 1);

            SeparatorToolItem sep = new SeparatorToolItem();
            toolbar.Insert(sep, 2);

            filterEntry = new Entry();
            filterEntry.WidthRequest = 150;
            filterEntry.Changed     += new EventHandler(filterTextChanged);

            #endregion

            scrolledWindow = new ScrolledWindow();
            base.PackEnd(scrolledWindow, true, true, 0);


            //Initialise model

            store = new ToolboxStore();

            //initialise view
            nodeView = new NodeView(store);
            nodeView.Selection.Mode = SelectionMode.Single;
            nodeView.HeadersVisible = false;

            //cell renderers
            CellRendererPixbuf pixbufRenderer = new CellRendererPixbuf();
            CellRendererText   textRenderer   = new CellRendererText();
            textRenderer.Ellipsize = Pango.EllipsizeMode.End;

            //Main column with text, icons
            TreeViewColumn col = new TreeViewColumn();

            col.PackStart(pixbufRenderer, false);
            col.SetAttributes(pixbufRenderer,
                              "pixbuf", ToolboxStore.Columns.Icon,
                              "visible", ToolboxStore.Columns.IconVisible,
                              "cell-background-gdk", ToolboxStore.Columns.BackgroundColour);

            col.PackEnd(textRenderer, true);
            col.SetAttributes(textRenderer,
                              "text", ToolboxStore.Columns.Label,
                              "weight", ToolboxStore.Columns.FontWeight,
                              "cell-background-gdk", ToolboxStore.Columns.BackgroundColour);

            nodeView.AppendColumn(col);

            //Initialise self
            scrolledWindow.VscrollbarPolicy = PolicyType.Automatic;
            scrolledWindow.HscrollbarPolicy = PolicyType.Never;
            scrolledWindow.WidthRequest     = 150;
            scrolledWindow.AddWithViewport(nodeView);

            //selection events
            nodeView.NodeSelection.Changed += OnSelectionChanged;
            nodeView.RowActivated          += OnRowActivated;

            //update view when toolbox service updated
            toolboxService.ToolboxChanged += new EventHandler(tbsChanged);
            Refresh();

            //track expanded state of nodes
            nodeView.RowCollapsed += new RowCollapsedHandler(whenRowCollapsed);
            nodeView.RowExpanded  += new RowExpandedHandler(whenRowExpanded);

            //set initial state
            filterToggleButton.Active = false;
            catToggleButton.Active    = true;
        }
Ejemplo n.º 37
0
 /// <summary>
 /// Set SLForm State
 /// </summary>
 /// <param name="isshowcursor"></param>
 /// <param name="isborder"></param>
 /// <param name="issizable"></param>
 public void SetSLForm(bool isshowcursor, bool isborder, bool issizable)
 {
     if (config == null)
     {
         config = new AssemblySettings(Assembly.GetAssembly(typeof(AssemblySettings)));
     }
     if (services == null)
     {
         services = new ServiceContainer();
         // Register the service, so components like ContentManager can find it.
         services.AddService<IGraphicsDeviceService>(this);
         cm = new ContentManager(services, config["content"]);
         // Hook the idle event to constantly redraw, getting a game style loop as default.
         Application.Idle += delegate { Invalidate(); };
         this.KeyDown += new KeyEventHandler(SLForm_KeyDown);
         this.MouseDown += new MouseEventHandler(SLForm_MouseDown);
         this.MouseMove += new MouseEventHandler(SLForm_MouseMove);
         this.MouseWheel += new MouseEventHandler(SLForm_MouseWheel);
     }
     // Cursor State
     if (!isshowcursor)
     {
         Cursor.Hide();
     }
     // Border and Sizable States
     if (isborder)
     {
         if (issizable)
         {
             this.Resize += new EventHandler(SLForm_Resize);
         }
         else
         {
             this.MaximizeBox = false;
             this.FormBorderStyle = FormBorderStyle.FixedSingle;
         }
     }
     else
     {
         this.FormBorderStyle = FormBorderStyle.None;
     }
 }
Ejemplo n.º 38
0
        public void AddService_should_throw_ArgumentNullException_on_serviceInstance_null()
        {
            ServiceContainer c = new ServiceContainer();

            Assert.Throws <ArgumentNullException>(() => c.AddService((object)null));
        }
        protected override void OnCreateControl()
        {
            if(!DesignMode) {
                services = new ServiceContainer();
                graphicsDeviceService = GraphicsDeviceService.AddRef(Handle, Width, Height);
                services.AddService<IGraphicsDeviceService>(graphicsDeviceService); // Register the service, so components like ContentManager can find it.
                spriteBatch = new SpriteBatch(GraphicsDevice);
                content = new ContentManager(services, "Content");
                viewport = new Viewport();
                surfaceRectangle = new XNARectangle(0, 0, Width, Height);
                canUpdate = true;

                Initialize();
            }
            base.OnCreateControl();
        }
Ejemplo n.º 40
0
        public ServiceContainer Build()
        {
            ServiceContainer container = new ServiceContainer();
            NodeNameCreationService nodeNameCreationService = new NodeNameCreationService();
            ConfigurationUIHierarchyService configurationUIHierarchy = new ConfigurationUIHierarchyService();

            container.AddService(typeof(INodeNameCreationService), nodeNameCreationService);
            container.AddService(typeof(IConfigurationUIHierarchyService), configurationUIHierarchy);
            container.AddService(typeof(IUIService), this);
            container.AddService(typeof(IErrorLogService), new ErrorLogService());
            container.AddService(typeof(INodeCreationService), new NodeCreationService());
            container.AddService(typeof(IUICommandService), new UICommandService(configurationUIHierarchy));
            return container;
        }
Ejemplo n.º 41
0
 public void Setup()
 {
     this.sc = new ServiceContainer();
     sc.AddService <IFileSystemService>(new FileSystemServiceImpl());
 }
Ejemplo n.º 42
0
        public MainForm()
        {
            InitializeComponent();

            removeToolStripMenuItem.Image  = DefaultTaskList.RemoveImage;
            removeToolStripMenuItem1.Image = DefaultTaskList.RemoveImage;
            btnRemoveFarmServer.Image      = DefaultTaskList.RemoveImage;
            toolStripMenuItem44.Image      = DefaultTaskList.RemoveImage;

            Icon = Resources.iis;
            imageList1.Images.Add(Resources.iis_16);
            imageList1.Images.Add(Resources.server_16);
            imageList1.Images.Add(Resources.application_pools_16);
            imageList1.Images.Add(Resources.sites_16);
            imageList1.Images.Add(Resources.site_16);
            imageList1.Images.Add(Resources.application_16);
            imageList1.Images.Add(Resources.physical_directory_16);
            imageList1.Images.Add(Resources.virtual_directory_16);
            imageList1.Images.Add(Resources.farm_16);
            imageList1.Images.Add(Resources.farm_server_16);
            imageList1.Images.Add(Resources.servers_16);
            btnAbout.Text = string.Format("About Jexus Manager {0}", Assembly.GetExecutingAssembly().GetName().Version);
            treeView1.Nodes.Add(new HomePageTreeNode {
                ContextMenuStrip = cmsIis
            });

            _providers = new List <ModuleProvider>
            {
                new AuthenticationModuleProvider(),
                new AuthorizationModuleProvider(),
                new CgiModuleProvider(),
                new CompressionModuleProvider(),
                new DefaultDocumentModuleProvider(),
                new DirectoryBrowseModuleProvider(),
                new FastCgiModuleProvider(),
                new HttpErrorsModuleProvider(),
                new HandlersModuleProvider(),
                new HttpRedirectModuleProvider(),
                new ResponseHeadersModuleProvider(),
                new IpSecurityModuleProvider(),
                new IsapiCgiRestrictionModuleProvider(),
                new IsapiFiltersModuleProvider(),
                new LoggingModuleProvider(),
                new MimeMapModuleProvider(),
                new ModulesModuleProvider(),
                new CachingModuleProvider(),
                new RequestFilteringModuleProvider(),
                new AccessModuleProvider(),
                new CertificatesModuleProvider(),
                new RewriteModuleProvider(),
                new HttpApiModuleProvider(),
                new JexusModuleProvider()
            };

            _navigationService = new NavigationService(this);
            _navigationService.NavigationPerformed += (sender, args) =>
            {
                var item = new ExplorerNavigationHistoryItem("");
                item.Tag = args.NewItem;
                eanLocation.Navigation.AddHistory(item);
            };
            this.UIService    = new ManagementUIService(this);
            _serviceContainer = new ServiceContainer();
            _serviceContainer.AddService(typeof(INavigationService), _navigationService);
            _serviceContainer.AddService(typeof(IManagementUIService), this.UIService);

            LoadIisExpress();
            this.LoadIis();
            this.LoadJexus();

            Text = NativeMethods.IsProcessElevated ? string.Format("{0} (Administrator)", this.Text) : Text;
        }
Ejemplo n.º 43
0
        //
        //
        //
        private void menuItem_Click(object sender, System.EventArgs e)
        {
            // The IMenuCommandService makes doing common commands easy.
            // It keeps track of what commands and verbs the designer supports
            // and can invoke them given members of the MenuCommands enum (CommandID's).
            IServiceContainer   sc  = host as IServiceContainer;
            IMenuCommandService mcs = sc.GetService(typeof(IMenuCommandService)) as IMenuCommandService;

            switch ((sender as MenuItem).Text)
            {
            case "Cu&t":
                mcs.GlobalInvoke(StandardCommands.Cut);
                break;

            case "&Copy":
                mcs.GlobalInvoke(StandardCommands.Copy);
                break;

            case "&Paste":
                mcs.GlobalInvoke(StandardCommands.Paste);
                break;

            case "&Delete":
                mcs.GlobalInvoke(StandardCommands.Delete);
                break;

            case "Select &All":
                mcs.GlobalInvoke(StandardCommands.SelectAll);
                break;

            case "&Service Requests":
                if (serviceRequests == null)
                {
                    serviceRequests         = new ServiceRequests();
                    serviceRequests.Closed += new EventHandler(OnServiceRequestsClosed);

                    // Our designer host looks for this service to announce the success / failure
                    // of service requests.
                    hostingServiceContainer.AddService(typeof(ServiceRequests), serviceRequests);
                    serviceRequests.Show();
                }
                serviceRequests.Activate();
                break;

            case "&Design":
                tabControl.SelectedTab = tabDesign;
                break;

            case "&C# Source":
                tabControl.SelectedTab = tabCS;
                break;

            case "&VB Source":
                tabControl.SelectedTab = tabVB;
                break;

            case "&XML":
                tabControl.SelectedTab = tabXML;
                break;

            case "&Properties":
                mcs.GlobalInvoke(MenuCommands.Properties);
                break;

            case "Show &Grid":
                mcs.GlobalInvoke(StandardCommands.ShowGrid);
                menuItemShowGrid.Checked = !menuItemShowGrid.Checked;
                break;

            case "S&nap to Grid":
                mcs.GlobalInvoke(StandardCommands.SnapToGrid);
                menuItemSnapToGrid.Checked = !menuItemSnapToGrid.Checked;
                break;

            case "&Lefts":
                mcs.GlobalInvoke(StandardCommands.AlignLeft);
                break;

            case "&Rights":
                mcs.GlobalInvoke(StandardCommands.AlignRight);
                break;

            case "&Tops":
                mcs.GlobalInvoke(StandardCommands.AlignTop);
                break;

            case "&Bottoms":
                mcs.GlobalInvoke(StandardCommands.AlignBottom);
                break;

            case "&Middles":
                mcs.GlobalInvoke(StandardCommands.AlignHorizontalCenters);
                break;

            case "&Centers":
                mcs.GlobalInvoke(StandardCommands.AlignVerticalCenters);
                break;

            case "to &Grid":
                mcs.GlobalInvoke(StandardCommands.AlignToGrid);
                break;

            case "&Horizontally":
                mcs.GlobalInvoke(StandardCommands.CenterHorizontally);
                break;

            case "&Vertically":
                mcs.GlobalInvoke(StandardCommands.CenterVertically);
                break;

            case "&Control":
                mcs.GlobalInvoke(StandardCommands.SizeToControl);
                break;

            case "Control &Width":
                mcs.GlobalInvoke(StandardCommands.SizeToControlWidth);
                break;

            case "Control &Height":
                mcs.GlobalInvoke(StandardCommands.SizeToControlHeight);
                break;

            case "&Grid":
                mcs.GlobalInvoke(StandardCommands.SizeToGrid);
                break;

            case "&Bring to Front":
                mcs.GlobalInvoke(StandardCommands.BringToFront);
                break;

            case "&Send to Back":
                mcs.GlobalInvoke(StandardCommands.SendToBack);
                break;

            case "&Tab Order":
                mcs.GlobalInvoke(StandardCommands.TabOrder);
                break;
            }
        }
Ejemplo n.º 44
0
 public ValidatableObjectTest()
 {
     var container = new ServiceContainer();
     container.AddService( typeof( IValidator ), new ValidatorAdapter() );
     ServiceProvider.SetCurrent( container );
 }
Ejemplo n.º 45
0
 public void AddService(Type serviceType, object serviceInstance)
 {
     serviceContainer.AddService(serviceType, serviceInstance);
 }