From 42c4263fb54abb9302f8ed470d0e10c3d4bb1a59 Mon Sep 17 00:00:00 2001 From: emkael Date: Mon, 13 Mar 2017 10:20:31 +0100 Subject: * confirmation dialog on hand records loading (with board set information) --- Aktywator/MainForm.cs | 26 ++++++++++++++++++++++++-- Aktywator/PBN.cs | 9 +++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/Aktywator/MainForm.cs b/Aktywator/MainForm.cs index b63b291..31de969 100644 --- a/Aktywator/MainForm.cs +++ b/Aktywator/MainForm.cs @@ -277,8 +277,30 @@ namespace Aktywator try { PBN pbn = new PBN(openPBN.FileName, bws.lowBoard(), bws.highBoard()); - int count = bws.loadHandRecords(pbn); - MessageBox.Show("Wczytanych rozkładów: " + count, "Rozkłady wczytane!", MessageBoxButtons.OK, MessageBoxIcon.Information); + StringBuilder confirmMsg = new StringBuilder(); + confirmMsg.Append("Wczytane zostaną rozkłady z następującego pliku:\n" + ""); + if (pbn.title != null && !pbn.title.Equals("")) + { + confirmMsg.Append("\nNagłówek pliku: " + pbn.title); + } + confirmMsg.Append("\nPierwszy rozkład: "); + for (int i = 0; i < pbn.handRecords[bws.lowBoard()].north.Length; i++) + { + if ("".Equals(pbn.handRecords[bws.lowBoard()].north[i])) + { + confirmMsg.Append("renons, "); + } + else + { + confirmMsg.Append(pbn.handRecords[bws.lowBoard()].north[i]); + break; + } + } + if (MessageBox.Show(confirmMsg.ToString(), "Potwierdź rozkłady", MessageBoxButtons.YesNo) == DialogResult.Yes) + { + int count = bws.loadHandRecords(pbn); + MessageBox.Show("Wczytanych rozkładów: " + count, "Rozkłady wczytane!", MessageBoxButtons.OK, MessageBoxIcon.Information); + } } catch (Exception ex) { diff --git a/Aktywator/PBN.cs b/Aktywator/PBN.cs index f6d5393..e312d63 100644 --- a/Aktywator/PBN.cs +++ b/Aktywator/PBN.cs @@ -17,6 +17,11 @@ namespace Aktywator { get { return _count; } } + private String _title; + public String title + { + get { return _title; } + } public PBN(string filename, int lowBoard, int highBoard) { @@ -38,6 +43,10 @@ namespace Aktywator this._count++; } } + if (pbn.Boards.Count > 0 && pbn.Boards[0].HasField("Event")) + { + this._title = pbn.Boards[0].GetField("Event"); + } } } -- cgit v1.2.3