-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOpenCodeGoUsage.h
More file actions
58 lines (48 loc) · 1.48 KB
/
Copy pathOpenCodeGoUsage.h
File metadata and controls
58 lines (48 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#pragma once
#include "PluginInterface.h"
#include "OpenCodeGoItem.h"
#include <windows.h>
#include <thread>
class COpenCodeGoUsage : public ITMPlugin
{
private:
COpenCodeGoUsage();
~COpenCodeGoUsage();
public:
static COpenCodeGoUsage& Instance();
HICON GetIcon(UINT id);
void StartWorker();
void StopWorker();
// 通过 ITMPlugin 继承
virtual IPluginItem* GetItem(int index) override;
virtual void DataRequired() override;
virtual const wchar_t* GetInfo(PluginInfoIndex index) override;
virtual OptionReturn ShowOptionsDialog(void* hParent) override;
virtual void OnExtenedInfo(ExtendedInfoIndex index, const wchar_t* data) override;
virtual void OnInitialize(ITrafficMonitor* pApp) override;
virtual void* GetPluginIcon() override;
private:
void LoadConfigFromApp();
void WorkerLoop();
// One item per display row: Rolling / Weekly / Monthly / Reset.
COpenCodeGoItem m_items[4] = {
COpenCodeGoItem(DisplayWindow::Rolling),
COpenCodeGoItem(DisplayWindow::Weekly),
COpenCodeGoItem(DisplayWindow::Monthly),
COpenCodeGoItem(DisplayWindow::Reset),
};
ITrafficMonitor* m_app{};
std::thread m_worker;
HANDLE m_exit_event{};
bool m_worker_started{};
bool m_config_loaded{};
CRITICAL_SECTION m_options_lock;
static COpenCodeGoUsage m_instance;
};
#ifdef __cplusplus
extern "C" {
#endif
__declspec(dllexport) ITMPlugin* TMPluginGetInstance();
#ifdef __cplusplus
}
#endif