简体   繁体   English

如何在C#中访问OneDrive的通知状态

[英]How to access OneDrive’s notification status in C#

How to access OneDrive's notification status in C# 如何在C#中访问OneDrive的通知状态

On my Win 7 PC, OneDrive has an icon in the Notification / Tool Bar Area . 在我的Win 7 PC上,OneDrive在“通知/工具栏”区域中有一个图标。

Hovering over the OneDrive notification icon, I get the following status messages:- 将鼠标悬停在OneDrive通知图标上,会收到以下状态消息:

  • OneDrive is “up to date” OneDrive是“最新的”
  • OneDrive is “Looking for changes” OneDrive是“寻找变化”
  • OneDrive is “Uploading 27mb of 346mb, 27 files remaining” OneDrive是“正在上传346mb的27mb,剩余27个文件”

Is it possible to query this status from C#? 是否可以从C#查询此状态?

I am specifically interested to know when the OneDrive is “up to date” or not. 我特别想知道OneDrive何时“最新”。

I would like to write a ShutDown routine for my PC that will check the status of the OneDrive. 我想为我的PC编写一个ShutDown例程,该例程将检查OneDrive的状态。 If the OneDrive is not “up to date” I can then code a "wait" to provide enough time for any new or changed files to get uploaded to the remote cloud server. 如果OneDrive不是“最新”,那么我可以编写“等待”代码,以为新文件或更改后的文件提供足够的时间上传到远程云服务器。

Many thanks in advance for any help with this. 在此先感谢您的帮助。

Don't know if this will work for you or not, but take a look at this CodeProject source (it's C++) that enumerates the notification icons and their tooltips. 不知道这是否适合您,但请看一下此CodeProject源代码(它是C ++),该源代码枚举了通知图标及其工具提示。 You'll have to figure out how to map that to C#, but if you get the API calls you need to make from the C++ code, you shouldn't have too much trouble mapping them to P/Invoke calls. 您必须弄清楚如何将其映射到C#,但是如果您需要从C ++代码进行API调用,那么将它们映射到P / Invoke调用就不会有太多麻烦。

http://www.codeproject.com/Articles/10807/Shell-Tray-Info-Arrange-your-system-tray-icons http://www.codeproject.com/Articles/10807/Shell-Tray-Info-Arrange-your-system-tray-icons

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM