Esempio n. 1
0
        protected void Dispose(bool disposing)
        {
            if (!disposing)
            {
                return;
            }

            if (controller != null)
            {
                controller.Dispose();
            }
            if (customization != null)
            {
                customization.Dispose();
            }

            customization = null;
            controller    = null;
        }
Esempio n. 2
0
        private void InitializeResourceStreams(DynamoModel model, LibraryViewCustomization customization)
        {
            //TODO: Remove the parameter after testing.
            //For testing purpose.
            resourceFactory = new ResourceHandlerFactory(model.Logger);

            //Register the resource stream registered through the LibraryViewCustomization
            foreach (var item in customization.Resources)
            {
                OnResourceStreamRegistered(item.Key, item.Value);
            }

            //Setup the event handler for resource registration
            customization.ResourceStreamRegistered += OnResourceStreamRegistered;

            resourceFactory.RegisterProvider("/dist",
                                             new DllResourceProvider("http://localhost/dist",
                                                                     "Dynamo.LibraryUI.web.library"));

            resourceFactory.RegisterProvider(IconUrl.ServiceEndpoint, new IconResourceProvider(model.PathManager));

            {
                var url      = "http://localhost/library.html";
                var resource = "Dynamo.LibraryUI.web.library.library.html";
                var stream   = LoadResource(resource);
                resourceFactory.RegisterHandler(url, ResourceHandler.FromStream(stream));
            }

            //Register provider for node data
            resourceFactory.RegisterProvider("/loadedTypes", new NodeItemDataProvider(model.SearchModel));

            //Register provider for layout spec
            resourceFactory.RegisterProvider("/layoutSpecs", new LayoutSpecProvider(customization, "Dynamo.LibraryUI.web.library.layoutSpecs.json"));

            //Setup the event observer for NodeSearchModel to update customization/spec provider.
            observer = SetupSearchModelEventsObserver(model.SearchModel, this, customization);

            //Register provider for searching node data
            resourceFactory.RegisterProvider(SearchResultDataProvider.serviceIdentifier, new SearchResultDataProvider(model.SearchModel));
        }
Esempio n. 3
0
        /// <summary>
        /// Creates LibraryViewController
        /// </summary>
        /// <param name="dynamoView">DynamoView hosting library component</param>
        /// <param name="commandExecutive">Command executive to run dynamo commands</param>
        internal LibraryViewController(Window dynamoView, ICommandExecutive commandExecutive, LibraryViewCustomization customization)
        {
            this.dynamoWindow  = dynamoView;
            dynamoViewModel    = dynamoView.DataContext as DynamoViewModel;
            libraryViewTooltip = CreateTooltipControl();

            this.commandExecutive = commandExecutive;
            InitializeResourceStreams(dynamoViewModel.Model, customization);
            dynamoWindow.StateChanged += DynamoWindowStateChanged;
            dynamoWindow.SizeChanged  += DynamoWindow_SizeChanged;
        }