Esempio n. 1
0
        private void DocumentEvents_DocumentSaved(EnvDTE.Document document)
        {
            var textDoc = (TextDocument)document.Object("TextDocument");
            var editPoint = textDoc.StartPoint.CreateEditPoint();
            var text = editPoint.GetText(textDoc.EndPoint);
            var isweb = this.IsWebProject(document.ProjectItem.ContainingProject);
            var selection = textDoc.Selection.ActivePoint;

            //if ((document.FullName.Contains(".shape") && text.Contains("[Sync]")) || (document.FullName.Contains(".cs") && text.Contains("[Sync]") && isweb) || document.FullName.Contains(".cshtml") || document.FullName.Contains(".html"))
            var extensions = Statics.Extensions.Split(',');
            var refresh = extensions.Any(extension => document.FullName.Contains(extension));

            if (refresh)
            {
                _dte.Value.Solution.SolutionBuild.Build(true);

                this.Refresh(this._refreshChrome, this._refreshFirefox, this._refreshIE);

                document.ActiveWindow.Activate();
                document.ActiveWindow.SetFocus();
                document.Activate();
                textDoc.Selection.MoveToPoint(selection);

            }
        }