private void LoadXml(string filename) { XDocument xdoc = XDocument.Load(filename); XElement node_Root = xdoc.Element("SimuDatas"); IEnumerable <XElement> node_SDModels = node_Root.Elements("SimuDataNode"); SimulateDataModelEventArgs e; foreach (SimulateDataChartModel sdcmodel in VChart.SDCModels) { SimulateDataModel sdmodel = sdcmodel.SDModel; e = new SimulateDataModelEventArgs(); e.SDModel_old = sdmodel; e.SDModel_new = null; OnSDModelClose(this, e); } //VList.Clear(); //VChart.Clear(); int id = 0; foreach (XElement node_SDModel in node_SDModels) { SimulateDataModel sdmodel = new SimulateDataModel(); sdmodel.LoadXml(node_SDModel); e = new SimulateDataModelEventArgs(); e.SDModel_new = sdmodel; e.ID = id++; if (SDModelSetup != null) { SDModelSetup(this, e); } } foreach (SimulateDataChartModel sdcmodel in VChart.SDCModels) { SimulateDataModel sdmodel = sdcmodel.SDModel; e = new SimulateDataModelEventArgs(); e.SDModel_new = sdmodel; if (sdmodel.IsLock && SDModelLock != null) { SDModelLock(this, e); } if (sdmodel.IsView && SDModelView != null) { SDModelView(this, e); } } }
private void LoadXml(string filename, int timestart, int timeend) { XDocument xdoc = XDocument.Load(filename); XElement node_Root = xdoc.Element("SimuDatas"); IEnumerable <XElement> node_SDModels = node_Root.Elements("SimuDataNode"); foreach (XElement node_SDModel in node_SDModels) { string name = (string)(node_SDModel.Element("Name")); foreach (SimulateDataChartModel sdcmodel in VChart.SDCModels) { SimulateDataModel sdmodel = sdcmodel.SDModel; if (sdmodel.Name.Equals(name)) { VChart.RemoveValue(sdmodel, timestart, timeend); sdmodel.LoadXml(node_SDModel, timestart, timeend); break; } } } VChart.UpdateChart(); }