/// <summary> /// 添加构件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void btn_AddComponent_Click(object sender, EventArgs e) { if (SelectedNodes.Count == 0) { ShowMessage("警告", "需选中节点"); } else if (SelectedNodes.Count > 1) { ShowMessage("警告", "需选中单一节点"); } else { ListForm.ShowDialogType = ShowDialogType.AddElements_ForDetail; string viewName = ListForm.ShowDialogType.GetViewName(); var view = Revit_Document_Helper.GetElementByNameAs <View3D>(UI_Doc.Document, viewName); var doc = UI_Doc.Document; var transactionName = nameof(SubsidenceMonitor) + nameof(btn_AddComponent_Click); if (view == null) { bool isSuccess = DealWithTransaction(viewName, doc, transactionName, () => { view = Revit_Document_Helper.Create3DView(doc, viewName); }); if (!isSuccess) { return; } } UI_Doc.ActiveView = view; this.DialogResult = DialogResult.Retry; this.Close(); ListForm.DialogResult = DialogResult.Retry; ListForm.Close(); } }
public SubsidenceMonitorForm(ListForm listForm, UIDocument ui_doc, TList list) : base() { InitializeComponent(); ////更新主要参数 UI_Doc = ui_doc; ListForm = listForm; Model = new MultipleSingleMemorableDetails(); IssueTypeEntity = list.IssueType.GetEntity(); //初始化控件配置 InitControlSettings(); //如果有详情则加载详情数据 Model.OnDataChanged += Model_OnDataChanged; Model.OnStateChanged += Model_OnStateChanged; Model.OnConfirmChangeCurrentWhileIsEdited += Model_OnChangeCurrentWhileIsEdited; Model.OnConfirmChangeCurrentWhileHasCreateNew += Model_OnChangeCurrentWhileHasCreateNew; Model.OnConfirmDelete += Model_OnConfirmDelete; //事件附加后再作数据的初始化,否则关联的信息无法在初始化的时候渲染出来 Model.Init(ui_doc.Document, list); if (IssueTypeEntity.IssueType == EIssueType.管线沉降_无压 || IssueTypeEntity.IssueType == EIssueType.管线沉降_有压) { if (Model.MemorableData.Data.ExtraValue1.HasValue) { tb_Well.Text = Model.MemorableData.Data.ExtraValue1.Value.ToString(); } } Shown += SubsidenceMonitorForm_Shown1; }
/// <summary> /// 单次最大变量-整体查看 /// 最大-红色 /// 测点-淡显 /// 非测点-淡显 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_ViewCurrentMax_All_Click(object sender, EventArgs e) { bool isSuccess = DetailWithView(ShowDialogType.ViewCurrentMaxByAll, false, (doc) => Model.GetCurrentMaxNodesElementsByTNode(doc)); if (!isSuccess) { return; } this.DialogResult = DialogResult.Retry; this.Close(); ListForm.DialogResult = DialogResult.Retry; ListForm.Close(); }
/// <summary> /// 累计最大变量-红色显示 /// 最大-红色 /// 测点-淡显 /// 非测点-隐藏 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_ViewSumMax_Red_Click(object sender, EventArgs e) { bool isSuccess = DetailWithView(ShowDialogType.ViewTotalMaxByRed, true, (doc) => Model.GetTotalMaxNodesElementsByTNode(doc)); if (!isSuccess) { return; } this.DialogResult = DialogResult.Retry; this.Close(); ListForm.DialogResult = DialogResult.Retry; ListForm.Close(); }
private void SubsidenceMonitorForm_FormClosing(object senedr, FormClosingEventArgs e) { //退出窗口时 需要清空未保存的内容 //编辑控件或者进行浏览时,不进行回滚处理 if (DialogResult == DialogResult.Retry) { SaveDataGridViewSelection(); } else { Model.Rollback(true); ListForm.Activate(); ClearDataGridViewSelection(); } }
/// <summary> /// 测点查看-整体查看 /// 选中-红色 /// 其他-淡显 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_ViewAll_Click(object sender, EventArgs e) { if (SelectedNodes.Count == 0) { ShowMessage("提醒", "需选中节点"); return; } bool isSuccess = DetailWithView(ShowDialogType.ViewElementsByAllNodes, false, (doc) => Model.GetElementIdsByTNode(SelectedNodes, doc)); if (!isSuccess) { return; } this.DialogResult = DialogResult.Retry; this.Close(); ListForm.DialogResult = DialogResult.Retry; ListForm.Close(); }
/// <summary> /// 超出预警预览 /// 超出:报警值*80%,天数-1 /// 超出:颜色1 /// 非超出:颜色2 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_ViewOverWarn_Click(object sender, EventArgs e) { string s = IssueTypeEntity.CheckWarnSettings(ListForm.WarnSettings); if (!string.IsNullOrEmpty(s)) { ShowMessage("警告", s); return; } var doc = UI_Doc.Document; var transactionName = nameof(SubsidenceMonitor) + nameof(btn_ViewSelection_Click); var cpSettingsString = Model.MemorableData.Data.OverCTSettings; if (IssueTypeEntity.IssueType == EIssueType.管线沉降_无压) { if (ListForm.WarnSettings.UnpressedPipeLineSubsidence_WellMillimeter == int.MinValue) { ShowMessage("警告", $"请联系管理员设置{"无压_自流井沉降"}值的预警值"); return; } var wellValue = 0; if (!int.TryParse(tb_Well.Text, out wellValue)) { ShowMessage("警告", "请输入有效的自流井沉降值"); return; } var warnValue = ListForm.WarnSettings.UnpressedPipeLineSubsidence_WellMillimeter; if (wellValue >= warnValue * WarnSettings.OverCoefficient) { ShowMessage("警告", "输入的自流井沉降值超出了设定的预警值"); return; } } else if (IssueTypeEntity.IssueType == EIssueType.管线沉降_有压) { if (ListForm.WarnSettings.PressedPipeLineSubsidence_WellMillimeter == int.MinValue) { ShowMessage("警告", $"请联系管理员设置{"有压_自流井沉降"}值的预警值"); return; } var wellValue = 0; if (!int.TryParse(tb_Well.Text, out wellValue)) { ShowMessage("警告", "请输入有效的自流井沉降值"); return; } var warnValue = ListForm.WarnSettings.PressedPipeLineSubsidence_WellMillimeter; if (wellValue >= warnValue * WarnSettings.OverCoefficient) { ShowMessage("警告", "输入的自流井沉降值超出了设定的预警值"); return; } } View3D view = null; var dialogType = ShowDialogType.ViewOverWarn; bool isSuccess = DetailWithView(doc, transactionName, cpSettingsString, view, dialogType, () => Model.GetOverWarnNodesElementsByTNode(doc, ListForm.WarnSettings)); if (!isSuccess) { return; } this.DialogResult = DialogResult.Retry; this.Close(); ListForm.DialogResult = DialogResult.Retry; ListForm.Close(); }