private void Form1_Load(object sender, EventArgs e) { this.docViewAdmin = new DocumentViewManager(); this.validationAdmin = new ValidationManager(); this.storageAdmin = new StorageManager(); this.archiveFolder = this.storageAdmin.SetArchiveDirectory(); this.addPagesToExistingDocument = false; this.EnableDocumentViewButtons(false, false); this.zoomInBtn.TextAlign = ContentAlignment.MiddleCenter; this.zoomOutBtn.TextAlign = ContentAlignment.MiddleCenter; if (!Directory.Exists("..\\..\\TempDocs")) { Directory.CreateDirectory("..\\..\\TempDocs"); } }
void dgvError_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex == -1) { #region sort var dataSource = this.dgvError.DataSource as List <ParseErrorInfo>; var column = this.dgvError.Columns[e.ColumnIndex]; if (column.Tag == null) { column.Tag = 0; } var asc = !column.Tag.Equals(1)?true:false; if (column.Name == this.Line.Name) { if (asc) { dataSource = dataSource.OrderBy(x => x.Line).ToList(); } else { dataSource = dataSource.OrderByDescending(x => x.Line).ToList(); } } if (column.Name == this.CharIndexInLine.Name) { if (asc) { dataSource = dataSource.OrderBy(x => x.CharPositionInLine).ToList(); } else { dataSource = dataSource.OrderByDescending(x => x.CharPositionInLine).ToList(); } } if (column.Name == this.Message.Name) { if (asc) { dataSource = dataSource.OrderBy(x => x.Message).ToList(); } else { dataSource = dataSource.OrderByDescending(x => x.Message).ToList(); } } if (column.Name == this.File.Name) { if (asc) { dataSource = dataSource.OrderBy(x => x.File).ToList(); } else { dataSource = dataSource.OrderByDescending(x => x.File).ToList(); } } if (column.Name == this.ColumnFileId.Name) { if (asc) { dataSource = dataSource.OrderBy(x => x.FileId).ToList(); } else { dataSource = dataSource.OrderByDescending(x => x.FileId).ToList(); } } if (column.Name == this.ColumnErrorType.Name) { if (asc) { dataSource = dataSource.OrderBy(x => x.ErrorType).ToList(); } else { dataSource = dataSource.OrderByDescending(x => x.ErrorType).ToList(); } } if (asc) { column.Tag = 1; } else { column.Tag = 0; } this.dgvError.DataSource = dataSource; #endregion } if (e.RowIndex > -1) { var dataSource = this.dgvError.DataSource as List <ParseErrorInfo>; if (dataSource != null) { var errorInfo = dataSource[e.RowIndex]; if (string.IsNullOrWhiteSpace(errorInfo.File) && errorInfo.FileId == Guid.Empty) { return; } if (!errorInfo.FileId.HasValue) { return; } var ctx = GlobalService.EditorContextManager.Get(errorInfo.FileId.Value); if (ctx != null) { ctx.Controller.RePosition(errorInfo.Line - 1, errorInfo.CharPositionInLine, RePositionType.Error, errorInfo.Message); DocumentViewManager.Instance().ActiveView(ctx.Model.FileId); } else { //Assemble.CreateEditor(errorInfo.File); //var cmdHost_common = CommandHostManager.Instance().Get(CommandHostManager.HostType.Common); ////var cmd = cmdHost_common.GetCommand(Dict.Commands.OpenFile); //cmdHost_common.RunCommand(Dict.Commands.OpenFile); if (string.IsNullOrWhiteSpace(errorInfo.File) && errorInfo.FileId.HasValue) { var model = GlobalService.ModelManager.GetModel(errorInfo.FileId.Value); errorInfo.File = model.File; } CommandHostManager.Instance().OpenFile(errorInfo.File); ctx = GlobalService.EditorContextManager.Get(errorInfo.FileId.Value); ctx.Controller.RePosition(errorInfo.Line - 1, errorInfo.CharPositionInLine, RePositionType.Error, errorInfo.Message); } } } }