Пример #1
0
        private void DotNetProject_Modified(object sender, SolutionItemModifiedEventArgs args)
        {
            if (args == null)
            {
                throw new ArgumentNullException(nameof(args));
            }

            _ = ProjectSnapshotManagerDispatcher.RunOnDispatcherThreadAsync((args, ct) =>
            {
                if (_batchingProjectChanges)
                {
                    // Already waiting to recompute host project, no need to do any more work to determine if we're dirty.
                    return;
                }

                var projectChanged = args.Any(arg => string.Equals(arg.Hint, ProjectChangedHint, StringComparison.Ordinal));
                if (projectChanged)
                {
                    // This method can be spammed for tons of project change events but all we really care about is "are we dirty?".
                    // Therefore, we re-dispatch here to allow any remaining project change events to fire and to then only have 1 host
                    // project change trigger; this way we don't spam our own system with re-configure calls.
                    _batchingProjectChanges = true;
                    _ = Task.Factory.StartNew(ProjectChangedBackgroundAsync, null, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default);
                }
            }, args, CancellationToken.None);
        }
Пример #2
0
 void ProjectModified(object sender, SolutionItemModifiedEventArgs e)
 {
     foreach (ProjectModifiedEventArgs eventArgs in ProjectModifiedEventArgs.Create(e))
     {
         projectModifiedHandler(this, eventArgs);
     }
 }
Пример #3
0
        static void HandleModified(object sender, SolutionItemModifiedEventArgs e)
        {
            var fn = e.FirstOrDefault(x => x is SolutionItemModifiedEventInfo && ((SolutionItemModifiedEventInfo)x).Hint == "FileName");

            if (fn == null)
            {
                return;
            }
            var project = fn.SolutionItem as Project;

            if (project == null)
            {
                return;
            }
            lock (databases) {
                try {
                    foreach (var pair in databases)
                    {
                        if (pair.Value.Project == project)
                        {
                            databases.Remove(pair.Key);
                            string uri = "Project:" + project.FileName;
                            pair.Value.Uri  = uri;
                            databases [uri] = pair.Value;
                            return;
                        }
                    }
                } catch (Exception ex) {
                    LoggingService.LogError("Parser database error: can't rename file name of " + project.Name + " to " + project.FileName, ex);
                }
            }
        }
Пример #4
0
 void HandleProjectModified(object sender, SolutionItemModifiedEventArgs e)
 {
     if (!e.Any(x => x.Hint == "TargetFramework" || x.Hint == "References"))
     {
         return;
     }
     StartReparseThread();
 }
 void OnProjectModified(object s, SolutionItemModifiedEventArgs args)
 {
     UpdateCorlibReference();
     if (UpdateCorlibReference())
     {
         UpdateReferences();
     }
 }
Пример #6
0
 protected override void OnModified(SolutionItemModifiedEventArgs args)
 {
     base.OnModified(args);
     if (args.Any(r => r.Hint == Helpers.RhinoPluginTypeProperty))
     {
         // refresh the rhino project type
         RefreshRhinoProjectType();
     }
 }
 public static IEnumerable <ProjectModifiedEventArgs> Create(SolutionItemModifiedEventArgs e)
 {
     foreach (SolutionItemModifiedEventInfo eventInfo in e)
     {
         var project = eventInfo.SolutionItem as DotNetProject;
         if (project != null)
         {
             yield return(new ProjectModifiedEventArgs(project, eventInfo.Hint));
         }
     }
 }
Пример #8
0
 void OnProjectModified(object s, SolutionItemModifiedEventArgs args)
 {
     if (!args.Any(x => x is SolutionItemModifiedEventInfo && ((SolutionItemModifiedEventInfo)x).Hint == "TargetFramework"))
     {
         return;
     }
     if (UpdateFromProject())
     {
         SourceProjectDom.UpdateReferences();
     }
 }
        /// <summary>
        /// Cannot use SolutionItemExtension.OnModified. It does not seem to be called.
        /// </summary>
        protected void OnProjectModified(object sender, SolutionItemModifiedEventArgs args)
        {
            if (Project.Loading)
            {
                return;
            }

            var fileNameChange = args.LastOrDefault(arg => arg.Hint == "FileName");

            if (fileNameChange != null)
            {
                DotNetCoreProjectFileRenamedHandler.OnProjectFileRenamed(Project);
            }
        }
Пример #10
0
		void OnProjectModified (object sender, SolutionItemModifiedEventArgs args)
		{
			foreach (SolutionItemModifiedEventInfo e in args) {
				if (e.Hint == "References" || e.Hint == "Files")
					continue;
				ITreeBuilder tb = Context.GetTreeBuilder (e.SolutionItem);
				if (tb != null) {
					if (e.Hint == "BaseDirectory" || e.Hint == "TargetFramework")
						tb.UpdateAll ();
					else
						tb.Update ();
				}
			}
		}
Пример #11
0
        protected override void OnModified(SolutionItemModifiedEventArgs args)
        {
            base.OnModified(args);

            if (Project.Loading || !itemReady)
            {
                return;
            }

            var fileNameChange = args.LastOrDefault(arg => arg.Hint == "FileName");

            if (fileNameChange != null)
            {
                SdkProjectFileRenamedHandler.OnProjectFileRenamed(Project);
            }
        }
Пример #12
0
        void OnProjectModified(object sender, SolutionItemModifiedEventArgs e)
        {
            if (e.Hint == "References" || e.Hint == "Files")
            {
                return;
            }
            ITreeBuilder tb = Context.GetTreeBuilder(e.SolutionItem);

            if (tb != null)
            {
                if (e.Hint == "BaseDirectory" || e.Hint == "TargetFramework")
                {
                    tb.UpdateAll();
                }
                else
                {
                    tb.Update();
                }
            }
        }
Пример #13
0
 void OnProjectModified(object s, SolutionItemModifiedEventArgs args)
 {
     foreach (var a in args.OfType <SolutionItemModifiedEventInfo> ())
     {
         if (a.Hint == "TargetFramework")
         {
             if (UpdateFromProject())
             {
                 SourceProjectDom.UpdateReferences();
                 return;
             }
         }
         if (a.Hint == "References")
         {
             UpdateFromProject();
             SourceProjectDom.UpdateReferences();
             return;
         }
     }
 }
		void OnProjectModified (object s, SolutionItemModifiedEventArgs args)
		{
			UpdateCorlibReference ();
			if (UpdateCorlibReference ())
				UpdateReferences ();
		}