public void Save(string projectFile, Globals.ProjectType projectType) { SerializableDictionary <string, object> dictPacked = new SerializableDictionary <string, object>(); dictPacked.Add("_projectType", projectType); if (ProjectSaved != null) //something has been added to the list? { PackEventArgs e = new PackEventArgs(dictPacked); ProjectSaved(this, e); } FileInfo _fi = new FileInfo(projectFile); _projectName = _fi.Name; XmlSerializer serializerDict = new XmlSerializer(); serializerDict.Serialize(dictPacked, projectFile); }
public void Open(string projectFile) { Dictionary <string, object> dictPackedState = new Dictionary <string, object>(); Dictionary <string, object> dictUnpackedState = new Dictionary <string, object>(); XmlDeserializer deserializer = new XmlDeserializer(); dictPackedState = deserializer.Deserialize(projectFile) as Dictionary <string, object>; //handle project type right away so other methods can get data _projectType = (Globals.ProjectType)dictPackedState["_projectType"]; //get the filename to come over right away FileInfo fi = new FileInfo(projectFile); _projectName = fi.Name; //adding value at specified key in dictionary dictUnpackedState["_projectType"] = _projectType; dictUnpackedState["frmLocation"] = _siteInfo; dictUnpackedState["VBProjectManager"] = _projMgr; dictUnpackedState["frmModel"] = _modelingInfo; dictUnpackedState["frmResiduals"] = _residualAnalysisInfo; dictUnpackedState["frmMLRPrediction"] = _predInfo; dictUnpackedState["frmDatasheet"] = _datasheetInfo; dictUnpackedState["frmIPyPrediction"] = _ipyPredInfo; dictUnpackedState["frmIPyResiduals"] = _ipyResidualAnalysisInfo; //assign key of packed state to key of unpacked state foreach (var pair in dictPackedState) { string _key = pair.Key; dictUnpackedState[_key] = dictPackedState[_key]; RaiseUnpackRequest(pair.Key, pair.Value); //raises the event. } //ProjectOpened(); }
public void Open(string projectFile) { VBProjectManager vbproj = VBProjectManager.GetProjectManager(); XmlDeserializer deserializer = new XmlDeserializer(); _graph = deserializer.Deserialize(projectFile) as object[]; _projectType = (Globals.ProjectType)_graph[0]; _site = _graph[1] as Site; DataSet ds = null; //_dtImportedData = null; //if (_graph[1] != null) //{ // string xmlImportedData = _graph[1] as string; // if (!String.IsNullOrEmpty(xmlImportedData) || (xmlImportedData != "")) // { // _dtImportedData = new DataTable("ImportedData"); // ds = new DataSet(); // ds.ReadXml(new StringReader(xmlImportedData),XmlReadMode.ReadSchema); // _dtImportedData = ds.Tables[0]; // ds = null; // vbproj.ImportedData = _dtImportedData; // } //} _dtCorrelationData = null; if (_graph[2] != null) { string xmlCorrelationData = _graph[2] as string; if (!String.IsNullOrEmpty(xmlCorrelationData) || (xmlCorrelationData != "")) { _dtCorrelationData = new DataTable("CorrelationData"); ds = new DataSet(); ds.ReadXml(new StringReader(xmlCorrelationData), XmlReadMode.ReadSchema); _dtCorrelationData = ds.Tables[0]; vbproj.CorrelationDataTable = _dtCorrelationData; } } if (_graph[3].GetType() == typeof(MLRModelingInfo)) { _modelingInfo = _graph[3] as MLRModelingInfo; } else { _modelingInfo = null; } FileInfo fi = new FileInfo(projectFile); _projectName = fi.Name; ProjectOpened(this); }
public void Save(string projectFile, Globals.ProjectType projectType) { List <object> lgraph = new List <object>(); lgraph.Add(projectType); ProjectSaved(this); FileInfo fi = new FileInfo(projectFile); _projectName = fi.Name; //_graph[0] = _site; if (_site != null) { lgraph.Add(_site); } StringWriter sw = null; //Save ImportedData datatable //string xmlImportedData = ""; //if (_dtImportedData != null) //{ // _dtImportedData.TableName = "ImportedData"; // sw = new StringWriter(); // _dtImportedData.WriteXml(sw, XmlWriteMode.WriteSchema, false); // xmlImportedData = sw.ToString(); // sw.Close(); // sw = null; //} //_graph[1] = xmlImportedData; //if (xmlImportedData != null) // lgraph.Add(xmlImportedData); //Save CorrelatedData datatable string xmlCorrelationData = ""; if (_dtCorrelationData != null) { _dtCorrelationData.TableName = "CorrelationData"; sw = new StringWriter(); //_dtImportedData.WriteXml(sw, XmlWriteMode.IgnoreSchema, false); //wrong table (mog 3/14) _dtCorrelationData.WriteXml(sw, XmlWriteMode.WriteSchema, false); xmlCorrelationData = sw.ToString(); sw.Close(); sw = null; } //_graph[2] = xmlCorrelationData; if (xmlCorrelationData != null) { lgraph.Add(xmlCorrelationData); } //_graph[3] = _modelingInfo; if (_modelingInfo != null) { lgraph.Add(_modelingInfo); } else { lgraph.Add(""); } XmlSerializer serializer = new XmlSerializer(); serializer.Serialize(lgraph.ToArray(), projectFile); }
public void Open(string projectFile) { Dictionary<string, object> dictPackedState = new Dictionary<string, object>(); Dictionary<string, object> dictUnpackedState = new Dictionary<string, object>(); XmlDeserializer deserializer = new XmlDeserializer(); dictPackedState = deserializer.Deserialize(projectFile) as Dictionary<string, object>; //handle project type right away so other methods can get data _projectType = (Globals.ProjectType)dictPackedState["_projectType"]; //get the filename to come over right away FileInfo fi = new FileInfo(projectFile); _projectName = fi.Name; //adding value at specified key in dictionary dictUnpackedState["_projectType"] = _projectType; dictUnpackedState["frmLocation"] = _siteInfo; dictUnpackedState["VBProjectManager"] = _projMgr; dictUnpackedState["frmModel"] = _modelingInfo; dictUnpackedState["frmResiduals"] = _residualAnalysisInfo; dictUnpackedState["frmMLRPrediction"] = _predInfo; dictUnpackedState["frmDatasheet"] = _datasheetInfo; dictUnpackedState["frmIPyPrediction"] = _ipyPredInfo; dictUnpackedState["frmIPyResiduals"] = _ipyResidualAnalysisInfo; //assign key of packed state to key of unpacked state foreach (var pair in dictPackedState) { string _key = pair.Key; dictUnpackedState[_key] = dictPackedState[_key]; RaiseUnpackRequest(pair.Key, pair.Value); //raises the event. } //ProjectOpened(); }
public void Open(string projectFile) { VBProjectManager vbproj = VBProjectManager.GetProjectManager(); XmlDeserializer deserializer = new XmlDeserializer(); _graph = deserializer.Deserialize(projectFile) as object[]; _projectType = (Globals.ProjectType)_graph[0]; _site = _graph[1] as Site; DataSet ds = null; //_dtImportedData = null; //if (_graph[1] != null) //{ // string xmlImportedData = _graph[1] as string; // if (!String.IsNullOrEmpty(xmlImportedData) || (xmlImportedData != "")) // { // _dtImportedData = new DataTable("ImportedData"); // ds = new DataSet(); // ds.ReadXml(new StringReader(xmlImportedData),XmlReadMode.ReadSchema); // _dtImportedData = ds.Tables[0]; // ds = null; // vbproj.ImportedData = _dtImportedData; // } //} _dtCorrelationData = null; if (_graph[2] != null) { string xmlCorrelationData = _graph[2] as string; if (!String.IsNullOrEmpty(xmlCorrelationData) || (xmlCorrelationData != "")) { _dtCorrelationData = new DataTable("CorrelationData"); ds = new DataSet(); ds.ReadXml(new StringReader(xmlCorrelationData), XmlReadMode.ReadSchema); _dtCorrelationData = ds.Tables[0]; vbproj.CorrelationDataTable = _dtCorrelationData; } } if (_graph[3].GetType() == typeof(MLRModelingInfo)) _modelingInfo = _graph[3] as MLRModelingInfo; else _modelingInfo = null; FileInfo fi = new FileInfo(projectFile); _projectName = fi.Name; ProjectOpened(this); }