Small code refactoring
This commit is contained in:
Родитель
850e40565c
Коммит
ed06fd0a18
|
@ -4,6 +4,5 @@
|
|||
// Project-level suppressions either have no target or are given
|
||||
// a specific target and scoped to a namespace, type, member, etc.
|
||||
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "VSSDK004:Use BackgroundLoad flag in ProvideAutoLoad attribute for asynchronous auto load.", Justification = "<Pending>", Scope = "type", Target = "~T:XAMLator.Client.XAMLatorPackage")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "VSTHRD100:Avoid async void methods", Justification = "<Pending>", Scope = "member", Target = "~M:XAMLator.Client.XAMLatorPackage.OnDocumentSaved(EnvDTE.Document)")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "VSTHRD100:Avoid async void methods", Justification = "<Pending>", Scope = "member", Target = "~M:XAMLator.Client.VisualStudio.Services.DocumentService.OnAfterSaved(System.Object,System.UInt32)")]
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace XAMLator.Client.VisualStudio.Helpers
|
|||
|
||||
private static IVsOutputWindowPane _xamlatorVSOutputWindowPane;
|
||||
|
||||
private static IVsOutputWindowPane GiteaVSOutputWindowPane =>
|
||||
private static IVsOutputWindowPane XAMLatorVSOutputWindowPane =>
|
||||
_xamlatorVSOutputWindowPane ?? (_xamlatorVSOutputWindowPane = GetXAMLatorVsOutputWindowPane());
|
||||
|
||||
internal static void LogWriteLine(string message)
|
||||
|
@ -56,7 +56,7 @@ namespace XAMLator.Client.VisualStudio.Helpers
|
|||
private static void WriteLine(string category, string message)
|
||||
{
|
||||
ThreadHelper.ThrowIfNotOnUIThread();
|
||||
var outputWindowPane = GiteaVSOutputWindowPane;
|
||||
var outputWindowPane = XAMLatorVSOutputWindowPane;
|
||||
if (outputWindowPane != null)
|
||||
{
|
||||
string outputMessage = $"[XAMLator for Visual Studio {category} {DateTime.Now.ToString("hh:mm:ss tt")}] {message}{Environment.NewLine}";
|
||||
|
|
|
@ -6,7 +6,8 @@ namespace XAMLator.Client.VisualStudio.Helpers
|
|||
{
|
||||
public class RunningDocTableEvents : IVsRunningDocTableEvents3
|
||||
{
|
||||
public event EventHandler<uint> AfterSave;
|
||||
public event EventHandler<uint> BeforeSaved;
|
||||
public event EventHandler<uint> AfterSaved;
|
||||
|
||||
public int OnAfterFirstDocumentLock(uint docCookie, uint dwRDTLockType, uint dwReadLocksRemaining, uint dwEditLocksRemaining)
|
||||
{
|
||||
|
@ -21,7 +22,7 @@ namespace XAMLator.Client.VisualStudio.Helpers
|
|||
|
||||
public int OnAfterSave(uint docCookie)
|
||||
{
|
||||
AfterSave?.Invoke(this, docCookie);
|
||||
AfterSaved?.Invoke(this, docCookie);
|
||||
|
||||
return VSConstants.S_OK;
|
||||
}
|
||||
|
@ -49,6 +50,8 @@ namespace XAMLator.Client.VisualStudio.Helpers
|
|||
|
||||
public int OnBeforeSave(uint docCookie)
|
||||
{
|
||||
BeforeSaved?.Invoke(this, docCookie);
|
||||
|
||||
return VSConstants.S_OK;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,10 +24,10 @@ namespace XAMLator.Client.VisualStudio.Services
|
|||
_iVsRunningDocumentTable = iVsRunningDocumentTable;
|
||||
_workspace = workspace;
|
||||
|
||||
runningDocTableEvents.AfterSave += OnAfterSave;
|
||||
runningDocTableEvents.AfterSaved += OnAfterSaved;
|
||||
}
|
||||
|
||||
private async void OnAfterSave(object sender, uint docCookie)
|
||||
private async void OnAfterSaved(object sender, uint docCookie)
|
||||
{
|
||||
await OnFileSavedAsync(sender, docCookie);
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ namespace XAMLator.Client
|
|||
OutputWindowHelper.LogWriteLine("XAMLator initialized.");
|
||||
|
||||
VisualStudioIDE visualStudioIDE = new VisualStudioIDE(documentService);
|
||||
|
||||
XAMLatorMonitor.Init(visualStudioIDE);
|
||||
XAMLatorMonitor.Instance.StartMonitoring();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче