Esempio n. 1
0
        protected override void  Initialize(IWebMatrixHost host, ExtensionInitData initData)
        {
            this.Host = (IWebMatrixHostInternal)host;
            this.Globals = new ModuleGlobals(this.Host, this.Host.ServiceProvider);

            this.Host.WebSiteChanged += this.Host_WebSiteChanged;
        }
Esempio n. 2
0
        public WebProjectManager(IPackageRepository source, string siteRoot, IWebMatrixHost host)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            if (String.IsNullOrEmpty(siteRoot))
            {
                throw new ArgumentException("siteRoot");
            }

            _siteRoot = siteRoot;
            string webRepositoryDirectory = GetWebRepositoryDirectory(siteRoot);

            Logger = new ErrorLogger(host);

            var project = new WebProjectSystem(siteRoot);

            project.Logger = Logger;

            _projectManager = new ProjectManager(sourceRepository: source,
                                                   pathResolver: new DefaultPackagePathResolver(webRepositoryDirectory),
                                                   localRepository: PackageRepositoryFactory.Default.CreateRepository(webRepositoryDirectory),
                                                   project: project);
        }
        /// <summary>
        /// Called to initialize the extension.
        /// </summary>
        /// <param name="host">WebMatrix host interface.</param>
        /// <param name="initData">Extension initialization data.</param>
        protected override void Initialize(IWebMatrixHost host, ExtensionInitData initData)
        {
            _webMatrixHost = host;

            initData.RibbonItems.Add(
                new RibbonGroup(
                    "TypeScript",
                    new RibbonItem[]
                        {
                            new RibbonButton(
                        "Compile TypeScript",
                        new DelegateCommand(CanExecute, HandleRibbonButtonCompileTypeScriptInvoke),
                        null,
                        _typescriptCompileImageSmall,
                        _typescriptCompileImageLarge),
                            new RibbonButton(
                        "Update software",
                        new DelegateCommand(CanExecute, HandleRibbonButtonUpdateSoftwareInvoke),
                        null,
                        _typescriptUpdateImageSmall,
                        _typescriptUpdateImageLarge)
                        }));

            _executer = DesignFactory.WebMatrix.ExecuterFactory.GetExecuter(
                "TypeScript", _webMatrixHost, _editorTaskPanel);

            _webMatrixHost.WebSiteChanged += (sender, e) => _executer.InitializeTabs();

            // Register handler for right-click context menu
            _webMatrixHost.ContextMenuOpening += new EventHandler<ContextMenuOpeningEventArgs>(webMatrixHost_ContextMenuOpening);
        }
Esempio n. 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:NuGetPackageManager"/> class.
        /// </summary>
        public NuGetPackageManager(Uri sourceUrl, string siteRoot, IWebMatrixHost host)
        {
            _webProjectManager = new WebProjectManager(sourceUrl.AbsoluteUri, siteRoot, host);

            // set the user agent to reflect the webmatrix assembly version and build number
            var extensibilityAssembly = typeof(IWebMatrixHost).Assembly;
            var assemblyVersion       = extensibilityAssembly.GetName().Version;
            var buildNumber           = FileVersionInfo.GetVersionInfo(extensibilityAssembly.Location).FileBuildPart;
            var clientVersion         = String.Format(UserAgentClientFormat, assemblyVersion, buildNumber);

            this.UserAgent = HttpUtility.CreateUserAgentString(clientVersion);

            var sourceRepository = _webProjectManager.SourceRepository as DataServicePackageRepository;

            if (sourceRepository == null)
            {
                // right now we expect that we're always using DataServicePackageRepository to hit a remote feed
                Debug.Assert(sourceUrl.IsFile, "SourceRepository is not a DataServicePackageRepository");
            }
            else
            {
                // initialize settings that filter the list of packages specifically for WebMatrix
                sourceRepository.SendingRequest += new EventHandler <WebRequestEventArgs>(SourceRepository_SendingRequest);
            }
        }
        /// <summary>
        /// Called to initialize the extension.
        /// </summary>
        /// <param name="host">WebMatrix host interface.</param>
        /// <param name="initData">Extension initialization data.</param>
        protected override void Initialize(IWebMatrixHost host, ExtensionInitData initData)
        {
            _webMatrixHost = host;

            initData.RibbonItems.Add(
                new RibbonGroup(
                    "TypeScript",
                    new RibbonItem[]
            {
                new RibbonButton(
                    "Compile TypeScript",
                    new DelegateCommand(CanExecute, HandleRibbonButtonCompileTypeScriptInvoke),
                    null,
                    _typescriptCompileImageSmall,
                    _typescriptCompileImageLarge),
                new RibbonButton(
                    "Update software",
                    new DelegateCommand(CanExecute, HandleRibbonButtonUpdateSoftwareInvoke),
                    null,
                    _typescriptUpdateImageSmall,
                    _typescriptUpdateImageLarge)
            }));

            _executer = DesignFactory.WebMatrix.ExecuterFactory.GetExecuter(
                "TypeScript", _webMatrixHost, _editorTaskPanel);

            _webMatrixHost.WebSiteChanged += (sender, e) => _executer.InitializeTabs();

            // Register handler for right-click context menu
            _webMatrixHost.ContextMenuOpening += new EventHandler <ContextMenuOpeningEventArgs>(webMatrixHost_ContextMenuOpening);
        }
        public WebProjectManager(IPackageRepository source, string siteRoot, IWebMatrixHost host)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            if (String.IsNullOrEmpty(siteRoot))
            {
                throw new ArgumentException("siteRoot");
            }

            _siteRoot = siteRoot;
            string webRepositoryDirectory = GetWebRepositoryDirectory(siteRoot);

            Logger = new ErrorLogger(host);

            var project = new WebProjectSystem(siteRoot);

            project.Logger = Logger;

            _projectManager = new ProjectManager(sourceRepository: source,
                                                 pathResolver: new DefaultPackagePathResolver(webRepositoryDirectory),
                                                 localRepository: PackageRepositoryFactory.Default.CreateRepository(webRepositoryDirectory),
                                                 project: project);
        }
Esempio n. 7
0
        protected override void  Initialize(IWebMatrixHost host, ExtensionInitData initData)
        {
            this.Host    = (IWebMatrixHostInternal)host;
            this.Globals = new ModuleGlobals(this.Host, this.Host.ServiceProvider);

            this.Host.WebSiteChanged += this.Host_WebSiteChanged;
        }
Esempio n. 8
0
 /// <summary>
 /// create a new timer, and check the queue periodically for new requests
 /// </summary>
 public Worker(IWebMatrixHost host)
 {
     this.host = host;
     timer.Interval = 500;
     timer.Elapsed += new ElapsedEventHandler(t_Elapsed);
     timer.AutoReset = false;
     timer.Start();
 }
Esempio n. 9
0
        //--------------------------------------------------------------------------
        //
        //	Constructors
        //
        //--------------------------------------------------------------------------

        #region Constructor
        /// <summary>
        /// create a new timer, and check the queue periodically for new requests
        /// </summary>
        public Worker(IWebMatrixHost host)
        {
            this.host       = host;
            timer.Interval  = 500;
            timer.Elapsed  += new ElapsedEventHandler(t_Elapsed);
            timer.AutoReset = false;
            timer.Start();
        }
            public ErrorLogger(IWebMatrixHost host)
            {
                if (host == null)
                {
                    throw new ArgumentNullException("host");
                }

                _host = host;
            }
Esempio n. 11
0
        public ModuleGlobals(IWebMatrixHost host, IServiceProvider serviceProvider)
        {
            this.Host = host;
            this.ServiceProvider = serviceProvider;

            var compositionService = this.ServiceProvider.GetService<CompositionService>();
            compositionService.SatisfyImportsOnce(this);

            this.CommandTarget = new NuGetCommandTarget(this);
        }
        public ModuleGlobals(IWebMatrixHost host, IServiceProvider serviceProvider)
        {
            this.Host            = host;
            this.ServiceProvider = serviceProvider;

            var compositionService = this.ServiceProvider.GetService <CompositionService>();

            compositionService.SatisfyImportsOnce(this);

            this.CommandTarget = new NuGetCommandTarget(this);
        }
Esempio n. 13
0
        //--------------------------------------------------------------------------
        //
        //	Event Handlers
        //
        //--------------------------------------------------------------------------

        #region Initialize
        /// <summary>
        /// get a reference to the host when the app starts
        /// </summary>
        /// <param name="host"></param>
        protected override void Initialize(IWebMatrixHost host, ExtensionInitData data)
        {
            // add host event handlers
            _host = host;
            if (host != null)
            {
                host.WebSiteChanged += new EventHandler <EventArgs>(WebMatrixHost_WebSiteChanged);
                _worker              = new Worker(host);

                host.ContextMenuOpening += new EventHandler <ContextMenuOpeningEventArgs>(host_ContextMenuOpening);
                InitSite();
            }
        }
Esempio n. 14
0
        //--------------------------------------------------------------------------
        //
        //	Constructors
        //
        //--------------------------------------------------------------------------

        #region Constructor
        /// <summary>
        /// create a new timer, and check the queue periodically for new requests
        /// </summary>
        public Worker(IWebMatrixHost host)
        {
            this.host       = host;
            timer.Interval  = 500;
            timer.Elapsed  += new ElapsedEventHandler(t_Elapsed);
            timer.AutoReset = false;
            timer.Start();

            compiler.OutputDataReceived += (sender, e) =>
            {
                var level = e.OutputType == OutputReceivedEventArgs.DataType.ERROR ? TraceLevel.Error : TraceLevel.Info;
                this.host.Logger.Log(level, e.Output);
            };
        }
Esempio n. 15
0
        /// <summary>
        /// create a new timer, and check the queue periodically for new requests
        /// </summary>
        public Worker(IWebMatrixHost host)
        {
            this.host = host;
            timer.Interval = 500;
            timer.Elapsed += new ElapsedEventHandler(t_Elapsed);
            timer.AutoReset = false;
            timer.Start();

            compiler.OutputDataReceived += (sender, e) =>
            {
                var level = e.OutputType == OutputReceivedEventArgs.DataType.ERROR ? TraceLevel.Error : TraceLevel.Info;
                this.host.Logger.Log(level, e.Output);
            };
        }
Esempio n. 16
0
        public static NuGetModel GetModel(INuGetGalleryDescriptor descriptor, IWebMatrixHost webMatrixHost, FeedSource remoteSource, string destination, Func <Uri, string, INuGetPackageManager> packageManagerCreator, TaskScheduler scheduler, bool includePrerelease = false)
        {
            if (destination == null)
            {
                var siteRoot = webMatrixHost.WebSite == null ? null : webMatrixHost.WebSite.Path;

                if (String.IsNullOrWhiteSpace(siteRoot))
                {
                    Debug.Fail("The NuGetModel needs a site with a physical path");
                    return(null);
                }

                destination = siteRoot;
            }

            NuGetModel model;

            lock (_cache)
            {
                var key = new Tuple <string, FeedSource, bool>(destination, remoteSource, includePrerelease);
                if (_cache.TryGetValue(key, out model))
                {
                    model.FromCache = true;
                }
                else
                {
                    INuGetPackageManager packageManager;
                    if (packageManagerCreator == null)
                    {
                        packageManager = new NuGetPackageManager(remoteSource.SourceUrl, destination, webMatrixHost);
                    }
                    else
                    {
                        packageManager = packageManagerCreator(remoteSource.SourceUrl, destination);
                    }

                    model = new NuGetModel(descriptor, webMatrixHost, remoteSource, destination, packageManager, scheduler);
                    packageManager.IncludePrerelease = includePrerelease;
                    _cache[key] = model;
                }
            }

            Debug.Assert(model != null, "model should be created");

            return(model);
        }
Esempio n. 17
0
        public static NuGetModel GetModel(INuGetGalleryDescriptor descriptor, IWebMatrixHost webMatrixHost, FeedSource remoteSource, string destination, Func<Uri, string, INuGetPackageManager> packageManagerCreator, TaskScheduler scheduler, bool includePrerelease = false)
        {
            if (destination == null)
            {
                var siteRoot = webMatrixHost.WebSite == null ? null : webMatrixHost.WebSite.Path;

                if (String.IsNullOrWhiteSpace(siteRoot))
                {
                    Debug.Fail("The NuGetModel needs a site with a physical path");
                    return null;
                }

                destination = siteRoot;
            }

            NuGetModel model;
            lock (_cache)
            {
                var key = new Tuple<string, FeedSource, bool>(destination, remoteSource, includePrerelease);
                if (_cache.TryGetValue(key, out model))
                {
                    model.FromCache = true;
                }
                else
                {
                    INuGetPackageManager packageManager;
                    if (packageManagerCreator == null)
                    {
                        packageManager = new NuGetPackageManager(remoteSource.SourceUrl, destination, webMatrixHost);
                    }
                    else
                    {
                        packageManager = packageManagerCreator(remoteSource.SourceUrl, destination);
                    }

                    model = new NuGetModel(descriptor, webMatrixHost, remoteSource, destination, packageManager, scheduler);
                    packageManager.IncludePrerelease = includePrerelease;
                    _cache[key] = model;
                }
            }

            Debug.Assert(model != null, "model should be created");

            return model;
        }
 public static void Initialize(IWebMatrixHost webMatrixHost, IEditorTaskPanelService editorTaskPanelService)
 {
     if (webMatrixHost == null || editorTaskPanelService == null)
     {
         MessageBox.Show("Extension not working correctly. Extension must call DesignFactory.WebMatrix.Executer.Initialize() function correctly. WebMatrixHost or EditorTaskPanelService is null.", "Extension failure", MessageBoxButton.OK);
     }
     else
     {
         if (!_isInitialised)
         {
             WebMatrixHost = webMatrixHost;
             EditorTaskPanelService = editorTaskPanelService;
             OutputPaneInstance = new OutputPane();
             TaskListPaneInstance = new TaskListPane();
             _isInitialised = true;
         }
     }
 }
Esempio n. 19
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:NuGetModel"/> class.
        /// <remarks>This is internal for tests. Callers inside of the NuGet module should used NuGetDataCache::GetModel to
        /// take advantage of cachein</remarks>
        /// </summary>
        internal NuGetModel(INuGetGalleryDescriptor descriptor, IWebMatrixHost host, FeedSource remoteSource, string destination, INuGetPackageManager packageManager, TaskScheduler scheduler)
        {
            Debug.Assert(host != null, "webMatrixHost must not be null");
            Debug.Assert(remoteSource != null, "remoteSource must not be null");
            Debug.Assert(remoteSource.SourceUrl != null, "remoteSource.SourceUrl must not be null");

            this.Descriptor = descriptor;
            this.Scheduler  = scheduler;

            FeedSource     = remoteSource;
            _webMatrixHost = host;
            _packageKind   = descriptor.PackageKind;
            _galleryId     = descriptor.GalleryId;

            this.PackageManager = packageManager;

            this.FilterManager = new FilterManager(this, this.Scheduler, descriptor);
        }
        public static DesignFactory.WebMatrix.IExecuter.IExecuter GetExecuter(string tasksource, IWebMatrixHost webMatrixHost, IEditorTaskPanelService editorTaskPanelService)
        {
            string newestAssemblyFile = null;
            Version newestAssemblyVersion = null;

            string webMatrixExtensionsFolder = Path.GetDirectoryName(Path.GetDirectoryName(new System.Uri(System.Reflection.Assembly.GetExecutingAssembly().CodeBase).LocalPath));
            var assemblyFiles = Directory.EnumerateFiles(webMatrixExtensionsFolder, "DesignFactory.WebMatrix.Executer.dll", SearchOption.AllDirectories);
            foreach (string currentAssemblyFile in assemblyFiles)
            {
                AssemblyName currentAssemblyName = AssemblyName.GetAssemblyName(currentAssemblyFile);
                if (newestAssemblyFile == null || currentAssemblyName.Version.CompareTo(newestAssemblyVersion) > 0)
                {
                    newestAssemblyFile = currentAssemblyFile;
                    newestAssemblyVersion = currentAssemblyName.Version;
                }
            }

            if (newestAssemblyFile == null)
            {
                return null;
            }

            // If an assembly with the same identity is already loaded, LoadFrom returns the loaded assembly even if a different path was specified.
            // http://msdn.microsoft.com/en-us/library/1009fa28.aspx
            Assembly executerAssembly = Assembly.LoadFrom(newestAssemblyFile);

            DesignFactory.WebMatrix.IExecuter.IExecuter executer = (DesignFactory.WebMatrix.IExecuter.IExecuter)executerAssembly.CreateInstance("DesignFactory.WebMatrix.Executer.Executer");
            if (executer == null)
            {
                throw new Exception(String.Format("Failed to instantiate Executer functionality on DesignFactory.WebMatrix.Executer assembly.\nAssembly={0}\nVersion={1}", newestAssemblyFile, newestAssemblyVersion));
            }
            else
            {
                executer.Initialize(tasksource, webMatrixHost, editorTaskPanelService);

                // Mandatory to get the tab showing on changes!
                editorTaskPanelService.PageChanged += (object sender, EventArgs eventArgs) => { executer.InitializeTabs(); };

                // Mandatory to get tabs displayed directly!
                executer.InitializeTabs();
            }
            return executer;
        }
Esempio n. 21
0
        //--------------------------------------------------------------------------
        //
        //	Methods
        //
        //--------------------------------------------------------------------------

        /// <summary>
        /// Called to initialize the extension.
        /// </summary>
        /// <param name="host">WebMatrix host interface.</param>
        /// <param name="initData">Extension initialization data.</param>
        protected override void Initialize(IWebMatrixHost host, ExtensionInitData initData)
        {
            _webMatrixHost = host;
            _webMatrixHost.WebSiteChanged += webMatrixHost_WebSiteChanged;

            // create a new ribbon button group that contains the get version button
            _ribbonGroup = new RibbonGroup(
                "NumediaStack",
                new RibbonItem[]
            {
                new RibbonButton(
                    "Get Version",
                    new DelegateCommand(HandleGetVersion),
                    null,
                    _starImageSmall,
                    _starImageLarge)
            });

            // create a new contextual ribbon tab that will only show up for Numedia Stack
            _contextualTab = new RibbonContextualTab("Numedia Stack Tools", new RibbonItem[] { _ribbonGroup });
        }
Esempio n. 22
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:NuGetViewModel"/> class.
        /// </summary>
        public NuGetViewModel(
            INuGetGalleryDescriptor descriptor,
            IWebMatrixHost host,
            PackageSourcesViewModel packageSourcesViewModel, 
            Func<Uri, string, INuGetPackageManager> packageManagerCreator, 
            string destination,
            TaskScheduler scheduler)
        {
            this.Descriptor = descriptor;
            this.Host = host;
            this.Scheduler = scheduler;

            _packageManagerCreator = packageManagerCreator;
            _destination = destination;
            _preferences = this.Host.GetExtensionSpecificPreferences(this.Descriptor.PreferencesStore);
            _selectedPrereleaseFilter = LoadPrereleaseFilter();
            _includePrerelease = (_selectedPrereleaseFilter == Resources.Prerelease_Filter_IncludePrerelease);
            PackagesToDisplayForUpdateAll = new List<PackageViewModel>();

            this.ShowDetailsPageCommand = new RelayCommand(this.ShowDetailsPage, this.CanShowDetailsPage);
            this.ShowLicensePageCommand = new RelayCommand(this.ShowLicensePage, this.CanShowLicensePage);
            this.ShowUninstallPageCommand = new RelayCommand(this.ShowUninstallPage, this.CanShowUninstallPage);

            this.ShowListCommand = new RelayCommand(this.ShowList, this.CanShowList);

            this.InstallCommand = new RelayCommand(this.Install, this.CanInstall);
            this.UpdateCommand = new RelayCommand(this.Update, this.CanUpdate);
            this.UninstallCommand = new RelayCommand(this.Uninstall, this.CanUninstall);

            this.UpdateAllCommand = new RelayCommand(this.UpdateAll, this.CanUpdateAll);
            this.ShowLicensePageForAllCommand = new RelayCommand(this.ShowLicensePageForAll, this.CanShowLicensePageForAll);

            this.DisableCommand = new RelayCommand(this.Disable, this.CanDisable);
            this.EnableCommand = new RelayCommand(this.Enable, this.CanEnable);

            this.DefaultActionCommand = new RelayCommand(this.DefaultAction, this.CanDefaultAction);

            // Initialize the Package Sources
            InitializePackageSources(packageSourcesViewModel);
        }
Esempio n. 23
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:NuGetViewModel"/> class.
        /// </summary>
        public NuGetViewModel(
            INuGetGalleryDescriptor descriptor,
            IWebMatrixHost host,
            PackageSourcesViewModel packageSourcesViewModel,
            Func <Uri, string, INuGetPackageManager> packageManagerCreator,
            string destination,
            TaskScheduler scheduler)
        {
            this.Descriptor = descriptor;
            this.Host       = host;
            this.Scheduler  = scheduler;

            _packageManagerCreator        = packageManagerCreator;
            _destination                  = destination;
            _preferences                  = this.Host.GetExtensionSpecificPreferences(this.Descriptor.PreferencesStore);
            _selectedPrereleaseFilter     = LoadPrereleaseFilter();
            _includePrerelease            = (_selectedPrereleaseFilter == Resources.Prerelease_Filter_IncludePrerelease);
            PackagesToDisplayForUpdateAll = new List <PackageViewModel>();

            this.ShowDetailsPageCommand   = new RelayCommand(this.ShowDetailsPage, this.CanShowDetailsPage);
            this.ShowLicensePageCommand   = new RelayCommand(this.ShowLicensePage, this.CanShowLicensePage);
            this.ShowUninstallPageCommand = new RelayCommand(this.ShowUninstallPage, this.CanShowUninstallPage);

            this.ShowListCommand = new RelayCommand(this.ShowList, this.CanShowList);

            this.InstallCommand   = new RelayCommand(this.Install, this.CanInstall);
            this.UpdateCommand    = new RelayCommand(this.Update, this.CanUpdate);
            this.UninstallCommand = new RelayCommand(this.Uninstall, this.CanUninstall);

            this.UpdateAllCommand             = new RelayCommand(this.UpdateAll, this.CanUpdateAll);
            this.ShowLicensePageForAllCommand = new RelayCommand(this.ShowLicensePageForAll, this.CanShowLicensePageForAll);

            this.DisableCommand = new RelayCommand(this.Disable, this.CanDisable);
            this.EnableCommand  = new RelayCommand(this.Enable, this.CanEnable);

            this.DefaultActionCommand = new RelayCommand(this.DefaultAction, this.CanDefaultAction);

            // Initialize the Package Sources
            InitializePackageSources(packageSourcesViewModel);
        }
Esempio n. 24
0
        //--------------------------------------------------------------------------
        //
        //	Event Handlers
        //
        //--------------------------------------------------------------------------

        #region Initialize
        /// <summary>
        /// Called when the WebMatrixHost property changes.
        /// </summary>
        /// <param name="Host">Host used to communicate with WebMatrix</param>
        protected override void Initialize(IWebMatrixHost host, ExtensionInitData data)
        {
            // Get new values
            _host = host;
            if (host != null)
            {
                host.WorkspaceChanged += new EventHandler <WorkspaceChangedEventArgs>(WebMatrixHost_WorkspaceChanged);
                host.WebSiteChanged   += new EventHandler <EventArgs>(WebMatrixHost_WebSiteChanged);

                // Add a simple button to the Ribbon
                _ribbonGroup = new RibbonGroup(
                    "Node",
                    new RibbonItem[]
                {
                    new RibbonButton(
                        "Debug",
                        _launchDebuggerCommand,
                        null,
                        _starImageSmall,
                        _starImageLarge)
                });
                data.RibbonItems.Add(_ribbonGroup);
                _editorTaskPanel.PageChanged += InitializeLogTab;

                // handle the right click event the tree
                host.ContextMenuOpening += new EventHandler <ContextMenuOpeningEventArgs>(host_ContextMenuOpening);

                // if this is the first time the extension is installed, this method will be called
                if (_host.WebSite != null && !String.IsNullOrEmpty(_host.WebSite.Path))
                {
                    _isNodeSite            = IsNodeProject();
                    _ribbonGroup.IsVisible = _host.Workspace is IEditorWorkspace && _isNodeSite;
                    InitializeLogTab(this, EventArgs.Empty);
                }

                InstallNodeInspector();
            }
        }
Esempio n. 25
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:NuGetPackageManager"/> class.
        /// </summary>
        public NuGetPackageManager(Uri sourceUrl, string siteRoot, IWebMatrixHost host)
        {
            _webProjectManager = new WebProjectManager(sourceUrl.AbsoluteUri, siteRoot, host);

            // set the user agent to reflect the webmatrix assembly version and build number
            var extensibilityAssembly = typeof(IWebMatrixHost).Assembly;
            var assemblyVersion = extensibilityAssembly.GetName().Version;
            var buildNumber = FileVersionInfo.GetVersionInfo(extensibilityAssembly.Location).FileBuildPart;
            var clientVersion = String.Format(UserAgentClientFormat, assemblyVersion, buildNumber);
            this.UserAgent = HttpUtility.CreateUserAgentString(clientVersion);

            var sourceRepository = _webProjectManager.SourceRepository as DataServicePackageRepository;
            if (sourceRepository == null)
            {
                // right now we expect that we're always using DataServicePackageRepository to hit a remote feed
                Debug.Assert(sourceUrl.IsFile, "SourceRepository is not a DataServicePackageRepository");
            }
            else
            {
                // initialize settings that filter the list of packages specifically for WebMatrix
                sourceRepository.SendingRequest += new EventHandler<WebRequestEventArgs>(SourceRepository_SendingRequest);
            }
        }
Esempio n. 26
0
 public static NuGetModel GetModel(INuGetGalleryDescriptor descriptor, IWebMatrixHost webMatrixHost, FeedSource remoteSource, bool includePrerelease = false)
 {
     return GetModel(descriptor, webMatrixHost, remoteSource, null, null, TaskScheduler.Default);
 }
Esempio n. 27
0
 public WebProjectManager(string remoteSource, string siteRoot, IWebMatrixHost host)
     : this(PackageRepositoryFactory.Default.CreateRepository(remoteSource), siteRoot, host)
 {
 }
Esempio n. 28
0
            public ErrorLogger(IWebMatrixHost host)
            {
                if (host == null)
                {
                    throw new ArgumentNullException("host");
                }

                _host = host;
            }
Esempio n. 29
0
        protected override void Initialize(IWebMatrixHost host, ExtensionInitData initData)
        {
            this.webMatrixHost = host;
            this.webMatrixHost.WebSiteChanged += new EventHandler<EventArgs>(host_WebSiteChanged);
            this.webMatrixHost.TreeItemCreated += new EventHandler<TreeItemEventArgs>(webMatrixHost_TreeItemCreated);
            this.webMatrixHost.TreeItemRemoved += new EventHandler<TreeItemEventArgs>(webMatrixHost_TreeItemRemoved);
            this.webMatrixHost.ContextMenuOpening += new EventHandler<ContextMenuOpeningEventArgs>(webMatrixHost_ContextMenuOpening);

            var list = new List<RibbonButton>{
                new RibbonButton("Initialize", this.gitInitCommand, null, Resources.git_init, Resources.git_32),
                //new RibbonButton("Clone", this.gitInitCommand, null, Resources.git_init, Resources.git_32),
                new RibbonButton("Commit Changes", this.gitCommitCommand, null, Resources.git_16, Resources.git_32),
                new RibbonButton("View Log/History", this.gitLogCommand, null, Resources.git_16, Resources.git_32),
                new RibbonButton("Refresh", this.gitRefreshCommand, null, Resources.git_16, Resources.git_32),
                new RibbonButton("Run Git Bash", this.gitBashCommand, null, Resources.git_16, Resources.git_32),
            };
            var button = new RibbonSplitButton("Git", this.gitBashCommand, null, list, Resources.git_16, Resources.git_32);
            initData.RibbonItems.Add(button);
        }
Esempio n. 30
0
 public static NuGetModel GetModel(INuGetGalleryDescriptor descriptor, IWebMatrixHost webMatrixHost, FeedSource remoteSource, bool includePrerelease = false)
 {
     return(GetModel(descriptor, webMatrixHost, remoteSource, null, null, TaskScheduler.Default));
 }
        //--------------------------------------------------------------------------
        //
        //	Event Handlers
        //
        //--------------------------------------------------------------------------      

        #region Initialize
        /// <summary>
        /// Called when the WebMatrixHost property changes.
        /// </summary>
        /// <param name="Host">Host used to communicate with WebMatrix</param>
        protected override void Initialize(IWebMatrixHost host, ExtensionInitData data)
        {
            // Get new values
            _host = host;
            if (host != null)
            {
                host.WorkspaceChanged += new EventHandler<WorkspaceChangedEventArgs>(WebMatrixHost_WorkspaceChanged);
                host.WebSiteChanged += new EventHandler<EventArgs>(WebMatrixHost_WebSiteChanged);

                // Add a simple button to the Ribbon
                _ribbonGroup = new RibbonGroup(
                        "Node",
                        new RibbonItem[]
                        {
                            new RibbonButton(
                                "Debug",
                                _launchDebuggerCommand,
                                null,
                                _starImageSmall,
                                _starImageLarge)
                        });
                data.RibbonItems.Add(_ribbonGroup);
                _editorTaskPanel.PageChanged += InitializeLogTab;

                // handle the right click event the tree
                host.ContextMenuOpening += new EventHandler<ContextMenuOpeningEventArgs>(host_ContextMenuOpening);

                // if this is the first time the extension is installed, this method will be called                                               
                if (_host.WebSite != null && !String.IsNullOrEmpty(_host.WebSite.Path))
                {
                    _isNodeSite = IsNodeProject();
                    _ribbonGroup.IsVisible = _host.Workspace is IEditorWorkspace && _isNodeSite;
                    InitializeLogTab(this, EventArgs.Empty);
                }

                InstallNodeInspector();

            }
        }
Esempio n. 32
0
        /// <summary>
        /// get a reference to the host when the app starts
        /// </summary>
        /// <param name="host"></param>
        protected override void Initialize(IWebMatrixHost host, ExtensionInitData data)
        {
            // add host event handlers
            _host = host;
            if (host != null)
            {
                host.WebSiteChanged += new EventHandler<EventArgs>(WebMatrixHost_WebSiteChanged);
                _worker = new Worker(host);

                host.ContextMenuOpening += new EventHandler<ContextMenuOpeningEventArgs>(host_ContextMenuOpening);
                InitSite();
            }
        }
 public WebProjectManager(string remoteSource, string siteRoot, IWebMatrixHost host)
     : this(PackageRepositoryFactory.Default.CreateRepository(remoteSource), siteRoot, host)
 {
 }
        //--------------------------------------------------------------------------
        //
        //	Methods
        //
        //--------------------------------------------------------------------------

        /// <summary>
        /// Called to initialize the extension.
        /// </summary>
        /// <param name="host">WebMatrix host interface.</param>
        /// <param name="initData">Extension initialization data.</param>
        protected override void Initialize(IWebMatrixHost host, ExtensionInitData initData)
        {
            _webMatrixHost = host;
            _webMatrixHost.WebSiteChanged += webMatrixHost_WebSiteChanged;
                                  
            // create a new ribbon button group that contains the get version button
            _ribbonGroup = new RibbonGroup(
                   "NumediaStack",
                   new RibbonItem[]
                    {
                        new RibbonButton(
                            "Get Version",
                            new DelegateCommand(HandleGetVersion),
                            null,
                            _starImageSmall,
                            _starImageLarge)
                    });

            // create a new contextual ribbon tab that will only show up for Numedia Stack 
            _contextualTab = new RibbonContextualTab("Numedia Stack Tools", new RibbonItem[] { _ribbonGroup });
        }
Esempio n. 35
0
 public void Initialize(string tasksource, IWebMatrixHost webMatrixHost, IEditorTaskPanelService editorTaskPanelService)
 {
     _tasksource = tasksource;
     _webMatrixHost = webMatrixHost;
     DesignFactory.WebMatrix.Executer.WebMatrixContext.Initialize(webMatrixHost, editorTaskPanelService);
 }
Esempio n. 36
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:NuGetModel"/> class.
        /// <remarks>This is internal for tests. Callers inside of the NuGet module should used NuGetDataCache::GetModel to 
        /// take advantage of cachein</remarks>
        /// </summary>
        internal NuGetModel(INuGetGalleryDescriptor descriptor, IWebMatrixHost host, FeedSource remoteSource, string destination, INuGetPackageManager packageManager, TaskScheduler scheduler)
        {
            Debug.Assert(host != null, "webMatrixHost must not be null");
            Debug.Assert(remoteSource != null, "remoteSource must not be null");
            Debug.Assert(remoteSource.SourceUrl != null, "remoteSource.SourceUrl must not be null");

            this.Descriptor = descriptor;
            this.Scheduler = scheduler;

            FeedSource = remoteSource;
            _webMatrixHost = host;
            _packageKind = descriptor.PackageKind;
            _galleryId = descriptor.GalleryId;

            this.PackageManager = packageManager;

            this.FilterManager = new FilterManager(this, this.Scheduler, descriptor);
        }