Esempio n. 1
0
        void OnProjectItemRemoved(object sender, ProjectItemEventArgs e)
        {
            if (e.Project != project)
            {
                return;
            }

            ReferenceProjectItem reference = e.ProjectItem as ReferenceProjectItem;

            if (reference != null)
            {
                try {
                    IProjectContent referencedContent = ParserService.GetExistingProjectContentForReference(reference);
                    if (referencedContent != null)
                    {
                        lock (ReferencedContents) {
                            ReferencedContents.Remove(referencedContent);
                        }
                        OnReferencedContentsChanged(EventArgs.Empty);
                    }
                } catch (Exception ex) {
                    MessageService.ShowError(ex);
                }
            }

            if (e.ProjectItem.ItemType == ItemType.Import)
            {
                UpdateDefaultImports(project.Items);
            }
            else if (e.ProjectItem.ItemType == ItemType.Compile)
            {
                ParserService.ClearParseInformation(e.ProjectItem.FileName);
            }
        }
Esempio n. 2
0
        public override void CloseIfAllViewsClosed()
        {
            if (registeredViews.Count == 0)
            {
                bool wasDirty = this.IsDirty;
                FileService.OpenedFileClosed(this);

                FileClosed.RaiseEvent(this, EventArgs.Empty);

                if (fileChangeWatcher != null)
                {
                    fileChangeWatcher.Dispose();
                    fileChangeWatcher = null;
                }

                if (wasDirty)
                {
                    // We discarded some information when closing the file,
                    // so we need to re-parse it.
                    if (File.Exists(this.FileName))
                    {
                        ParserService.BeginParse(this.FileName);
                    }
                    else
                    {
                        ParserService.ClearParseInformation(this.FileName);
                    }
                }
            }
        }