private void btn_Submit_Click(object sender, EventArgs e) { //当前页面选项的备份,下次加载上次打开的 ChartFormData data = new ChartFormData() { ReportName = tb_ReportName.Text, IssueType = cb_IssueType.Text, NodeCode = cb_NodeCode.Text, Depth = cb_Depth.Text, YField = cb_Y.Text, StartTime = btn_StartDate.Text, }; FaceRecorderForRevit recorder = PMSoftHelper.GetRecorder(nameof(WarnSettings), Doc); var jsonObj = JsonConvert.SerializeObject(data); recorder.WriteValue(SaveKeyHelper.GetSaveKey(SaveKeyHelper.SaveKeyTypeForSubsidenceMonitor.ChartForm, 1), jsonObj); this.Close(); }
public ChartForm(Autodesk.Revit.DB.Document doc) { InitializeComponent(); InitControls(); Doc = doc; string dataStr = ""; FaceRecorderForRevit recorder = PMSoftHelper.GetRecorder(nameof(WarnSettings), Doc); recorder.ReadValue(SaveKeyHelper.GetSaveKey(SaveKeyHelper.SaveKeyTypeForSubsidenceMonitor.ChartForm, 1), ref dataStr, 1000); ChartFormData data = JsonConvert.DeserializeObject <ChartFormData>(dataStr); if (data != null) { tb_ReportName.Text = data.ReportName; var typeNames = Enum.GetNames(typeof(EIssueType)); if (typeNames.Contains(data.IssueType)) { cb_IssueType.Text = data.IssueType; } if ((cb_NodeCode.DataSource as List <string>) != null && (cb_NodeCode.DataSource as List <string>).Contains(data.NodeCode)) { cb_NodeCode.Text = data.NodeCode; } if ((cb_Depth.DataSource as List <string>) != null && (cb_Depth.DataSource as List <string>).Contains(data.Depth)) { cb_Depth.Text = data.Depth; } if ((cb_Y.DataSource as System.Data.DataTable) != null) { foreach (DataRow row in (cb_Y.DataSource as System.Data.DataTable).Rows) { if (row[nameof(TypeKeyDdscription.Description)].ToString() == data.YField) { cb_Y.Text = data.YField; break; } } } btn_StartDate.Text = data.StartTime; } }