//控制器初始化,读取Config,初始化整个APP public void init() { List <Worksheet> cfgsheets = new List <Worksheet>(); try { cfgsheets.Add(spreadsheetMain.Document.Worksheets["Config_APP"]); cfgsheets.Add(spreadsheetMain.Document.Worksheets["Config_Data"]); cfgsheets.Add(spreadsheetMain.Document.Worksheets["Config_ShtCmd"]); cfgsheets.Add(spreadsheetMain.Document.Worksheets["Config_Action"]); } catch (Exception) { MessageBox.Show("当前App中缺少Config配置页,请确认文件未损坏货配置页名称正确"); } cfgData = new XCfgData(cfgsheets); app = new XApp(spreadsheetMain.Document, cfgData); //labels["lbl_AppID"].Text = app.AppID; //labels["lbl_User"].Text = String.Format("{0}" , user.getFullUserName()); labels["lbl_AppName"].Text = app.AppName; //labels["lbl_Version"].Text = app.cfg.app.Version; if (app.statu < SysStatu.Designer) { MessageBox.Show("配置存在错误,请检查配置"); return; } RefreshCurrentSheet(); }
} //私有化无参构造函数,初始化必须带参 public XApp(IWorkbook book, XCfgData cfg) //初始化 { statu = SysStatu.Single; //默认为单选模式 this.book = book; rsheets = new Dictionary <string, XRSheet>(); ranges = new Dictionary <string, XRange>(); commands = new Dictionary <string, XCommand>(); actions = new Dictionary <string, XAction>(); try { init(cfg);//执行初始化 } catch (Exception) { //MessageBox.Show(e.ToString()); this.cfgdata = null; this.statu = SysStatu.SheetError; } }
public void init(XCfgData cfgdata) { this.cfgdata = cfgdata; if ((int)statu > -10) { initRange(); if ((int)statu > -9)//初始化Range未报错 { initSheet(); if ((int)statu > -8)//初始化Sheet未报错 { initCommands(); if ((int)statu > -7)//初始化Command未报错 { initActions(); setRangeDefault(); } } } } }