private void ShowAuditWindow(object sender, EventArgs e) { if (m_formParent != null) { m_formParent.Cursor = Cursors.WaitCursor; } try { ToolStripMenuItem tsmi = sender as ToolStripMenuItem; frmAudit fs = new frmAudit(Convert.ToString(tsmi.Tag)); fs.WindowState = FormWindowState.Maximized; CGeneralFuncion.ShowWindow(m_formParent, fs, true); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { if (m_formParent != null) { if (m_formParent.Cursor != Cursors.Default) { m_formParent.Cursor = Cursors.Default; } } } }
private void 显示动画ToolStripMenuItem_Click(object sender, EventArgs e) { #if DEBUG frmAnalysis fa = new frmAnalysis(); CGeneralFuncion.ShowWindow(this, fa, false); #endif }
private void btnBrowse_Click(object sender, EventArgs e) { this.Cursor = Cursors.WaitCursor; try { frmEditRuleResult fer = new frmEditRuleResult(SecurityEventService.Instance.DBManager, false); if (CGeneralFuncion.ShowWindow(this, fer, true) == System.Windows.Forms.DialogResult.OK) { SecurityActionResult sar = fer.SelectedResult[0]; this.txtResult.BackColor = Color.FromArgb(sar.BackgroundColor); this.txtResult.Text = sar.Description; this.txtResult.Tag = sar.ResultGuid; } } catch (Exception ex) { MessageBox.Show("选择安全行为结果失败,错误消息为:" + ex.Message); } finally { this.Cursor = Cursors.Default; } }
private void ShowResult(List <EvaluateResult> lstAnalysisResults) { try { if (Cursor != Cursors.WaitCursor) { this.Cursor = Cursors.WaitCursor; } AnalysisResultService.Instance.ResetAnalysisResults(lstAnalysisResults); frmChartObserver observer = new frmChartObserver(); CGeneralFuncion.ShowWindow(this, observer, false); } catch (Exception ex) { MessageBox.Show("显示分析结果失败,错误消息为:" + ex.Message); } finally { if (Cursor != Cursors.Default) { this.Cursor = Cursors.Default; } } }
private void menuNewLog_Click(object sender, EventArgs e) { try { string appGuid = Convert.ToString((this.tvApps.SelectedNode.Level == AppNodeLevel)? this.tvApps.SelectedNode.Tag : this.tvApps.SelectedNode.Parent.Tag); this.Cursor = Cursors.WaitCursor; frmEditTableProperty fe = new frmEditTableProperty(ConstTableValue.DefaultLogTableName); fe.Text = "编辑日志表名称"; if (CGeneralFuncion.ShowWindow(this, fe, true) == System.Windows.Forms.DialogResult.OK) { LogTable lt = LogTable.NewLogTable; lt.Name = fe.EditedName; CreateNewLogStructCommand cmd = new CreateNewLogStructCommand(appGuid, lt); cmd.UndoDone += new UndoRedoEventHandler(RemoveTableFromTree); cmd.RedoDone += new UndoRedoEventHandler(AddTable2Tree); cmd.Execute(); AddCommand(cmd); AddTable2Tree(appGuid, lt.GUID, lt.Name); } } catch (Exception ex) { MessageBox.Show("创建日志表失败,错误消息为:" + ex.Message); } }
private void menuNewEvent_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; frmEditEventProperty fe = new frmEditEventProperty(); fe.Text = "编辑安全事件属性"; if (CGeneralFuncion.ShowWindow(this, fe, true) == System.Windows.Forms.DialogResult.OK) { SecurityEvent se = SecurityEvent.CreateNewSecurityEvent(fe.EventName, fe.Description); CreateNewSecurityEventCommand cmd = new CreateNewSecurityEventCommand(se); cmd.UndoDone += new UndoRedoEventHandler(RemoveEventFromTree); cmd.RedoDone += new UndoRedoEventHandler(AddEvent2Tree); cmd.Execute(); AddCommand(cmd); AddEvent2Tree(se.Name, se.EventGuid); } } catch (Exception ex) { MessageBox.Show("创建新安全事件失败,错误消息为:" + ex.Message); } finally { this.Cursor = Cursors.Default; } }
private void btnImportNewLogs_Click(object sender, EventArgs e) { this.Cursor = Cursors.WaitCursor; try { ILogOperator opt = LogContentService.Instance.GetLogOperator(m_app.AppGUID); OpenFileDialog ofd = new OpenFileDialog(); ofd.Multiselect = true; ofd.Filter = opt.Filter; this.Cursor = Cursors.Default; if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.Cursor = Cursors.WaitCursor; // 导入文件后先显示,然后用户确认后再保存到数据库 Dictionary <string, List <LogRecord> > lstLogs = opt.ReadLogFromFiles(m_app.AppGUID, ofd.FileNames); foreach (LogShowTabPage page in m_tabPages.Values) { if (page.Parent == null) { lstLogs.Remove(Convert.ToString(page.Tag)); } } this.Cursor = Cursors.Default; if (lstLogs.Count > 0) { this.Cursor = Cursors.WaitCursor; frmLogViewer flv = new frmLogViewer(m_app, lstLogs); if (CGeneralFuncion.ShowWindow(null, flv, true) == System.Windows.Forms.DialogResult.OK) { this.Cursor = Cursors.WaitCursor; foreach (string tableGuid in lstLogs.Keys) { if (!LogContentService.Instance.SaveAppLogs(m_app.AppGUID, tableGuid, lstLogs[tableGuid])) { throw new Exception("保存日志到数据库失败"); } AddLogs2TabPage(tableGuid, lstLogs[tableGuid]); } } } } } catch (Exception ex) { MessageBox.Show(string.Format("导入{0}的日志时出错,错误消息为:{1}", m_app.Name, ex.Message)); } finally { this.Cursor = Cursors.Default; } }
private void menuExportTableStructs_Click(object sender, EventArgs e) { try { frmExportTableStructs ts = new frmExportTableStructs(); CGeneralFuncion.ShowWindow(this, ts, true); } catch (Exception ex) { MessageBox.Show("导出日志表结构失败,错误消息为:" + ex.Message); } }
private void emnuImportTables_Click(object sender, EventArgs e) { XmlTextReader reader = null; this.Cursor = Cursors.WaitCursor; try { OpenFileDialog pdf = new OpenFileDialog(); pdf.Filter = ("日志结构文件(*.xml)|*.xml"); if (pdf.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) { this.Cursor = Cursors.WaitCursor; reader = new XmlTextReader(pdf.FileName); XmlSerializer serializer = new XmlSerializer(typeof(List <LogApp>)); List <LogApp> results = (List <LogApp>)serializer.Deserialize(reader); frmImportTables it = new frmImportTables(results); if (CGeneralFuncion.ShowWindow(this, it, true) == System.Windows.Forms.DialogResult.OK) { ImportAppStructsCommand cmd = new ImportAppStructsCommand(results); cmd.UndoDone += new UndoRedoEventHandler(UndoRedoImportTables); cmd.RedoDone += new UndoRedoEventHandler(UndoRedoImportTables); cmd.Execute(); AddCommand(cmd); InitTree(); } } } catch (Exception ex) { MessageBox.Show("导入日志表结构失败,错误消息为:" + ex.Message); } finally { if (reader != null) { reader.Close(); } if (this.Cursor != Cursors.Default) { this.Cursor = Cursors.Default; } } }
private void btnAddNew_Click(object sender, EventArgs e) { try { string appGuid = Convert.ToString(tvApps.SelectedNode.Parent.Tag); string tableGuid = Convert.ToString(tvApps.SelectedNode.Tag); this.Cursor = Cursors.WaitCursor; List <Int32> lstExistingIndexes = new List <int>(); foreach (DataGridViewRow dgvr in this.dataGridView1.Rows) { lstExistingIndexes.Add(Convert.ToInt32(dgvr.Cells[LogColumnIndexIndex].Value)); } frmEditItem fe = new frmEditItem(true, lstExistingIndexes); if (CGeneralFuncion.ShowWindow(this, fe, true) == System.Windows.Forms.DialogResult.OK) { List <LogTableItem> lstSelectItems = new List <LogTableItem>(); foreach (int lcIndex in fe.SelectLogColumnIndex) { lstSelectItems.Add(LogTableItem.CreateNewLogTableItem(lcIndex)); } if (lstSelectItems.Count > 0) { AddNewTableColumnsCommand cmd = new AddNewTableColumnsCommand(appGuid, tableGuid, lstSelectItems); cmd.UndoDone += new UndoRedoEventHandler(RemoveTableRows); cmd.RedoDone += new UndoRedoEventHandler(AddTableRows); cmd.Execute(); AddCommand(cmd); AddTableRows(lstSelectItems); UpdatePreView(); } } } catch (Exception ex) { MessageBox.Show("添加新的日志列失败,错误消息为:" + ex.Message); } finally { if (this.Cursor != Cursors.Default) { this.Cursor = Cursors.Default; } } }
private void menuNewUserAction_Click(object sender, EventArgs e) { try { if (tvEvents.SelectedNode == null) { MessageBox.Show("请先选择安全行为所属安全事件"); return; } string eventGuid = string.Empty; if (tvEvents.SelectedNode.Level == EventLevel) { eventGuid = Convert.ToString(tvEvents.SelectedNode.Tag); } else if (tvEvents.SelectedNode.Level == UserActionLevel) { eventGuid = Convert.ToString(tvEvents.SelectedNode.Parent.Tag); } this.Cursor = Cursors.WaitCursor; frmEditUserActionProperty fe = new frmEditUserActionProperty(); fe.Text = "编辑安全行为属性"; if (CGeneralFuncion.ShowWindow(this, fe, true) == System.Windows.Forms.DialogResult.OK) { SecurityAction sa = SecurityAction.CreateNewSecurityAction( fe.ActionName, fe.ActionDesc, fe.ActionResultGuid); CreateNewUserActionCommand cmd = new CreateNewUserActionCommand(eventGuid, sa); cmd.UndoDone += new UndoRedoEventHandler(RemoveActionFromTree); cmd.RedoDone += new UndoRedoEventHandler(AddAction2Tree); cmd.Execute(); AddCommand(cmd); AddAction2Tree(eventGuid, sa.ActionGuid, sa.Name); } } catch (Exception ex) { MessageBox.Show("创建新安全行为失败,错误消息为:" + ex.Message); } }
private void menuNewApp_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; string groupName = string.Empty; if (tvApps.SelectedNode != null) { TreeNode tnTop = tvApps.SelectedNode; while (tnTop.Parent != null) { tnTop = tnTop.Parent; } groupName = tnTop.Text; } frmEditAppProperty fe = new frmEditAppProperty(ConstAppValue.DefaultAppName, ConstAppValue.DefaultIsLogsFromFile, groupName); fe.Text = "编辑应用程序名称"; if (CGeneralFuncion.ShowWindow(this, fe, true) == System.Windows.Forms.DialogResult.OK) { LogApp la = LogApp.NewApplication; la.Name = fe.EditedName; la.IsImportLogsFromFiles = fe.IsImportLogsFromFile; la.Group = fe.Group; CreateNewAppCommand cmd = new CreateNewAppCommand(la); cmd.UndoDone += new UndoRedoEventHandler(RemoveAppFromTree); cmd.RedoDone += new UndoRedoEventHandler(AddApp2Tree); cmd.Execute(); AddCommand(cmd); AddApp2Tree(la); } } catch (Exception ex) { MessageBox.Show("创建新工艺失败,错误消息为:" + ex.Message); } }
private void 维护安全事件ToolStripMenuItem_Click(object sender, EventArgs e) { this.Cursor = Cursors.WaitCursor; try { frmEditRules fe = new frmEditRules(DBService.Instance, new List <LogColumn>(LogColumnService.Instance.AvaliableColumns.Values)); CGeneralFuncion.ShowWindow(this, fe, true); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { if (this.Cursor != Cursors.Default) { this.Cursor = Cursors.Default; } } }
// 定义程序分组 private void menuDefineAppGroup_Click(object sender, EventArgs e) { this.Cursor = Cursors.WaitCursor; try { frmEditAppGroup fe = new frmEditAppGroup(); CGeneralFuncion.ShowWindow(this, fe, true); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { if (this.Cursor != Cursors.Default) { this.Cursor = Cursors.Default; } } }
private void ReNameTableName() { this.Cursor = Cursors.WaitCursor; frmEditTableProperty fe = new frmEditTableProperty(tvApps.SelectedNode.Text); fe.Guid = Convert.ToString(tvApps.SelectedNode.Tag); if (CGeneralFuncion.ShowWindow(this, fe, true) == System.Windows.Forms.DialogResult.OK) { string appGuid = Convert.ToString(tvApps.SelectedNode.Parent.Tag); string tableGuid = Convert.ToString(tvApps.SelectedNode.Tag); ReNameTableCommand cmd = new ReNameTableCommand(appGuid, tableGuid, fe.EditedName); cmd.UndoDone += new UndoRedoEventHandler(RefreshTableNodeName); cmd.RedoDone += new UndoRedoEventHandler(RefreshTableNodeName); cmd.Execute(); AddCommand(cmd); RefreshTableNodeName(appGuid, tableGuid, fe.EditedName); } }
private void menuEditActionResults_Click(object sender, EventArgs e) { this.Cursor = Cursors.WaitCursor; try { frmEditRuleResult fe = new frmEditRuleResult(DBService.Instance, true); CGeneralFuncion.ShowWindow(this, fe, true); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { if (this.Cursor != Cursors.Default) { this.Cursor = Cursors.Default; } } }
private void UpdateAppProperry() { this.Cursor = Cursors.WaitCursor; LogApp la = AppService.Instance.GetApp(Convert.ToString(tvApps.SelectedNode.Tag)); frmEditAppProperty fe = new frmEditAppProperty(la.Name, la.IsImportLogsFromFiles, la.Group.Name); fe.Guid = la.AppGUID; if (CGeneralFuncion.ShowWindow(this, fe, true) == System.Windows.Forms.DialogResult.OK) { string appGuid = Convert.ToString(tvApps.SelectedNode.Tag); LogAppMemento memento = new LogAppMemento(fe.IsImportLogsFromFile, fe.EditedName, la.Group.Name); UpdateAppPropertiesCommand cmd = new UpdateAppPropertiesCommand(appGuid, memento); cmd.UndoDone += new UndoRedoEventHandler(RefreshAppNodeName); cmd.RedoDone += new UndoRedoEventHandler(RefreshAppNodeName); cmd.Execute(); AddCommand(cmd); RefreshAppNodeName(appGuid, fe.EditedName); } }
private void menuDefineAppStruct_Click(object sender, EventArgs e) { this.Cursor = Cursors.WaitCursor; try { frmEditAppStruct fe = new frmEditAppStruct(); fe.WindowState = FormWindowState.Maximized; CGeneralFuncion.ShowWindow(this, fe, true); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { if (this.Cursor != Cursors.Default) { this.Cursor = Cursors.Default; } } }
private void cmProperties_Click(object sender, EventArgs e) { this.Cursor = Cursors.WaitCursor; try { if (tvEvents.SelectedNode.Level == EventLevel) { SecurityEvent se = SecurityEventService.Instance.GetSecurityEvent(Convert.ToString(tvEvents.SelectedNode.Tag)); frmEditEventProperty fe = new frmEditEventProperty(se); fe.Text = "编辑安全事件属性"; if (CGeneralFuncion.ShowWindow(this, fe, true) == System.Windows.Forms.DialogResult.OK) { SecurityEvent newSe = SecurityEvent.CreateSecurityEvent(fe.EventName, se.EventGuid, fe.Description); UpdateSecurityEventCommand cmd = new UpdateSecurityEventCommand(newSe); cmd.UndoDone += new UndoRedoEventHandler(RefreshEventTree); cmd.RedoDone += new UndoRedoEventHandler(RefreshEventTree); cmd.Execute(); AddCommand(cmd); RefreshEventTree(se.Name, se.EventGuid); } } else if (tvEvents.SelectedNode.Level == UserActionLevel) { string eventGuid = Convert.ToString(tvEvents.SelectedNode.Parent.Tag); SecurityAction sa = SecurityEventService.Instance.GetSecurityAction( eventGuid, Convert.ToString(tvEvents.SelectedNode.Tag)); frmEditUserActionProperty fe = new frmEditUserActionProperty(sa); fe.Text = "编辑安全行为属性"; if (CGeneralFuncion.ShowWindow(this, fe, true) == System.Windows.Forms.DialogResult.OK) { SecurityAction newData = SecurityAction.CreateSecurityAction(fe.ActionName, sa.ActionGuid, fe.ActionDesc, fe.ActionResultGuid); UpdateSecurityActionCommand cmd = new UpdateSecurityActionCommand(eventGuid, newData); cmd.UndoDone += new UndoRedoEventHandler(RefreshActionNodeName); cmd.RedoDone += new UndoRedoEventHandler(RefreshActionNodeName); cmd.Execute(); AddCommand(cmd); RefreshActionNodeName(eventGuid, newData.ActionGuid, newData.Name); } } } catch (Exception ex) { MessageBox.Show("修改属性信息失败,错误消息为:" + ex.Message); } finally { this.Cursor = Cursors.Default; } }