//static bool bInited = false; //static DataSet _ds = null; static public void Init(DataGridView gdv, OutboundConfig Config) { _dgv = gdv; _Config = Config; _chs = _Config.IOChannels; }
public static void Load() { //#region Save Config //using (StreamWriter sw = File.CreateText(FileName)) //{ // Config = new OutboundDBInstallConfig(); // string str = Config.ToXMLString(); // sw.Write(str); //} //#endregion #region Load Config using (StreamReader sr = File.OpenText(FileName)) { try { string str = sr.ReadToEnd(); if (str.Equals("")) { Config = new OutboundConfig(); } else { Config = XObjectManager.CreateObject(str, typeof(OutboundConfig)) as OutboundConfig; } } catch { if (Config == null) { Config = new OutboundConfig(); } } finally { if (Config == null) { Config = new OutboundConfig(); } } } #endregion #region Load DeviceDir DeviceDir.LoadDeviceDir(); int iDevice_ID; if (!int.TryParse(DeviceDir.DeviceDirInfor.Header.ID, out iDevice_ID)) { Program.log.Write(LogType.Error, "Device_ID invalid"); Config.Device_ID = -1; } else { Config.Device_ID = iDevice_ID; } Config.INameOutbound = DeviceDir.DeviceDirInfor.Header.Name; #endregion #region GWDBInfo.Init AdapterConfigCfgMgt mgt = new AdapterConfigCfgMgt(); if (mgt.Load()) { GWDBInfo.Init(mgt.Config.ConfigDBConnection); } else { Program.log.Write(mgt.LastError); } #endregion }