GrpcPrint/PrintC/main.cpp

102 lines
1.9 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include <iostream>
#include <memory>
#include <string>
#include <thread>
#include <codecvt>
#include <grpcpp/grpcpp.h>
#include "UI/UIWin.h"
#include "global.h"
#include "SystemInfo.h"
#include "Logger.h"
#include "Toast.h"
#include <map>
#include "LanguageManager.h"
#include "ChartletManager.h"
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:
HBDSystem():m_win(nullptr), m_controller(nullptr){}
~HBDSystem(){
//ConfigManager::GetInstance()->SaveConfig();
DELP(g_log);
DELP(g_Toast);
DELP(g_SystemInfo);
DELP(g_LngManager);
DELP(m_controller);
DELP(m_win);
}
bool init(){
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);
g_isDebug = false;
g_log = new Logger();
g_log->m_LogDao->Init();
g_SystemInfo = new SystemInfo();
g_Toast = new Toast();
g_Lang = (char*)"zh_CN";
g_LngManager = new LanguageManager();
ChartletManager::GetInstance()->Init();
g_LngManager->Init();
DataHandle::Instance()->Init();
m_win = new UIWin();
if (!m_win->Init()) return false;
return true;
}
void run(){
m_win->Display();
}
private:
UIWin* m_win;
Controller* m_controller;
};
//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;
//
//}
int APIENTRY wWinMain(_In_ HINSTANCE hInstance,_In_opt_ HINSTANCE hPrevInstance,_In_ LPWSTR lpCmdLine,_In_ int nCmdShow) {
HBDSystem* system = new HBDSystem();
system->init();
system->run();
DELP(system);
return 0;
}