/// <summary>
        ///     This method is called by the docdata whenever the inherent filename changes. Clients should not call this
        ///     method directly; they should subscribe to MicrosoftDataEntityDesignPackage.FileNameChanged event.
        /// </summary>
        /// <param name="oldFileName"></param>
        /// <param name="newFileName"></param>
        public void OnFileNameChanged(string oldFileName, string newFileName)
        {
            var args = new ModelChangeEventArgs();

            args.OldFileName = oldFileName;
            args.NewFileName = newFileName;
            FileNameChanged(this, args);
        }
Example #2
0
        private void HandleModelChange(object sender, ModelChangeEventArgs e)
        {
            var action = TryGetActionFor(e.PropertyId);

            if (action != null)
            {
                action();
            }
        }
        public void ModelChange(object sender, ModelChangeEventArgs e)
        {
            Product product = manager.getManagerSQL().GetSqlTableProducts().getProduct(e.Number);

            if (product != null)
            {
                listProductsView.add(product);
                productView.add(product);
            }
        }
Example #4
0
        public void ModelChange(object sender, ModelChangeEventArgs e)
        {
            string newText = (e.ElapsedMilliseconds / 1000).ToString("n") + " seg.";

            lblTiempoTotal.Invoke((MethodInvoker) delegate {
                lblTiempoTotal.Text = newText;
            });

            marqueeProgressBarControl1.Invoke((MethodInvoker) delegate {
                marqueeProgressBarControl1.Visible = false;
            });
        }
        public void ServerModelChange(object sender, ModelChangeEventArgs eventArgs)
        {
            if (eventArgs.EventType == ModelChangeEventType.Add)
            {
                var dataRow = _itemsDataTable.NewRow();
                dataRow["ID"]        = eventArgs.Id;
                dataRow["Type"]      = eventArgs.Type;
                dataRow["Value"]     = eventArgs.Value;
                dataRow["Quality"]   = eventArgs.Quality;
                dataRow["Timestamp"] = eventArgs.Timestamp;
                _itemsDataTable.Rows.Add(dataRow);

                Color backColor;
                if (eventArgs.Quality.Equals(OpcUtility.ITEM_QUALITY_BAD))
                {
                    backColor = Color.LightGray;
                }
                else
                {
                    backColor = Color.White;
                }
                _itemsBackColorDictionary.Add(eventArgs.Id, backColor);

                m_ItemsCountLabelValue.Text = _itemsDataTable.Rows.Count.ToString();
                UpdateTreeView(eventArgs.Id);
            }
            else
            {
                var dataRow = _itemsDataTable.Rows.Find(eventArgs.Id);
                if (dataRow != null)
                {
                    if (!dataRow.ItemArray[2].Equals(eventArgs.Value) ||
                        !dataRow.ItemArray[3].Equals(eventArgs.Quality) ||
                        !dataRow.ItemArray[4].Equals(eventArgs.Timestamp))
                    {
                        dataRow["Value"]     = eventArgs.Value;
                        dataRow["Quality"]   = eventArgs.Quality;
                        dataRow["Timestamp"] = eventArgs.Timestamp;

                        _itemsBackColorDictionary.Remove(eventArgs.Id);
                        _itemsBackColorDictionary.Add(eventArgs.Id, Color.LightGreen);
                    }
                }
            }
        }
        public void ServerModelChange(object p_Sender, ModelChangeEventArgs p_EvArgs)
        {
            if (p_EvArgs.EventType == ModelChangeEventType.ADD)
            {
                DataRow l_Row = m_ItemsDataTable.NewRow();
                l_Row["ID"]        = p_EvArgs.ID;
                l_Row["Type"]      = p_EvArgs.Type;
                l_Row["Value"]     = p_EvArgs.Value;
                l_Row["Quality"]   = p_EvArgs.Quality;
                l_Row["Timestamp"] = p_EvArgs.Timestamp;
                m_ItemsDataTable.Rows.Add(l_Row);

                System.Drawing.Color l_BackColor;
                if (p_EvArgs.Quality.Equals(OPCUtility.ITEM_QUALITY_BAD))
                {
                    l_BackColor = System.Drawing.Color.LightGray;
                }
                else
                {
                    l_BackColor = System.Drawing.Color.White;
                }
                m_ItemsBackColorDictionary.Add(p_EvArgs.ID, l_BackColor);

                m_ItemsCountLabelValue.Text = m_ItemsDataTable.Rows.Count.ToString();
                UpdateTreeView(p_EvArgs.ID);
            }
            else
            {
                DataRow l_Row = m_ItemsDataTable.Rows.Find(p_EvArgs.ID);
                if (l_Row != null)
                {
                    if (!l_Row.ItemArray[2].Equals(p_EvArgs.Value) ||
                        !l_Row.ItemArray[3].Equals(p_EvArgs.Quality) ||
                        !l_Row.ItemArray[4].Equals(p_EvArgs.Timestamp))
                    {
                        l_Row["Value"]     = p_EvArgs.Value;
                        l_Row["Quality"]   = p_EvArgs.Quality;
                        l_Row["Timestamp"] = p_EvArgs.Timestamp;

                        m_ItemsBackColorDictionary.Remove(p_EvArgs.ID);
                        m_ItemsBackColorDictionary.Add(p_EvArgs.ID, System.Drawing.Color.LightGreen);
                    }
                }
            }
        }
        public int OnAfterSave(uint docCookie)
        {
            var hr = VSConstants.S_OK;
            if (AfterSaveFile != null)
            {
                var docTable = Services.IVsRunningDocumentTable;
                uint rdtFlags, readLocks, editLocks, itemId;
                string fileName;
                IVsHierarchy hierarchy;
                var docData = IntPtr.Zero;

                try
                {
                    hr = docTable.GetDocumentInfo(
                        docCookie, out rdtFlags, out readLocks, out editLocks, out fileName, out hierarchy, out itemId, out docData);
                }
                finally
                {
                    if (docData != IntPtr.Zero)
                    {
                        Marshal.Release(docData);
                    }
                }

                if (hr == VSConstants.S_OK
                    && hierarchy != null)
                {
                    var projectObj = VSHelpers.GetProject(hierarchy);
                    if (projectObj != null)
                    {
                        var args = new ModelChangeEventArgs();
                        args.DocCookie = docCookie;
                        args.Artifact = PackageManager.Package.ModelManager.GetArtifact(Utils.FileName2Uri(fileName));
                        args.ProjectObj = projectObj;
                        hr = AfterSaveFile(this, args);
                    }
                }
            }
            return hr;
        }
 public int OnBeforeValidateModel(Project project, EFArtifact artifact, bool isCurrentlyBuilding)
 {
     var args = new ModelChangeEventArgs();
     args.ProjectObj = project;
     args.Artifact = artifact;
     args.IsCurrentlyBuilding = isCurrentlyBuilding;
     if (BeforeValidateModel != null)
     {
         return BeforeValidateModel(this, args);
     }
     else
     {
         return 0;
     }
 }
 public int OnBeforeGenerateDDL(Project project, EFArtifact artifact)
 {
     var args = new ModelChangeEventArgs();
     args.ProjectObj = project;
     args.Artifact = artifact;
     if (BeforeGenerateDDL != null)
     {
         return BeforeGenerateDDL(this, args);
     }
     else
     {
         return 0;
     }
 }
        public int OnQueryRemoveFiles(
            IVsProject pProject, int cFiles, string[] rgpszMkDocuments, VSQUERYREMOVEFILEFLAGS[] rgFlags,
            VSQUERYREMOVEFILERESULTS[] pSummaryResult, VSQUERYREMOVEFILERESULTS[] rgResults)
        {
            var hr = VSConstants.S_OK;
            var handler = QueryRemoveFile;
            if (handler != null)
            {
                if (cFiles <= rgpszMkDocuments.Length)
                {
                    for (var fileCount = 0; fileCount < cFiles; fileCount++)
                    {
                        var args = new ModelChangeEventArgs();
                        args.OldFileName = rgpszMkDocuments[fileCount];
                        args.ProjectObj = VSHelpers.GetProject(pProject as IVsHierarchy);
                        if (args.ProjectObj == null)
                        {
                            continue;
                        }

                        hr = handler(this, args);
                    }
                }
            }
            return hr;
        }
        public int OnAfterRenameFiles(
            int cProjects, int cFiles, IVsProject[] rgpProjects, int[] rgFirstIndices, string[] rgszMkOldNames, string[] rgszMkNewNames,
            VSRENAMEFILEFLAGS[] rgFlags)
        {
            var hr = VSConstants.S_OK;
            var handler = AfterRenameFile;
            if (handler != null)
            {
                for (var fileCount = 0; fileCount < cFiles; fileCount++)
                {
                    var args = new ModelChangeEventArgs();
                    args.OldFileName = rgszMkOldNames[fileCount];
                    args.NewFileName = rgszMkNewNames[fileCount];
                    args.ProjectObj = GetProjectFromArray(cProjects, fileCount, rgpProjects, rgFirstIndices);
                    if (args.ProjectObj == null)
                    {
                        continue;
                    }

                    var newUri = Utils.FileName2Uri(args.NewFileName);
                    ModelManager modelManager = PackageManager.Package.ModelManager;
                    var artifact = modelManager.GetArtifact(newUri);
                    ModelManager tempModelManager = null;
                    try
                    {
                        if (artifact == null
                            && Path.GetExtension(args.NewFileName)
                                   .Equals(EntityDesignArtifact.ExtensionEdmx, StringComparison.CurrentCulture))
                        {
                            tempModelManager = new EntityDesignModelManager(new EFArtifactFactory(), new VSArtifactSetFactory());
                            artifact = tempModelManager.GetNewOrExistingArtifact(
                                newUri, new StandaloneXmlModelProvider(PackageManager.Package));
                        }
                        args.Artifact = artifact;

                        hr = handler(this, args);
                    }
                    finally
                    {
                        if (tempModelManager != null)
                        {
                            tempModelManager.Dispose();
                        }
                    }
                }
            }
            return hr;
        }
Example #12
0
 public static void OnModelChange(object sender, ModelChangeEventArgs e)
 {
     ModelChange?.Invoke(sender, e);
 }
 /// <summary>
 ///     This method is called by the docdata whenever the inherent filename changes. Clients should not call this
 ///     method directly; they should subscribe to MicrosoftDataEntityDesignPackage.FileNameChanged event.
 /// </summary>
 /// <param name="oldFileName"></param>
 /// <param name="newFileName"></param>
 public void OnFileNameChanged(string oldFileName, string newFileName)
 {
     var args = new ModelChangeEventArgs();
     args.OldFileName = oldFileName;
     args.NewFileName = newFileName;
     FileNameChanged(this, args);
 }
        /// <summary>
        ///     Updates artifact URI and error list when a document is renamed/moved/save-as'd WHEN IT IS OPEN
        /// </summary>
        private int OnAfterFileNameChanged(object sender, ModelChangeEventArgs args)
        {
            // after a file name change we have to rename the artifact
            if (args.OldFileName != null
                && args.NewFileName != null)
            {
                // if the user renamed the extension of the file, we will still take it
                var oldUri = Utils.FileName2Uri(args.OldFileName);
                if (oldUri != null
                    && _package != null
                    && _package.ModelManager != null
                    &&_package.ModelManager.GetArtifact(oldUri) != null)
                {
                    var newUri = Utils.FileName2Uri(args.NewFileName);

                    // first we need to remove the errors attached to this soon-to-be stale artifact
                    // this applies to rename/move
                    var oldArtifact = _package.ModelManager.GetArtifact(oldUri);
                    if (oldArtifact != null
                        && oldArtifact.ArtifactSet != null)
                    {
                        oldArtifact.ArtifactSet.RemoveErrorsForArtifact(oldArtifact);
                    }

                    ClearErrorList(oldUri, newUri);

                    _package.ModelManager.RenameArtifact(oldUri, newUri);
                }
            }

            return VSConstants.S_OK;
        }
        private int OnAfterSaveFile(object sender, ModelChangeEventArgs args)
        {
            if (args.ProjectObj == null)
            {
                // don't assert here because a solution could get passed in
                return VSConstants.E_INVALIDARG;
            }

            if (args.ProjectObj.UniqueName.Equals(Constants.vsMiscFilesProjectUniqueName, StringComparison.Ordinal))
            {
                return VSConstants.E_INVALIDARG;
            }

            var hr = VSConstants.S_OK;

            // we're only given a cookie into the RDT so we have to query it to get the filename
            var docTable = Services.IVsRunningDocumentTable;
            uint rdtFlags, readLocks, editLocks, itemId;
            string fileName;
            IVsHierarchy hierarchy;
            var docData = IntPtr.Zero;

            try
            {
                hr = docTable.GetDocumentInfo(
                    args.DocCookie, out rdtFlags, out readLocks, out editLocks, out fileName, out hierarchy, out itemId, out docData);
            }
            finally
            {
                if (docData != IntPtr.Zero)
                {
                    Marshal.Release(docData);
                }
            }

            if (fileName != null)
            {
                var connStringsUpdated = false;
                // update the local hash table if app.config/web.config was updated manually. This is where we recognize if a user tried to fix up the config.
                if (Path.GetFileName(fileName).Equals(VsUtils.AppConfigFileName, StringComparison.CurrentCultureIgnoreCase)
                    || Path.GetFileName(fileName).Equals(VsUtils.WebConfigFileName, StringComparison.CurrentCultureIgnoreCase))
                {
                    lock (_hashSyncRoot)
                    {
                        try
                        {
                            ExtractConnStringsIntoHash(args.ProjectObj, true);
                            connStringsUpdated = true;
                        }
                        catch (Exception e)
                        {
                            VsUtils.LogOutputWindowPaneMessage(args.ProjectObj, e.Message);
                            hr = VSConstants.E_FAIL;
                        }
                    }
                }
                else if (VSHelpers.GetDocData(PackageManager.Package, fileName) is IEntityDesignDocData)
                {
                    Debug.Assert(args.Artifact != null, "Artifact must be passed in in order to save the edmx file!");

                    if (args.Artifact != null
                        && args.Artifact.ConceptualModel() != null
                        && args.Artifact.ConceptualModel().FirstEntityContainer != null
                        && args.Artifact.ConceptualModel().FirstEntityContainer.LocalName != null)
                    {
                        ExtractConnStringsIntoHash(args.ProjectObj, true);
                        connStringsUpdated = true;

                        var entityContainerName = args.Artifact.ConceptualModel().FirstEntityContainer.LocalName.Value;

                        // first check if an entity container name was updated in the model and we haven't saved it
                        if (!String.IsNullOrEmpty(_staleEntityContainerName))
                        {
                            UpdateEntityContainerName(args.ProjectObj, _staleEntityContainerName, entityContainerName);
                            _staleEntityContainerName = null;
                        }

                        // at this point we have taken into account all of the user's actions to fix up the connection between the model and the
                        // config file. Now we update the metadata artifact processing if it was updated
                        if (HasConnectionString(args.ProjectObj, entityContainerName)
                            && !String.IsNullOrEmpty(_staleMetadataArtifactProcessing))
                        {
                            var mapProperty = GetMetadataPropertyFromArtifact(args.Artifact);
                            Debug.Assert(mapProperty != null, "Metadata artifact processing property in the model cannot be null");
                            if (mapProperty != null)
                            {
                                var metadataFileNames = GetMetadataFileNamesFromArtifactFileName(
                                    args.ProjectObj, args.Artifact.Uri.LocalPath, PackageManager.Package);
                                
                                var currentMetadataArtifactProcessingValue = mapProperty.ValueAttr.Value;
                                // Compare the new and value of MetadataArtifactProcessingValue, if they are different update the config file.
                                if (String.Compare(
                                    currentMetadataArtifactProcessingValue, _staleMetadataArtifactProcessing,
                                    StringComparison.OrdinalIgnoreCase) != 0)
                                {
                                    var applicationType = VsUtils.GetApplicationType(Services.ServiceProvider, args.ProjectObj);
                                    var metadata = GetConnectionStringMetadata(metadataFileNames, args.ProjectObj, 
                                        applicationType, currentMetadataArtifactProcessingValue);
                                    var connectionString = GetConnectionStringObject(args.ProjectObj, entityContainerName, this);
                                    connectionString.Builder.Metadata = metadata;
                                    InsertConnStringsFromHash(args.ProjectObj);
                                }
                            }
                            _staleMetadataArtifactProcessing = null;
                        }
                    }

                    // refresh the property browser if we have updated the connection strings above. This is for the situation where app.config is saved but the user
                    // does not have focus on it. This way, the read-only connection string in the property browser will be updated immediately.
                    if (connStringsUpdated)
                    {
                        var uiShell = Services.ServiceProvider.GetService(typeof(IVsUIShell)) as IVsUIShell;
                        if (uiShell != null)
                        {
                            uiShell.RefreshPropertyBrowser(0);
                        }
                    }
                }
            }

            return hr;
        }
 // <summary>
 //     If the user changes the entity container name property we just take note of the old entity container name,
 //     storing it safely in the connection manager so when we are ready to commit the change we will know what connection string
 //     to change based on the old name.
 // </summary>
 private int OnAfterEntityContainerNameChange(object sender, ModelChangeEventArgs args)
 {
     if (_staleEntityContainerName == null)
     {
         _staleEntityContainerName = args.OldEntityContainerName;
     }
     return VSConstants.S_OK;
 }
        private int OnAfterOpenProject(object sender, ModelChangeEventArgs args)
        {
            if (args.ProjectObj == null)
            {
                Debug.Fail(Resources.ConnectionManager_InitializeError);
                return VSConstants.E_FAIL;
            }

            if (args.ProjectObj.UniqueName.Equals(Constants.vsMiscFilesProjectUniqueName, StringComparison.Ordinal))
            {
                return VSConstants.E_INVALIDARG;
            }

            lock (_hashSyncRoot)
            {
                try
                {
                    ExtractConnStringsIntoHash(args.ProjectObj, false);
                }
                catch (NotImplementedException)
                {
                    // if a project doesn't implement any features we try to access along this code path, then ignore it
                }
                catch (Exception e)
                {
                    VsUtils.LogOutputWindowPaneMessage(args.ProjectObj, e.Message);
                    return VSConstants.E_FAIL;
                }
            }

            return VSConstants.S_OK;
        }
        // <summary>
        //     After renaming a file, we need to update the metadata portion of the connection string
        //     to reflect the new name of the edmx file.
        // </summary>
        internal int OnAfterRenameFile(object sender, ModelChangeEventArgs args)
        {
            // ignore files that are not edmx
            if (!Path.GetExtension(args.OldFileName).Equals(EntityDesignArtifact.ExtensionEdmx, StringComparison.CurrentCulture))
            {
                return VSConstants.E_NOTIMPL;
            }

            if (args.ProjectObj == null)
            {
                Debug.Fail(
                    String.Format(
                        CultureInfo.CurrentCulture, Resources.ConnectionManager_UpdateError, "Metadata portion of connection string",
                        "No project was found"));
                return VSConstants.E_INVALIDARG;
            }

            // if we are renaming the extension to a non-edmx extension, then the artifact will be null
            if (args.Artifact == null)
            {
                if (Path.GetExtension(args.NewFileName).Equals(EntityDesignArtifact.ExtensionEdmx, StringComparison.CurrentCulture))
                {
                    Debug.Fail("we are renaming the file to one with an edmx extension, why weren't we able to find the artifact?");
                }
                return VSConstants.E_INVALIDARG;
            }

            if (args.Artifact.ConceptualModel() != null
                && args.Artifact.ConceptualModel().FirstEntityContainer != null
                && HasConnectionString(args.ProjectObj, args.Artifact.ConceptualModel().FirstEntityContainer.LocalName.Value))
            {                   
                var metadataFileNames = GetMetadataFileNamesFromArtifactFileName(args.ProjectObj, args.Artifact.Uri.LocalPath, PackageManager.Package);
                var mapProperty = GetMetadataPropertyFromArtifact(args.Artifact);
                string mapPropertyValue;
                if (mapProperty != null)
                {
                    mapPropertyValue = mapProperty.ValueAttr.Value;
                }
                else
                {
                    mapPropertyValue = ConnectionDesignerInfo.MAP_CopyToOutputDirectory;
                }

                var applicationType = VsUtils.GetApplicationType(Services.ServiceProvider, args.ProjectObj);
                var newMetaData = GetConnectionStringMetadata(metadataFileNames, args.ProjectObj, applicationType, mapPropertyValue);

                UpdateMetadataName(args.ProjectObj, args.Artifact.ConceptualModel().FirstEntityContainer.LocalName.Value, newMetaData);
            }

            return VSConstants.S_OK;
        }
        private int OnAfterRemoveFile(object sender, ModelChangeEventArgs args)
        {
            if (args.ProjectObj == null)
            {
                Debug.Fail("Could not find the project object to attempt to clear the connection manager's hashtable if necessary");
                return VSConstants.E_INVALIDARG;
            }

            if (String.IsNullOrEmpty(args.OldFileName))
            {
                Debug.Fail(
                    "We are trying to figure out if we should clear the connection manager's hashtable if the file is a *.config, but where is the filename?");
                return VSConstants.E_INVALIDARG;
            }

            if ((VsUtils.GetApplicationType(Services.ServiceProvider, args.ProjectObj) == VisualStudioProjectSystem.WindowsApplication &&
                 Path.GetFileName(args.OldFileName).Equals(VsUtils.AppConfigFileName, StringComparison.CurrentCultureIgnoreCase))
                || (VsUtils.GetApplicationType(Services.ServiceProvider, args.ProjectObj) != VisualStudioProjectSystem.WindowsApplication &&
                    Path.GetFileName(args.OldFileName).Equals(VsUtils.WebConfigFileName, StringComparison.CurrentCultureIgnoreCase)))
            {
                lock (_hashSyncRoot)
                {
                    try
                    {
                        _connStringsByProjectHash.Clear();
                        _connStringsByProjectHash = null;
                    }
                    catch (Exception)
                    {
                        return VSConstants.E_FAIL;
                    }
                }
            }

            return VSConstants.S_OK;
        }
        public int OnAfterOpenProject(IVsHierarchy pHierarchy, int fAdded)
        {
            if (AfterOpenProject != null)
            {
                var args = new ModelChangeEventArgs();
                try
                {
                    args.ProjectObj = VSHelpers.GetProject(pHierarchy);
                }
                catch (ArgumentException)
                {
                    return VSConstants.E_NOTIMPL;
                }

                if (args.ProjectObj == null)
                {
                    return VSConstants.E_NOTIMPL;
                }
                return AfterOpenProject(this, args);
            }

            return VSConstants.S_OK;
        }
        // <summary>
        //     Event handler when we change any properties of the model. For now we'll handle just the renaming
        //     the entity container name.
        // </summary>
        private void OnModelChangesCommitted(object sender, EfiChangedEventArgs e)
        {
            var changeEnum = e.ChangeGroup.Changes.GetEnumerator();
            while (changeEnum.MoveNext())
            {
                // update operation?
                if (changeEnum.Current.Type == EfiChange.EfiChangeType.Update)
                {
                    // are we updating the entity container name?
                    var entityContainer = changeEnum.Current.Changed as SingleItemBinding<ConceptualEntityContainer>;
                    if (entityContainer != null)
                    {
                        // get the values from the EfiChange properties, use those to construct the arguments
                        var pair = changeEnum.Current.Properties[EntityContainerMapping.AttributeCdmEntityContainer];
                        var args = new ModelChangeEventArgs();
                        args.OldEntityContainerName = (string)pair.OldValue;

                        AfterEntityContainerNameChange(this, args);

                        // ignore any further action
                        continue;
                    }
                }

                // are we updating the metadata artifact processing value?
                var metadataArtifactProcessingValue = changeEnum.Current.Changed as DefaultableValue<string>;
                if (metadataArtifactProcessingValue != null)
                {
                    var mapProp = metadataArtifactProcessingValue.Parent as DesignerProperty;

                    if (mapProp != null
                        && mapProp.LocalName != null
                        && String.Compare(
                            mapProp.LocalName.Value, ConnectionDesignerInfo.AttributeMetadataArtifactProcessing,
                            StringComparison.OrdinalIgnoreCase) == 0)
                    {
                        var pair = changeEnum.Current.Properties[DesignerProperty.AttributeValue];
                        var args = new ModelChangeEventArgs();
                        args.OldMetadataArtifactProcessing = (string)pair.OldValue;
                        AfterMetadataArtifactProcessingChange(this, args);
                        continue;
                    }
                }
            }
        }
        public int OnBeforeUnloadProject(IVsHierarchy pRealHierarchy, IVsHierarchy pStubHierarchy)
        {
            var handler = BeforeCloseProject;
            if (handler != null)
            {
                var args = new ModelChangeEventArgs();
                try
                {
                    args.ProjectObj = VSHelpers.GetProject(pRealHierarchy);
                }
                catch (ArgumentException)
                {
                    return VSConstants.E_NOTIMPL;
                }

                if (args.ProjectObj == null)
                {
                    return VSConstants.E_NOTIMPL;
                }
                return handler(this, args);
            }

            return VSConstants.S_OK;
        }
        public int OnAfterRemoveFiles(
            int cProjects, int cFiles, IVsProject[] rgpProjects, int[] rgFirstIndices, string[] rgpszMkDocuments,
            VSREMOVEFILEFLAGS[] rgFlags)
        {
            var hr = VSConstants.S_OK;
            var handler = AfterRemoveFile;
            if (handler != null)
            {
                if (cFiles <= rgpszMkDocuments.Length)
                {
                    for (var fileCount = 0; fileCount < cFiles; fileCount++)
                    {
                        var args = new ModelChangeEventArgs();
                        args.OldFileName = rgpszMkDocuments[fileCount];
                        args.ProjectObj = GetProjectFromArray(cProjects, fileCount, rgpProjects, rgFirstIndices);
                        if (args.ProjectObj == null)
                        {
                            continue;
                        }

                        hr = handler(this, args);
                    }
                }
            }
            return hr;
        }
 // <summary>
 //     If the user changes the artifact metadata processing value, we store the old value.
 //     We are going to compare the value with the current value to determine whether we need to commit the value.
 // </summary>
 private int OnAfterMetadataArtifactProcessingChange(object sender, ModelChangeEventArgs args)
 {
     if (String.IsNullOrEmpty(_staleMetadataArtifactProcessing))
     {
         _staleMetadataArtifactProcessing = args.OldMetadataArtifactProcessing;
     }
     return VSConstants.S_OK;
 }
Example #25
0
 public static void OnCoverDownload(object sender, ModelChangeEventArgs e)
 {
     CoverDownload?.Invoke(sender, e);
 }