失去焦点时,如何自动保存Visual Studio 2015文件? [英] How can I AutoSave my Visual Studio 2015 files when it loses focus?

查看:266
本文介绍了失去焦点时,如何自动保存Visual Studio 2015文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在课堂上使用CSS,HTML和JavaScript,最近我开始使用Visual Studio2015.在Notepad ++中,有一个加载项,使我可以自动保存所有打开的文档.因为它失去了焦点.这节省了我很多时间,因为我经常在正在处理的页面和该页面的编码之间来回移动.

I'm working with CSS, HTML, and JavaScript in my classes, and I've recently started working with Visual Studio 2015. In Notepad++, there's an add-on that allowed me to automatically save all my opened documents as soon as it lost focus. This saved me a lot of time, as I go back and forth frequently between the page I'm working on and the coding for it.

我希望Visual Studio 2015有类似的附加组件,因此在检查其网页上的工作之前,我可以别忘了保存!有人知道吗?

I'm hoping there is a similar add-on for Visual Studio 2015, so I can stop forgetting to save before checking my work on its web page! Anyone know of any?

推荐答案

对于 Visual Commander ,您可以使用以下扩展名退出Visual Studio时自动保存文件:

You can use the following extension for Visual Commander to auto save files on switching away from Visual Studio:

public class E : VisualCommanderExt.IExtension
{
    public void SetSite(EnvDTE80.DTE2 DTE_, Microsoft.VisualStudio.Shell.Package package)
    {
        DTE = DTE_;
        System.Windows.Application.Current.Deactivated += OnDeactivated;
    }

    public void Close()
    {
        System.Windows.Application.Current.Deactivated -= OnDeactivated;
    }

    private void OnDeactivated(object sender, System.EventArgs e)
    {
        try
        {
            DTE.ExecuteCommand("File.SaveAll");
        }
        catch (System.Exception ex)
        {
        }
    }

    private EnvDTE80.DTE2 DTE;
}

这篇关于失去焦点时,如何自动保存Visual Studio 2015文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆