private void FormFiltersIntervals_FormClosing(object sender, FormClosingEventArgs e) { if (_book.Forms.ContainsKey(ReporterCommand.FilterIntervals)) { e.Cancel = true; Hide(); } else { var sys = _book.SysPage; sys.PutControl(FilterOtm, "FilterOtmIntrevals"); sys.PutControl(RelationOtm, "RelationOtmIntervals"); sys.PutControl(FilterName, "FilterNameIntervals"); sys.PutControl(RelationName, "RelationNameIntervals"); sys.PutControl(FilterBegin1, "FilterBegin1Intervals"); sys.PutControl(RelationBegin1, "RelationBegin1Intervals"); sys.PutControl(FilterBegin2, "FilterBegin2Intervals"); sys.PutControl(RelationBegin2, "RelationBegin2Intervals"); sys.PutControl(FilterEnd1, "FilterEnd1Intervals"); sys.PutControl(RelationEnd1, "RelationEnd1Intervals"); sys.PutControl(FilterEnd2, "FilterEnd2Intervals"); sys.PutControl(RelationEnd2, "RelationEnd2Intervals"); sys.PutControl(FilterTimeChange1, "FilterTimeChange1Intervals"); sys.PutControl(RelationTimeChange1, "RelationTimeChange1Intervals"); sys.PutControl(FilterTimeChange2, "FilterTimeChange2Intervals"); sys.PutControl(RelationTimeChange2, "RelationTimeChange2Intervals"); GeneralRep.CloseForm(ReporterCommand.FilterIntervals); } }
private void FormFiltersParams_FormClosing(object sender, FormClosingEventArgs e) { if (_book.Forms.ContainsKey(ReporterCommand.FilterParams)) { e.Cancel = true; Hide(); } else { var sys = _book.SysPage; sys.PutControl(FilterOtm); sys.PutControl(RelationOtm); sys.PutControl(FilterFullCode); sys.PutControl(RelationFullCode); sys.PutControl(FilterCode); sys.PutControl(RelationCode); sys.PutControl(FilterSubCode); sys.PutControl(RelationSubCode); sys.PutControl(FilterName); sys.PutControl(RelationName); sys.PutControl(FilterComment); sys.PutControl(RelationComment); sys.PutControl(FilterTask); sys.PutControl(RelationTask); sys.PutControl(FilterUnits); sys.PutControl(RelationUnits); sys.PutControl(FilterDataType); sys.PutControl(RelationDataType); sys.PutControl(FilterSuperProcess); sys.PutControl(RelationSuperProcess); sys.PutControl(FilterCalcParamType); sys.PutControl(RelationCalcParamType); GeneralRep.CloseForm(ReporterCommand.FilterParams); } }
private void FormGroupReportWin_FormClosed(object sender, FormClosedEventArgs e) { using (var sys = new SysTabl(General.ReporterFile)) { sys.PutSubValue("FormGroupReports", "BeginPeriod", BeginPeriod.Text); sys.PutSubValue("FormGroupReports", "EndPeriod", EndPeriod.Text); } GeneralRep.CloseForm(ReporterCommand.GroupReports); }
//Открывает новую заданную форму public Form RunCommandReporter(ReporterCommand c) { if (Forms.ContainsKey(c) && Forms[c] != null) { var fm = Forms[c]; if (!fm.Visible) { fm.Show(); } if (fm.WindowState == FormWindowState.Minimized) { fm.WindowState = FormWindowState.Normal; } fm.Focus(); return(fm); } if (!c.OneForAllBooks() && IsReportForming) { return(null); } if (c.NeedCheckReport() && !SysPage.IsInfoTask()) { MessageReportError("Да запуска команды необходимо открыть отчет InfoTask"); return(null); } Form f = null; using (StartAtom(c)) { try { AddEvent("Закрытие лишних форм"); var less = new Dictionary <ReporterCommand, Form>(); var great = new Dictionary <ReporterCommand, Form>(); foreach (var k in Forms) { if (c.Greater(k.Key)) { less.Add(k.Key, k.Value); } if (c.Less(k.Key)) { great.Add(k.Key, k.Value); } } var cForms = GeneralRep.CommonBook.Forms; foreach (var k in cForms) { if (c.Less(k.Key)) { great.Add(k.Key, k.Value); } } if (great.Count > 0) { string smess = ""; foreach (var g in great) { smess += (smess != "" ? "," : "") + " Форма " + g.Key.ToFormName(); } smess = "Команда не может быть выполнена, пока открыты:" + smess + ". Закрыть формы?"; if (!MessageReportQuestion(smess)) { return(null); } } foreach (var k in less) { k.Value.Close(); if (Forms.ContainsKey(k.Key)) { Forms.Remove(k.Key); } if (cForms.ContainsKey(k.Key)) { cForms.Remove(k.Key); } } foreach (var k in great) { GeneralRep.CloseForm(k.Key, true); } if (c == ReporterCommand.PutLinks || c == ReporterCommand.ShapeLibrary || c == ReporterCommand.Report || c == ReporterCommand.LiveReport || c == ReporterCommand.Intervals || c == ReporterCommand.AbsoluteEdit || c == ReporterCommand.LinksList) { UpdateDataFile(false); } System.Windows.Forms.Application.EnableVisualStyles(); switch (c) { case ReporterCommand.GroupReports: f = new FormGroupReports(); break; case ReporterCommand.GroupReportEdit: f = new FormGroupReportEdit(); break; case ReporterCommand.Create: f = new FormCreate(); break; case ReporterCommand.Setup: f = new FormSetup(); break; case ReporterCommand.CopyServerReport: CopyServerReport(); break; case ReporterCommand.PutLinks: using (Start()) LoadCurTemplate(); LastChangeLinks = DateTime.Now; f = new FormPutLinks(); break; case ReporterCommand.FilterParams: f = new FormFiltersParams(); break; case ReporterCommand.LinkProperties: f = new FormLinkProperties(); break; case ReporterCommand.FindLinks: f = new FormFindLinks(); break; case ReporterCommand.LinksTemplate: f = new FormLinksTemplate(); break; case ReporterCommand.DeleteLinks: DeleteLinks(); LastChangeLinks = DateTime.Now; break; case ReporterCommand.ClearCells: Forms.Add(ReporterCommand.ClearCells, null); UsedFileToMemory(); ClearAllCells(); Forms.Remove(ReporterCommand.ClearCells); break; case ReporterCommand.ShapeLibrary: f = new FormShapeLibrary(); break; case ReporterCommand.Report: UsedFileToMemory(); PrepareController(); f = new FormReport(); break; case ReporterCommand.LiveReport: UsedFileToMemory(); PrepareController(); f = new FormLiveReport(); break; case ReporterCommand.Video: UsedFileToMemory(); PrepareController(); f = new FormVideo(); break; case ReporterCommand.ArchivesRanges: f = new FormArchivesRanges(); break; case ReporterCommand.Intervals: UsedFileToMemory(); if (FormInf == null || FormToDir || FormToFile) { MessageReportError("Сохранение в журнал возможно только при формировании отчета непосредственно в бланк отчета (задается в настройках)"); } else { PrepareArchive(); f = new FormIntervals(); } break; case ReporterCommand.FilterIntervals: f = new FormFiltersIntervals(); break; case ReporterCommand.SaveReport: if (CanSaveReport()) { f = new FormSaveReport(); } break; case ReporterCommand.AbsoluteEdit: UsedFileToMemory(); AddEvent("Чтение абсолютных значений из архива"); foreach (var project in UsedProjects.Values) { project.AbsoluteEditValues = project.Archive.ReadAbsoluteEdit(project.Code, false); } f = new FormAbsoluteEdit(); break; case ReporterCommand.Update: UpdateDataFile(true); if (!Command.IsError) { MessageReport("Ссылки были обновлены"); } break; case ReporterCommand.LinksList: f = new FormLinksList(); break; case ReporterCommand.AppInfo: f = new FormAppInfo(); break; } if (f != null) { if (!c.OneForAllBooks()) { f.Text += " (" + Code + ")"; } Forms.Add(c, f); f.Show(); } } catch (Exception ex) { AddError("Ошибка при открытии формы", ex, c.ToString()); } if (Command != null && Command.IsError) { foreach (var ff in Forms) { if (ff.Key != ReporterCommand.LinkProperties && ff.Value != null && ff.Value.Visible) { ff.Value.Activate(); break; } } ShowError(); } } return(f); }
private void FormAppInfo_FormClosing(object sender, FormClosingEventArgs e) { GeneralRep.CloseForm(ReporterCommand.AppInfo); }
private void FormGroupReportEdit_FormClosing(object sender, FormClosingEventArgs e) { GeneralRep.CloseForm(ReporterCommand.GroupReportEdit); }
private void FormAbsoluteEdit_FormClosed(object sender, FormClosedEventArgs e) { GeneralRep.CloseForm(ReporterCommand.AbsoluteEdit); GeneralRep.Application.SheetSelectionChange -= OnSelectionChange; }
private void FormSetupWin_FormClosed(object sender, FormClosedEventArgs e) { GeneralRep.CloseForm(ReporterCommand.Setup); }
private void ButOk_Click(object sender, EventArgs e) { _book.Interval.Name = IntervalName.Text; _book.SaveReport(); GeneralRep.CloseForm(ReporterCommand.SaveReport, true); }
private void ButCancel_Click(object sender, EventArgs e) { GeneralRep.CloseForm(ReporterCommand.SaveReport, true); }
private void FormCreateWin_FormClosed(object sender, FormClosedEventArgs e) { GeneralRep.CloseForm(ReporterCommand.Create); }
private void FormIntervalsWin_FormClosed(object sender, FormClosedEventArgs e) { GeneralRep.CloseForm(ReporterCommand.Intervals); }
private void FormLinkProperties_FormClosed(object sender, FormClosedEventArgs e) { Book.CurLinkProps = PropsString; _linksForm.PropForm = null; GeneralRep.CloseForm(ReporterCommand.LinkProperties); }
private void FormFindLinksWin_FormClosing(object sender, FormClosingEventArgs e) { GeneralRep.CloseForm(ReporterCommand.FindLinks); }