/// <summary> /// 单例 /// </summary> private WarningManager() { name = UserRightManager.user.userName; bgWork = new BackgroundWorker(); config = ConfigManager.GetInstance(); adamHelper = AdamHelper.GetInstance(); dbhelper = DBHelper.GetInstance(); }
public PouringState() { InitializeComponent(); adamHelper = AdamHelper.GetInstance(); dataStoreManager = DataStoreManager.GetInstance(); warningManager = WarningManager.GetInstance(); config = ConfigManager.GetInstance(); //timer1.Enabled = false; }
private DataStoreManager() { dbhelper = DBHelper.GetInstance(); adamHelper = AdamHelper.GetInstance(); name = UserRightManager.user.userName;//得到操作人的名字 // name = "admin"; storeTimer = new System.Threading.Timer(_ => { if (adamHelper.hasData) { storeData(); } }, null, Timeout.Infinite, Timeout.Infinite); }
private void TestForm_Load(object sender, EventArgs e) { List <AdamOperation> list = new List <AdamOperation> { new Adam6217Operation("192.168.1.3", 0) }; try { AdamHelper.Initialize(list); adamHelper = AdamHelper.GetInstance(); } catch (Exception ex) { MessageBox.Show(ex.Message + ex.GetType()); } bool isResetDb = true; try { DBHelper dbHelper = DBHelper.GetInstance(); if (isResetDb) { ConfigManager.Initialize(dbHelper, false); ConfigManager.GetInstance().RecreateDbTable(); } else { ConfigManager.Initialize(dbHelper); } } catch (Exception ex) { MessageBox.Show($"无法初始化配置管理系统,程序将退出。\n错误:\n {ex.Message}\n {ex.StackTrace}", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } try { warningManager = WarningManager.GetInstance(); warningDialog = WarningDialog.GetInstance(warningManager); configManager = ConfigManager.GetInstance(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void SteeveForceWin_Load(object sender, EventArgs e) { adamhelper = AdamHelper.GetInstance(); }
private static void Initialize(string[] args) { bool recreate = false; bool isResetDb = false; if (args.Length > 0) { recreate = bool.Parse(args[0]); isResetDb = bool.Parse(args[1]); } //操作日志初始化 log4net.Config.XmlConfigurator.Configure(); //数据库初始化 try { if (recreate) { RecreateRecordManager.InitialDataBase(); } } catch (Exception ex) { MessageBox.Show("初始化数据库表报错:" + ex.Message); } //配置初始化 try { DBHelper dbHelper = DBHelper.GetInstance(); if (isResetDb) { ConfigManager.Initialize(dbHelper, false); ConfigManager.GetInstance().RecreateDbTable(); } else { ConfigManager.Initialize(dbHelper); } } catch (Exception ex) { MessageBox.Show("配置初始化错误" + ex.Message); } var oper2 = new Adam6217Operation("192.168.1.190", 1); //浇筑状态接收线程初始化 List <AdamOperation> list = new List <AdamOperation> { new Adam6217Operation("192.168.1.3", 0), oper2 }; try { AdamHelper.Initialize(list); } catch (Exception ex) { MessageBox.Show(ex.Message); } //行走状态接收线程初始化 try { AdamHelper2.Initialize(oper2); } catch (Exception ex) { MessageBox.Show(ex.Message); } //数据保存类初始化 //放到主窗体加载那里初始化 }
private void FrontDisWin_Load(object sender, EventArgs e) { adamhelper = AdamHelper.GetInstance(); }