如何在c#win中获取Visual Studio中的活动文件位置。形成 [英] How to get active files location in Visual studio in c# win. form

查看:100
本文介绍了如何在c#win中获取Visual Studio中的活动文件位置。形成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个应用程序,可以跟踪每个文件花费的时间。



示例: -

https://www.dropbox.com/s/bcocp5stn0pzvwe/Untitled.png?dl=0 [ ^ ]



以上是问题的图像我面对。现在我需要的是我想要当前或活动文件 Program.cs 文件的位置。



直到现在我用Google搜索并且只能找到一个对我不起作用的答案在谷歌搜索后找到的答案。请通过发送代码片段来帮助





提前谢谢

I am creating an application that would keep a track of how much time is spent on every file.

Example:-
https://www.dropbox.com/s/bcocp5stn0pzvwe/Untitled.png?dl=0[^]

above is the image of the problem i am facing. now what i need here is i want the current or active file which is Program.cs file's location.

Till now i googled and was only able to find an answer which did not work for me Answer found after googling.please help by sending a code snippet


Thanks in advance

推荐答案

在你的任何意义上都没有活动文件这样的东西我在说。



如果你在谈论Visual Studio中的文件是否在代码编辑器中被主动更改,你真的不会得到任何东西可靠准确。我可以一次打开多达15个文件并对所有文件进行更改。所以你要说我在一个编辑器窗口中花了4秒钟,然后换了另一个窗口5秒钟,另一个窗口再过几秒钟......,是否会计入某些东西?



这没有意义。
There's no such thing as an "active file" in any sense of what you're saying.

If you're talking about if the file in Visual Studio is being actively changed in the code editor, you're really not going to get anything reliably accurate. I can have as many as 15 files open at a time and making changes to all of them. So are you going to say that the 4 seconds I spend in one editor window, then change to another window for 5 seconds, and another for another few seconds, ..., is going to count for something?

That's meaningless.


这篇关于如何在c#win中获取Visual Studio中的活动文件位置。形成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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