GrpcPrint/PrintC/main.cpp

102 lines
1.9 KiB
C++
Raw Normal View History

2024-03-15 12:31:34 +08:00
#include <iostream>
#include <memory>
#include <string>
#include <thread>
#include <codecvt>
#include <grpcpp/grpcpp.h>
2024-04-01 18:26:14 +08:00
#include "UI/UIWin.h"
#include "global.h"
#include "SystemInfo.h"
#include "Logger.h"
#include "Toast.h"
#include <map>
#include "LanguageManager.h"
2024-04-09 16:53:02 +08:00
#include "ChartletManager.h"
2024-04-01 18:26:14 +08:00
string g_AppPath;
string g_AppDisk;
Logger* g_log;
LanguageManager* g_LngManager;
Toast* g_Toast;
bool g_isDebug;
uint32_t g_ScanSerial;
string g_gno;
SystemInfo* g_SystemInfo;
class HBDSystem {
public:
2024-04-10 16:15:33 +08:00
HBDSystem():m_win(nullptr), m_controller(nullptr){}
2024-04-01 18:26:14 +08:00
2024-04-10 16:15:33 +08:00
~HBDSystem(){
2024-05-06 10:49:15 +08:00
//ConfigManager::Instance()->SaveConfig();
2024-04-01 18:26:14 +08:00
DELP(g_log);
DELP(g_Toast);
2024-04-10 16:15:33 +08:00
DELP(g_SystemInfo);
DELP(g_LngManager);
2024-04-02 17:45:03 +08:00
DELP(m_controller);
DELP(m_win);
2024-04-01 18:26:14 +08:00
}
bool init(){
2024-04-02 17:45:03 +08:00
char szFilePath[MAX_PATH + 1] = { 0 };
GetModuleFileName(NULL, szFilePath, MAX_PATH);
(strrchr(szFilePath, '\\'))[1] = 0;
g_AppPath = szFilePath;
g_AppDisk = g_AppPath.substr(0, 2);
2024-04-01 18:26:14 +08:00
g_isDebug = false;
g_log = new Logger();
g_log->m_LogDao->Init();
g_SystemInfo = new SystemInfo();
g_Toast = new Toast();
2024-04-02 17:45:03 +08:00
g_Lang = (char*)"zh_CN";
2024-04-09 16:53:02 +08:00
g_LngManager = new LanguageManager();
ChartletManager::GetInstance()->Init();
g_LngManager->Init();
2024-04-02 17:45:03 +08:00
DataHandle::Instance()->Init();
2024-04-01 18:26:14 +08:00
m_win = new UIWin();
if (!m_win->Init()) return false;
2024-04-02 17:45:03 +08:00
2024-04-01 18:26:14 +08:00
return true;
}
void run(){
m_win->Display();
}
private:
UIWin* m_win;
2024-04-02 17:45:03 +08:00
Controller* m_controller;
2024-04-01 18:26:14 +08:00
};
2024-03-15 12:31:34 +08:00
2024-04-02 17:45:03 +08:00
//int main(int argc, char** argv) {
// printf("你好!" );
//
// DataHandle* dataHandle = new DataHandle();
// dataHandle->Init();
// printf("你好fdfdfd");
// HBDSystem* system = new HBDSystem();
// system->init();
// system->run();
//
// return 0;
//
//}
2024-04-01 18:26:14 +08:00
int APIENTRY wWinMain(_In_ HINSTANCE hInstance,_In_opt_ HINSTANCE hPrevInstance,_In_ LPWSTR lpCmdLine,_In_ int nCmdShow) {
2024-03-15 12:31:34 +08:00
2024-04-01 18:26:14 +08:00
HBDSystem* system = new HBDSystem();
system->init();
system->run();
2024-04-02 17:45:03 +08:00
DELP(system);
2024-04-01 18:26:14 +08:00
return 0;
}
2024-03-15 12:31:34 +08:00