private void blSheetSetRow(int rowidx, BgConvInfo bci) { DataGridViewRow row = blSheet.Rows[rowidx]; int colidx = 0; row.Cells[colidx++].Value = Consts.convStatuses[(int)bci.status]; row.Cells[colidx++].Value = bci.rFile; row.Cells[colidx++].Value = bci.wFileOrProvisionalWFile; row.Cells[colidx++].Value = bci.errorMessage; row.Cells[colidx++].Value = bci.encode(); }
private void bgConvInfos_eachTimerTick() { if (Gnd.i.bgConvInfos.Count == 0) { bcie_index = -1; // 何となく.. return; } bcie_index++; bcie_index %= Gnd.i.bgConvInfos.Count; BgConvInfo bci = Gnd.i.bgConvInfos[bcie_index]; switch (bci.status) { case Consts.ConvStatus_e.READY: if (Gnd.i.conv == null) { Gnd.i.conv = new Conv(bci.rFile, bci.wFileNoExt); bci.status = Consts.ConvStatus_e.CONVERTING; } break; case Consts.ConvStatus_e.CONVERTING: // conv == null って事は無いはずだけど、念のため.. if (Gnd.i.conv != null && Gnd.i.conv.completed) { if (Gnd.i.conv.errorMessage == null) // ? 成功 { bci.status = Consts.ConvStatus_e.COMPLETED; bci.wFile = Gnd.i.conv.wFile; } else // ? エラー { bci.status = Consts.ConvStatus_e.ERROR; bci.errorMessage = Gnd.i.conv.errorMessage; } Gnd.i.conv.Dispose(); Gnd.i.conv = null; } break; case Consts.ConvStatus_e.COMPLETED: // noop break; case Consts.ConvStatus_e.ERROR: // noop break; default: throw null; } }
private bool eachTimerTick() // ret: ? 継続すべき { if (blSheet.RowCount == 0) { ettRowIndex = -1; return(false); } ettRowIndex++; ettRowIndex %= blSheet.RowCount; BgConvInfo bci = blSheetGetRow(ettRowIndex); switch (bci.status) { case Consts.ConvStatus_e.READY: if (Gnd.i.conv == null) { Gnd.i.conv = new Conv(bci.rFile, bci.wFileNoExt); bci.status = Consts.ConvStatus_e.CONVERTING; // UIに反映 blSheetSetRow(ettRowIndex, bci); Utils.adjustColumnsWidth(blSheet); return(false); } break; case Consts.ConvStatus_e.CONVERTING: // Gnd.i.conv == null ってことは無いけど、念のため if (Gnd.i.conv != null && Gnd.i.conv.completed) { if (Gnd.i.conv.errorMessage == null) // ? 成功 { bci.status = Consts.ConvStatus_e.COMPLETED; bci.wFile = Gnd.i.conv.wFile; } else // ? エラー { bci.status = Consts.ConvStatus_e.ERROR; bci.errorMessage = Gnd.i.conv.errorMessage; } Gnd.i.conv.Dispose(); Gnd.i.conv = null; // UIに反映 blSheetSetRow(ettRowIndex, bci); Utils.adjustColumnsWidth(blSheet); return(false); } break; } return(true); }
private void 完了した項目をクリアFToolStripMenuItem_Click(object sender, EventArgs e) { for (int rowidx = blSheet.RowCount - 1; 0 <= rowidx; rowidx--) { BgConvInfo bci = blSheetGetRow(rowidx); if (bci.status == Consts.ConvStatus_e.COMPLETED) { tryDeleteRow(rowidx); } } }
private void tryDeleteRow(int rowidx) { if (rowidx < 0 || blSheet.RowCount <= rowidx) { return; } BgConvInfo bci = blSheetGetRow(rowidx); if (bci.status == Consts.ConvStatus_e.CONVERTING) { return; } blSheet.Rows.RemoveAt(rowidx); }
private void blSheet_DragDrop(object sender, DragEventArgs e) { this.mtEnabled = false; try { #if false // 不要 int droppedRowIndex; { Point pt = this.blSheet.PointToClient(new Point(e.X, e.Y)); DataGridView.HitTestInfo hit = this.blSheet.HitTest(pt.X, pt.Y); droppedRowIndex = hit.RowIndex; } #endif string[] files = (string[])e.Data.GetData(DataFormats.FileDrop, false); if (Gnd.i.bciCountMax < files.Length) { throw new FailedOperation("入力ファイルが多すぎます。(展開前)"); } List <string> relFiles = new List <string>(); files = Utils.droppedFilesFilter(files, relFiles); if (Gnd.i.bciCountMax < files.Length) { throw new FailedOperation("入力ファイルが多すぎます。(展開後)"); } if (files.Length == 0) { throw new FailedOperation("no files"); } if (Gnd.i.bciCountMax < files.Length + blSheet.RowCount) { throw new FailedOperation("入力ファイルが多すぎます。\nエラー・完了した項目をクリアすると解決するかもしれません。"); } List <BgConvInfo> bcis = new List <BgConvInfo>(); for (int index = 0; index < files.Length; index++) { string wFile = Path.Combine(this.txtDestDir.Text, relFiles[index]); string wFileNoExt = Path.Combine(Path.GetDirectoryName(wFile), Path.GetFileNameWithoutExtension(wFile)); bcis.Add(BgConvInfo.create( files[index], wFileNoExt )); } int startPos = blSheet.RowCount; blSheet.RowCount += bcis.Count; for (int index = 0; index < bcis.Count; index++) { blSheetSetRow(startPos + index, bcis[index]); } Utils.adjustColumnsWidth(blSheet); } catch (Exception ex) { Gnd.i.logger.writeLine("blSheet-dd-error: " + ex); FailedOperation.caught(ex); } finally { this.mtEnabled = true; } }
private BgConvInfo blSheetGetRow(int rowidx) { return(BgConvInfo.decode(blSheet.Rows[rowidx].Cells[blSheet.ColumnCount - 1].Value.ToString())); }
private BgConvInfo bciSheetGetRow(int rowidx) { DataGridViewRow row = this.bciSheet.Rows[rowidx]; return(BgConvInfo.decode(row.Cells[4].Value.ToString())); }