Esempio n. 1
0
        public ListForm(UIDocument ui_doc)
        {
            InitializeComponent();

            InitControls();
            UI_Doc = ui_doc;
            FaceRecorderForRevit recorder = PMSoftHelper.GetRecorder(nameof(WarnSettings), ui_doc.Document);
            var str = recorder.GetValue(SaveKeyHelper.GetSaveKey(SaveKeyHelper.SaveKeyTypeForSubsidenceMonitor.WarnSettings, 1), "", 1000);

            if (!string.IsNullOrEmpty(str))
            {
                WarnSettings = JsonConvert.DeserializeObject <WarnSettings>(str);
            }

            string dataStr = "";

            recorder = PMSoftHelper.GetRecorder(nameof(ListForm), ui_doc.Document);
            recorder.ReadValue(SaveKeyHelper.GetSaveKey(SaveKeyHelper.SaveKeyTypeForSubsidenceMonitor.ListForm, 1), ref dataStr, 1000);
            ListFormData data = JsonConvert.DeserializeObject <ListFormData>(dataStr);

            if (data != null)
            {
                var typeNames = Enum.GetNames(typeof(EIssueType));
                if (typeNames.Contains(data.IssueType))
                {
                    cb_IssueType.Text = data.IssueType;
                }
                if (!string.IsNullOrEmpty(data.StartTime))
                {
                    btn_IssueMonth.Text = data.StartTime;
                }
            }
        }
Esempio n. 2
0
        private void ListForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            //当前页面选项的备份,下次加载上次打开的
            ListFormData data = new ListFormData()
            {
                IssueType = cb_IssueType.Text,
                StartTime = btn_IssueMonth.Text,
            };
            FaceRecorderForRevit recorder = PMSoftHelper.GetRecorder(nameof(ListForm), UI_Doc.Document);
            var jsonObj = JsonConvert.SerializeObject(data);

            recorder.WriteValue(SaveKeyHelper.GetSaveKey(SaveKeyHelper.SaveKeyTypeForSubsidenceMonitor.ListForm, 1), jsonObj);
        }