• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

EveryDB2のデータベースを読み込んでWinFormでGUI表示するサンプル


Commit MetaInfo

Revisão189493fa659cf9258763c71f782a3b1c943191d0 (tree)
Hora2021-05-29 02:42:48
Autoryoshy <yoshy@user...>
Commiteryoshy

Mensagem de Log

temp_20210529_0242

Mudança Sumário

Diff

--- a/App/Adaptor/Controller/WindowController.cs
+++ b/App/Adaptor/Controller/WindowController.cs
@@ -10,6 +10,7 @@ using ICommand = UmaTest.Infra.Adaptor.Command.ICommand;
1010 using UmaTest.Infra.Adaptor.Controller.Handler;
1111 using UmaTest.Infra.Domain.UseCase;
1212 using System.Threading.Tasks;
13+using UmaTest.Infra.Gateway.UI;
1314
1415 namespace UmaTest.App.Adaptor.Controller
1516 {
@@ -18,12 +19,14 @@ namespace UmaTest.App.Adaptor.Controller
1819 private IUseCaseRouter router;
1920 private IAsyncUseCaseRouter asyncRouter;
2021 private IUserDialogProxy dialog;
22+ private IStatusBarProxy statusBar;
2123
22- public WindowController(IUseCaseRouter router, IAsyncUseCaseRouter asyncRouter, IUserDialogProxy dialog)
24+ public WindowController(IUseCaseRouter router, IAsyncUseCaseRouter asyncRouter, IUserDialogProxy dialog, IStatusBarProxy statusBar)
2325 {
2426 this.router = router;
2527 this.asyncRouter = asyncRouter;
2628 this.dialog = dialog;
29+ this.statusBar = statusBar;
2730
2831 Events = new Dictionary<String, EventHandler>()
2932 {
@@ -77,6 +80,10 @@ namespace UmaTest.App.Adaptor.Controller
7780 res.AbortWithSomeErrors("[Bug Check] コマンドの処理結果が未設定です。ハンドラマップの設定漏れの可能性があります");
7881 }
7982
83+ string statusText = !String.IsNullOrEmpty(res.Message) ? res.Message : AppConst.STATUS_BAR_READY;
84+
85+ statusBar.SetStatusText(statusText);
86+
8087 if (res.HasSomeError())
8188 {
8289 dialog.ShowError(res.Message, req.UIInfo);
--- a/App/Adaptor/Gateway/UI/ManualHorseListProxy.cs
+++ b/App/Adaptor/Gateway/UI/ManualHorseListProxy.cs
@@ -8,7 +8,7 @@ namespace UmaTest.App.Adaptor.Gateway.UI
88 internal class ManualHorseListProxy
99 : ShowChildWindowProxy<ManualHorseListView, IManualHorseListViewModel>, IManualHorseListProxy
1010 {
11- private IManualHorseListViewModel vm;
11+ private readonly IManualHorseListViewModel vm;
1212
1313 public ManualHorseListProxy(ManualHorseListView window, IManualHorseListViewModel vm) : base(window)
1414 {
--- a/App/Adaptor/Gateway/ViewModel/IMainWindowViewModel.cs
+++ b/App/Adaptor/Gateway/ViewModel/IMainWindowViewModel.cs
@@ -4,10 +4,11 @@ using System.ComponentModel;
44 using UmaTest.App.Adaptor.Gateway.UI;
55 using UmaTest.App.Adaptor.Gateway.ViewModel.Dto;
66 using UmaTest.Infra.Adaptor.Command;
7+using UmaTest.Infra.Adaptor.ViewModel;
78
89 namespace UmaTest.App.Adaptor.Gateway.ViewModel
910 {
10- public interface IMainWindowViewModel
11+ public interface IMainWindowViewModel : INotifyPropertyChanged
1112 {
1213 ICommand CommandReadHorseList { get; }
1314 EventHandler EventSelectedHorseChanged { get; }
@@ -15,8 +16,6 @@ namespace UmaTest.App.Adaptor.Gateway.ViewModel
1516 BindingList<UmaRaceRowDto> RaceList { get; set; }
1617 BindingList<UmaSummaryRowDto> UmaSummaryList { get; set; }
1718
18- event PropertyChangedEventHandler PropertyChanged;
19-
2019 void RefreshModel(List<UmaSummaryRowDto> umaSummaryList, Dictionary<string, List<UmaRaceRowDto>> umaRaceMap);
2120 }
2221 }
\ No newline at end of file
--- a/App/Adaptor/Gateway/ViewModel/MainWindowViewModel.cs
+++ b/App/Adaptor/Gateway/ViewModel/MainWindowViewModel.cs
@@ -15,6 +15,7 @@ using UmaTest.Infra.Log;
1515 using ICommand = UmaTest.Infra.Adaptor.Command.ICommand;
1616 using UmaTest.App.Adaptor.Controller;
1717 using UmaTest.App.Adaptor.Gateway.UI;
18+using UmaTest.Infra.Adaptor.ViewModel;
1819
1920 namespace UmaTest.App.Adaptor.Gateway.ViewModel
2021 {
@@ -30,11 +31,6 @@ namespace UmaTest.App.Adaptor.Gateway.ViewModel
3031
3132 private IWindowController wc;
3233
33- private BindingList<UmaSummaryRowDto> _chakudosuuList = new BindingList<UmaSummaryRowDto>();
34-
35- private BindingList<UmaRaceRowDto> _raceList = new BindingList<UmaRaceRowDto>();
36-
37- private List<UmaSummaryRowDto> _umaSummaryList = null;
3834 private Dictionary<string, List<UmaRaceRowDto>> _umaRaceMap = null;
3935
4036 public MainWindowViewModel(IWindowController wc, IManualHorseListProxy horseListProxy)
@@ -46,12 +42,16 @@ namespace UmaTest.App.Adaptor.Gateway.ViewModel
4642 EventSelectedHorseChanged = new EventHandler(OnSelectedHorseChanged);
4743 }
4844
45+ private BindingList<UmaSummaryRowDto> _umaSummaryList = new BindingList<UmaSummaryRowDto>();
46+
4947 public BindingList<UmaSummaryRowDto> UmaSummaryList
5048 {
51- get => _chakudosuuList;
52- set => PropertyChanged.RaiseIfSet(() => UmaSummaryList, ref _chakudosuuList, value);
49+ get => _umaSummaryList;
50+ set => PropertyChanged.RaiseIfSet(() => UmaSummaryList, ref _umaSummaryList, value);
5351 }
5452
53+ private BindingList<UmaRaceRowDto> _raceList = new BindingList<UmaRaceRowDto>();
54+
5555 public BindingList<UmaRaceRowDto> RaceList
5656 {
5757 get => _raceList;
@@ -60,7 +60,6 @@ namespace UmaTest.App.Adaptor.Gateway.ViewModel
6060
6161 public void RefreshModel(List<UmaSummaryRowDto> umaSummaryList, Dictionary<string, List<UmaRaceRowDto>> umaRaceMap)
6262 {
63- _umaSummaryList = umaSummaryList;
6463 _umaRaceMap = umaRaceMap;
6564
6665 UmaSummaryList = new BindingList<UmaSummaryRowDto>(umaSummaryList);
--- a/App/Adaptor/Gateway/ViewModel/ManualHorseListViewModel.cs
+++ b/App/Adaptor/Gateway/ViewModel/ManualHorseListViewModel.cs
@@ -28,8 +28,8 @@ namespace UmaTest.App.Adaptor.Gateway.ViewModel
2828 {
2929 this.wc = wc;
3030 this.CommandExecuteReadManualHorseList = new DelegateCommand(
31- //"Read", () => !String.IsNullOrEmpty(HorseList), OnExecuteReadManualHorseList);
32- "Read", () => true, OnExecuteReadManualHorseList);
31+ "Read", () => !String.IsNullOrEmpty(HorseList), OnExecuteReadManualHorseList);
32+ //"Read", () => true, OnExecuteReadManualHorseList);
3333
3434 this.HorseList = "アドマイヤハダル\r\nエフフォーリア\r\nグラティアス\r\nグレートマジシャン\r\nサトノレイナス\r\nシャフリヤール\r\nステラヴェローチェ\r\nタイトルホルダー\r\nタイムトゥヘヴン\r\nダノンザキッド\r\nディープモンスター\r\nバジオウ\r\nバスラットレオン\r\nヨーホーレイク\r\nラーゴム\r\nレッドジェネシス\r\nワンダフルタウン\r\nヴィクティファルス\r\n";
3535 }
@@ -47,10 +47,7 @@ namespace UmaTest.App.Adaptor.Gateway.ViewModel
4747 public string HorseList
4848 {
4949 get => _horseList;
50- set
51- {
52- PropertyChanged.RaiseIfSet(() => HorseList, ref _horseList, value);
53- }
50+ set => PropertyChanged.RaiseIfSet(() => HorseList, ref _horseList, value);
5451 }
5552 }
5653 }
--- a/App/Adaptor/Presenter/AsyncLoadHorseRaceSummaryPresenter.cs
+++ b/App/Adaptor/Presenter/AsyncLoadHorseRaceSummaryPresenter.cs
@@ -11,6 +11,7 @@ using UmaTest.App.Domain.Model.Repository.Database.Entity.EveryDB2;
1111 using UmaTest.App.Domain.UseCase.Request;
1212 using UmaTest.App.Domain.UseCase.Response;
1313 using UmaTest.Infra.Domain.UseCase;
14+using UmaTest.Infra.Gateway.UI;
1415 using UmaTest.Infra.Helper;
1516 using UmaTest.Infra.Log;
1617
@@ -19,27 +20,27 @@ namespace UmaTest.App.Gateway.Presenter
1920 public class AsyncLoadHorseRaceSummaryPresenter : IAsyncLoadHorseRaceSummaryPresenter
2021 {
2122 private IMainWindowViewModel vm;
23+ private IStatusBarProxy statusBar;
2224
2325 private List<UmaSummaryRowDto> umaSummaryList = new List<UmaSummaryRowDto>();
2426 private Dictionary<string, List<UmaRaceRowDto>> umaRaceMap = new Dictionary<string, List<UmaRaceRowDto>>();
2527
2628
27- public AsyncLoadHorseRaceSummaryPresenter(IMainWindowViewModel vm)
29+ public AsyncLoadHorseRaceSummaryPresenter(IStatusBarProxy statusBar, IMainWindowViewModel vm)
2830 {
2931 this.vm = vm;
32+ this.statusBar = statusBar;
3033 }
3134
3235 public Task<UseCaseResponse> HandleAsync(UseCaseResponse baseRes)
3336 {
34- return TaskHelper.RunWithContinuation<UseCaseResponse>(Task.Run<UseCaseResponse>(() =>
37+ return TaskHelper.RunWithUIAction<UseCaseResponse>(Task.Run<UseCaseResponse>(() =>
3538 {
3639 LoadHorseRaceSummaryRequest req = baseRes.Request as LoadHorseRaceSummaryRequest;
3740 LoadHorseRaceSummaryResponse res = baseRes as LoadHorseRaceSummaryResponse;
3841
3942 List<string> kettoNums = res.KettoNums;
4043
41- // TODO 変換処理をtranslatorに委譲
42-
4344 foreach (string kettoNum in kettoNums)
4445 {
4546 Logger.Info($"血統登録番号: {kettoNum}");
@@ -52,10 +53,17 @@ namespace UmaTest.App.Gateway.Presenter
5253 continue;
5354 }
5455
56+ statusBar.SetStatusText($"血統登録番号: {kettoNum}, 馬名: {uma.Bamei} の情報をレンダリング中です...");
57+
5558 summaryDto = new UmaSummaryRowDto(uma);
5659
5760 foreach (ChakudosuuSummary chakudosuu in res.Summaries[kettoNum])
5861 {
62+ if (chakudosuu.Chakudosuu == "0.0.0.0")
63+ {
64+ continue;
65+ }
66+
5967 ChakudosuuByGradeRowDto chakudosuuByGrade;
6068
6169 switch (chakudosuu.Key1)
@@ -92,6 +100,8 @@ namespace UmaTest.App.Gateway.Presenter
92100 break;
93101 case "ZZ":
94102 chakudosuuByGrade.ZZ = chakudosuu.Chakudosuu;
103+ break;
104+ default:
95105 continue;
96106 }
97107
@@ -113,7 +123,7 @@ namespace UmaTest.App.Gateway.Presenter
113123 summaryDto.Long = chakudosuuByGrade;
114124 break;
115125 default:
116- break;
126+ continue;
117127 }
118128 }
119129
@@ -124,7 +134,7 @@ namespace UmaTest.App.Gateway.Presenter
124134 if (!res.Races.TryGetValue(kettoNum, out IEnumerable<NUmaRaceWithNRace> umaRaces) || (umaRaces.Count() == 0))
125135 {
126136 Logger.Warn($"血統登録番号: {kettoNum} の馬レース情報が見つかりませんでした");
127- return res;
137+ continue;
128138 }
129139
130140 List<UmaRaceRowDto> umaRaceList = new List<UmaRaceRowDto>();
--- a/App/AppConst.cs
+++ b/App/AppConst.cs
@@ -19,5 +19,6 @@ namespace UmaTest.App
1919
2020 internal static readonly string CAPTION_CONFIRM = "確認";
2121
22+ internal static readonly string STATUS_BAR_READY = "Ready.";
2223 }
2324 }
--- a/App/DI/ComponentConnectorFactory.cs
+++ b/App/DI/ComponentConnectorFactory.cs
@@ -19,6 +19,8 @@ using UmaTest.Infra.Adaptor.Controller.Handler;
1919 using UmaTest.Infra.Adaptor.Command;
2020 using UmaTest.Infra.DI;
2121 using UmaTest.Infra.Helper;
22+using UmaTest.Infra.Adaptor.ViewModel;
23+using UmaTest.Infra.Gateway.UI;
2224
2325 namespace UmaTest.App.DI
2426 {
@@ -52,6 +54,8 @@ namespace UmaTest.App.DI
5254 di.RegisterSingleton<MainWindow>();
5355 di.RegisterSingleton<IMainWindowViewModel, MainWindowViewModel>();
5456
57+ di.RegisterSingleton<IStatusBarViewModel, StatusBarViewModel>();
58+
5559 di.RegisterSingleton<ManualHorseListView>();
5660 di.RegisterSingleton<IManualHorseListViewModel, ManualHorseListViewModel>();
5761
@@ -60,6 +64,7 @@ namespace UmaTest.App.DI
6064 ///
6165
6266 di.RegisterSingleton<IUserDialogProxy, UserDialogProxy>();
67+ di.RegisterSingleton<IStatusBarProxy, StatusBarProxy>();
6368 di.RegisterSingleton<IManualHorseListProxy, ManualHorseListProxy>();
6469
6570 ///
--- a/App/Domain/Model/Logic/UmaRaceLogic.cs
+++ b/App/Domain/Model/Logic/UmaRaceLogic.cs
@@ -6,16 +6,20 @@ using System.Text;
66 using System.Threading.Tasks;
77 using UmaTest.App.Domain.Model.Repository.Database.Dao;
88 using UmaTest.App.Domain.Model.Repository.Database.Dto;
9+using UmaTest.Infra.Gateway.UI;
910 using UmaTest.Infra.Helper;
1011
1112 namespace UmaTest.App.Domain.Model.Logic
1213 {
1314 internal class UmaRaceLogic : IUmaRaceLogic
1415 {
15- INUmaRaceDao dao;
16- public UmaRaceLogic(INUmaRaceDao dao)
16+ private INUmaRaceDao dao;
17+ private IStatusBarProxy statusBar;
18+
19+ public UmaRaceLogic(INUmaRaceDao dao, IStatusBarProxy statusBar)
1720 {
1821 this.dao = dao;
22+ this.statusBar = statusBar;
1923 }
2024
2125 public Dictionary<string, IEnumerable<NUmaRaceWithNRace>> LoadRaces(List<string> kettoNumList)
@@ -46,6 +50,7 @@ namespace UmaTest.App.Domain.Model.Logic
4650
4751 foreach (string kettoNum in kettoNumList)
4852 {
53+ statusBar.SetStatusText($"血統登録番号: {kettoNum} に紐付くレース着度数情報を集約中です...");
4954 IEnumerable<ChakudosuuSummary> summaries = await dao.findChakudosuuSummaryAsync(kettoNum);
5055 res.Add(kettoNum, summaries);
5156 }
--- a/App/Domain/Translator/LoadHorseRaceSummaryTranslator.cs
+++ b/App/Domain/Translator/LoadHorseRaceSummaryTranslator.cs
@@ -7,6 +7,7 @@ using UmaTest.App.Domain.Model.Repository.Database.Dto;
77 using UmaTest.App.Domain.Model.Repository.Database.Entity.EveryDB2;
88 using UmaTest.App.Domain.UseCase.Request;
99 using UmaTest.App.Domain.UseCase.Response;
10+using UmaTest.Infra.Gateway.UI;
1011
1112 namespace UmaTest.App.Domain.Translator
1213 {
--- a/App/Domain/UseCase/Interactor/AsyncLoadHorseRaceSummaryInteractor.cs
+++ b/App/Domain/UseCase/Interactor/AsyncLoadHorseRaceSummaryInteractor.cs
@@ -10,6 +10,7 @@ using UmaTest.App.Domain.Translator;
1010 using UmaTest.App.Domain.UseCase.Request;
1111 using UmaTest.App.Domain.UseCase.Response;
1212 using UmaTest.Infra.Domain.UseCase;
13+using UmaTest.Infra.Gateway.UI;
1314
1415 namespace UmaTest.App.Domain.UseCase.Interactor
1516 {
@@ -17,11 +18,15 @@ namespace UmaTest.App.Domain.UseCase.Interactor
1718 {
1819 IUmaLogic logicUma;
1920 IUmaRaceLogic logicUmaRace;
21+ IStatusBarProxy statusBarProxy;
2022 ILoadHorseRaceSummaryTranslator translator;
21- public AsyncLoadHorseRaceSummaryInteractor(IUmaLogic logicUma, IUmaRaceLogic logicUmaRace, ILoadHorseRaceSummaryTranslator translator) : base()
23+
24+ public AsyncLoadHorseRaceSummaryInteractor(IUmaLogic logicUma, IUmaRaceLogic logicUmaRace,
25+ IStatusBarProxy statusBarProxy, ILoadHorseRaceSummaryTranslator translator) : base()
2226 {
2327 this.logicUma = logicUma;
2428 this.logicUmaRace = logicUmaRace;
29+ this.statusBarProxy = statusBarProxy;
2530 this.translator = translator;
2631 }
2732
@@ -30,6 +35,8 @@ namespace UmaTest.App.Domain.UseCase.Interactor
3035 LoadHorseRaceSummaryRequest req = baseReq as LoadHorseRaceSummaryRequest;
3136 LoadHorseRaceSummaryResponse res = req.Response as LoadHorseRaceSummaryResponse;
3237
38+ statusBarProxy.SetStatusText("データ読み込み中...");
39+
3340 List<string> bameiList = req.HorseList;
3441
3542 if (bameiList.Count == 0)
@@ -37,11 +44,18 @@ namespace UmaTest.App.Domain.UseCase.Interactor
3744 return res.AbortWithSomeErrors("馬名リストが設定されていません");
3845 }
3946
47+ statusBarProxy.SetStatusText("馬情報を読み込んでいます...");
48+
4049 Dictionary<string, NUma> horses = await logicUma.LoadHorsesAsync(req.HorseList);
4150
4251 List<string> kettoNums = horses.Select(h => h.Value.Kettonum).OrderBy(k => k).ToList();
4352
53+ statusBarProxy.SetStatusText("馬に紐付くレース情報を読み込んでいます...");
54+
4455 Dictionary<string, IEnumerable<NUmaRaceWithNRace>> races = await logicUmaRace.LoadRacesAsync(kettoNums);
56+
57+ statusBarProxy.SetStatusText("馬に紐付く着度数情報を読み込んでいます...");
58+
4559 Dictionary<string, IEnumerable<ChakudosuuSummary>> summaries = await logicUmaRace.LoadChakudosuuSummariesAsync(kettoNums);
4660
4761 return translator.Translate(res, req, kettoNums, horses, races, summaries);
--- a/App/Presentation/View/MainWindow.Designer.cs
+++ b/App/Presentation/View/MainWindow.Designer.cs
@@ -39,6 +39,8 @@ namespace UmaTest.App.Presentation.View
3939 this.splitContainer2 = new System.Windows.Forms.SplitContainer();
4040 this.dataGridView1 = new System.Windows.Forms.DataGridView();
4141 this.dataGridView2 = new System.Windows.Forms.DataGridView();
42+ this.statusStrip1 = new System.Windows.Forms.StatusStrip();
43+ this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
4244 this.menuStrip1.SuspendLayout();
4345 ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
4446 this.splitContainer1.Panel1.SuspendLayout();
@@ -50,6 +52,7 @@ namespace UmaTest.App.Presentation.View
5052 this.splitContainer2.SuspendLayout();
5153 ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
5254 ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).BeginInit();
55+ this.statusStrip1.SuspendLayout();
5356 this.SuspendLayout();
5457 //
5558 // menuStrip1
@@ -103,7 +106,7 @@ namespace UmaTest.App.Presentation.View
103106 // splitContainer1.Panel2
104107 //
105108 this.splitContainer1.Panel2.Controls.Add(this.splitContainer2);
106- this.splitContainer1.Size = new System.Drawing.Size(862, 493);
109+ this.splitContainer1.Size = new System.Drawing.Size(862, 471);
107110 this.splitContainer1.SplitterDistance = 92;
108111 this.splitContainer1.TabIndex = 1;
109112 //
@@ -112,7 +115,7 @@ namespace UmaTest.App.Presentation.View
112115 this.treeView1.Dock = System.Windows.Forms.DockStyle.Fill;
113116 this.treeView1.Location = new System.Drawing.Point(0, 0);
114117 this.treeView1.Name = "treeView1";
115- this.treeView1.Size = new System.Drawing.Size(92, 493);
118+ this.treeView1.Size = new System.Drawing.Size(92, 471);
116119 this.treeView1.TabIndex = 0;
117120 //
118121 // splitContainer2
@@ -129,8 +132,8 @@ namespace UmaTest.App.Presentation.View
129132 // splitContainer2.Panel2
130133 //
131134 this.splitContainer2.Panel2.Controls.Add(this.dataGridView2);
132- this.splitContainer2.Size = new System.Drawing.Size(766, 493);
133- this.splitContainer2.SplitterDistance = 303;
135+ this.splitContainer2.Size = new System.Drawing.Size(766, 471);
136+ this.splitContainer2.SplitterDistance = 289;
134137 this.splitContainer2.TabIndex = 0;
135138 //
136139 // dataGridView1
@@ -138,7 +141,7 @@ namespace UmaTest.App.Presentation.View
138141 this.dataGridView1.AllowUserToAddRows = false;
139142 this.dataGridView1.AllowUserToDeleteRows = false;
140143 this.dataGridView1.AllowUserToResizeRows = false;
141- this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells;
144+ this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.ColumnHeader;
142145 this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
143146 this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill;
144147 this.dataGridView1.Location = new System.Drawing.Point(0, 0);
@@ -147,7 +150,7 @@ namespace UmaTest.App.Presentation.View
147150 this.dataGridView1.ReadOnly = true;
148151 this.dataGridView1.RowTemplate.Height = 21;
149152 this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
150- this.dataGridView1.Size = new System.Drawing.Size(766, 303);
153+ this.dataGridView1.Size = new System.Drawing.Size(766, 289);
151154 this.dataGridView1.TabIndex = 0;
152155 //
153156 // dataGridView2
@@ -155,7 +158,7 @@ namespace UmaTest.App.Presentation.View
155158 this.dataGridView2.AllowUserToAddRows = false;
156159 this.dataGridView2.AllowUserToDeleteRows = false;
157160 this.dataGridView2.AllowUserToResizeRows = false;
158- this.dataGridView2.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells;
161+ this.dataGridView2.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.ColumnHeader;
159162 this.dataGridView2.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
160163 this.dataGridView2.Dock = System.Windows.Forms.DockStyle.Fill;
161164 this.dataGridView2.Location = new System.Drawing.Point(0, 0);
@@ -164,15 +167,32 @@ namespace UmaTest.App.Presentation.View
164167 this.dataGridView2.ReadOnly = true;
165168 this.dataGridView2.RowTemplate.Height = 21;
166169 this.dataGridView2.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
167- this.dataGridView2.Size = new System.Drawing.Size(766, 186);
170+ this.dataGridView2.Size = new System.Drawing.Size(766, 178);
168171 this.dataGridView2.TabIndex = 0;
169172 //
173+ // statusStrip1
174+ //
175+ this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
176+ this.toolStripStatusLabel1});
177+ this.statusStrip1.Location = new System.Drawing.Point(0, 495);
178+ this.statusStrip1.Name = "statusStrip1";
179+ this.statusStrip1.Size = new System.Drawing.Size(862, 22);
180+ this.statusStrip1.TabIndex = 2;
181+ this.statusStrip1.Text = "statusStrip1";
182+ //
183+ // toolStripStatusLabel1
184+ //
185+ this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
186+ this.toolStripStatusLabel1.Size = new System.Drawing.Size(41, 17);
187+ this.toolStripStatusLabel1.Text = "Ready.";
188+ //
170189 // MainWindow
171190 //
172191 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
173192 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
174193 this.ClientSize = new System.Drawing.Size(862, 517);
175194 this.Controls.Add(this.splitContainer1);
195+ this.Controls.Add(this.statusStrip1);
176196 this.Controls.Add(this.menuStrip1);
177197 this.MainMenuStrip = this.menuStrip1;
178198 this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
@@ -190,6 +210,8 @@ namespace UmaTest.App.Presentation.View
190210 this.splitContainer2.ResumeLayout(false);
191211 ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
192212 ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).EndInit();
213+ this.statusStrip1.ResumeLayout(false);
214+ this.statusStrip1.PerformLayout();
193215 this.ResumeLayout(false);
194216 this.PerformLayout();
195217
@@ -207,6 +229,8 @@ namespace UmaTest.App.Presentation.View
207229 private System.Windows.Forms.DataGridView dataGridView1;
208230 private System.Windows.Forms.TreeView treeView1;
209231 private System.Windows.Forms.DataGridView dataGridView2;
232+ private System.Windows.Forms.StatusStrip statusStrip1;
233+ private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1;
210234 }
211235 }
212236
--- a/App/Presentation/View/MainWindow.cs
+++ b/App/Presentation/View/MainWindow.cs
@@ -16,7 +16,9 @@ using UmaTest.App.Adaptor.Gateway.ViewModel.Dto;
1616 using UmaTest.App.Domain.Model.Repository.Database.Dto;
1717 using UmaTest.App.Domain.Model.Repository.Database.Entity.EveryDB2;
1818 using UmaTest.Infra.Adaptor.Command;
19+using UmaTest.Infra.Adaptor.ViewModel;
1920 using UmaTest.Infra.Domain.Translator;
21+using UmaTest.Infra.Presentation.View;
2022
2123 namespace UmaTest.App.Presentation.View
2224 {
@@ -27,7 +29,7 @@ namespace UmaTest.App.Presentation.View
2729 private BindingSource bindingSource1 = new BindingSource();
2830 private BindingSource bindingSource2 = new BindingSource();
2931
30- public MainWindow(IMainWindowViewModel vm, ICommandManager cm)
32+ public MainWindow(IMainWindowViewModel vm, IStatusBarViewModel vmStatusBar, ICommandManager cm)
3133 {
3234 InitializeComponent();
3335
@@ -39,17 +41,22 @@ namespace UmaTest.App.Presentation.View
3941
4042 vm.ManualHorseListProxy.Owner = this;
4143
42- // Register UI EventHandler of VM
44+ // Register UI EventHandler
4345
4446 this.dataGridView1.SelectionChanged += vm.EventSelectedHorseChanged;
4547
4648 //
47- // Bind UI Commands of VM
49+ // Bind UI Commands
4850 //
4951
5052 cm.Bind(vm.CommandReadHorseList, this.toolStripMenuOpenHorseList);
5153
5254 //
55+ // Bind UI Text
56+ //
57+ DataContextHelper.BindText(this.toolStripStatusLabel1, vmStatusBar, "StatusText");
58+
59+ //
5360 // Initialize DataGridView1
5461 //
5562
@@ -173,6 +180,8 @@ namespace UmaTest.App.Presentation.View
173180 },
174181 };
175182
183+ grid1Cols.Do(col => col.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter);
184+
176185 dataGridView1.Columns.AddRange(grid1Cols);
177186
178187 //
@@ -209,6 +218,16 @@ namespace UmaTest.App.Presentation.View
209218 },
210219 new DataGridViewTextBoxColumn
211220 {
221+ DataPropertyName = "Wakuban",
222+ Name = "枠番",
223+ },
224+ new DataGridViewTextBoxColumn
225+ {
226+ DataPropertyName = "Umaban",
227+ Name = "馬番",
228+ },
229+ new DataGridViewTextBoxColumn
230+ {
212231 DataPropertyName = "Ninki",
213232 Name = "人気",
214233 },
@@ -239,6 +258,8 @@ namespace UmaTest.App.Presentation.View
239258 },
240259 };
241260
261+ grid2Cols.Do(col => col.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter);
262+
242263 dataGridView2.Columns.AddRange(grid2Cols);
243264
244265 //
@@ -282,16 +303,24 @@ namespace UmaTest.App.Presentation.View
282303 switch (args.PropertyName)
283304 {
284305 case "UmaSummaryList":
306+ dataGridView1.SuspendLayout();
307+ dataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.None;
285308 dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.None;
286309 bindingSource1.DataSource = vm.UmaSummaryList;
310+ dataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells;
287311 dataGridView1.AutoSizeColumnsMode = vm.UmaSummaryList.Count > 0
288312 ? DataGridViewAutoSizeColumnsMode.AllCellsExceptHeader
289313 : DataGridViewAutoSizeColumnsMode.AllCells;
314+ dataGridView1.ResumeLayout();
290315 break;
291316 case "RaceList":
317+ dataGridView2.SuspendLayout();
318+ //dataGridView2.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.None;
292319 dataGridView2.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.None;
293320 bindingSource2.DataSource = vm.RaceList;
321+ //dataGridView2.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells;
294322 dataGridView2.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
323+ dataGridView2.ResumeLayout();
295324 break;
296325 }
297326 }
--- a/App/Presentation/View/MainWindow.resx
+++ b/App/Presentation/View/MainWindow.resx
@@ -120,4 +120,7 @@
120120 <metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
121121 <value>17, 17</value>
122122 </metadata>
123+ <metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
124+ <value>248, 17</value>
125+ </metadata>
123126 </root>
\ No newline at end of file
--- a/App/Presentation/View/ManualHorseListView.cs
+++ b/App/Presentation/View/ManualHorseListView.cs
@@ -30,6 +30,7 @@ namespace UmaTest.App.Presentation.View
3030
3131 public void ShowChildWindow()
3232 {
33+ this.CenterToParent();
3334 this.Show();
3435 }
3536
@@ -40,6 +41,8 @@ namespace UmaTest.App.Presentation.View
4041
4142 private void Bind(IManualHorseListViewModel vm, ICommandManager cm)
4243 {
44+ DataContextHelper.BindText(txtHorseList, vm, "HorseList");
45+
4346 ICommand commandHide = new DelegateCommand("Cancel", () => true, HideChildWindow);
4447
4548 cm.Bind(commandHide, btnCancel);
@@ -50,8 +53,6 @@ namespace UmaTest.App.Presentation.View
5053 commandRead.Add(commandHide);
5154
5255 cm.Bind(commandRead, this.btnRead);
53-
54- DataContextHelper.Bind(txtHorseList, "Text", vm, "HorseList");
5556 }
5657 }
5758 }
--- /dev/null
+++ b/Infra/Adaptor/Gateway/UI/IStatusBarProxy.cs
@@ -0,0 +1,15 @@
1+using System;
2+using System.Collections.Generic;
3+using System.Linq;
4+using System.Text;
5+using System.Threading.Tasks;
6+using System.Windows.Forms;
7+using UmaTest.Infra.Presentation.View;
8+
9+namespace UmaTest.Infra.Gateway.UI
10+{
11+ public interface IStatusBarProxy
12+ {
13+ void SetStatusText(string text);
14+ }
15+}
--- a/Infra/Adaptor/Gateway/UI/ShowChildDialogProxy.cs
+++ b/Infra/Adaptor/Gateway/UI/ShowChildDialogProxy.cs
@@ -23,16 +23,5 @@ namespace UmaTest.Infra.Gateway.UI
2323
2424 return dlg.ShowChildDialog();
2525 }
26-
27- //public void Show(TViewModel context)
28- //{
29- // var dlg = new TWindow()
30- // {
31- // Owner = this.Owner,
32- // DataContext = context,
33- // };
34-
35- // dlg.Show();
36- //}
3726 }
3827 }
--- /dev/null
+++ b/Infra/Adaptor/Gateway/UI/StatusBarProxy.cs
@@ -0,0 +1,26 @@
1+using System;
2+using System.Collections.Generic;
3+using System.Linq;
4+using System.Text;
5+using System.Threading.Tasks;
6+using System.Windows.Forms;
7+using UmaTest.Infra.Adaptor.ViewModel;
8+using UmaTest.Infra.Presentation.View;
9+
10+namespace UmaTest.Infra.Gateway.UI
11+{
12+ public class StatusBarProxy : IStatusBarProxy
13+ {
14+ IStatusBarViewModel vm;
15+
16+ public StatusBarProxy(IStatusBarViewModel vm)
17+ {
18+ this.vm = vm;
19+ }
20+
21+ public void SetStatusText(string text)
22+ {
23+ this.vm.StatusText = text;
24+ }
25+ }
26+}
--- /dev/null
+++ b/Infra/Adaptor/ViewModel/IStatusBarViewModel.cs
@@ -0,0 +1,14 @@
1+using System;
2+using System.Collections.Generic;
3+using System.ComponentModel;
4+using System.Linq;
5+using System.Text;
6+using System.Threading.Tasks;
7+
8+namespace UmaTest.Infra.Adaptor.ViewModel
9+{
10+ public interface IStatusBarViewModel : INotifyPropertyChanged
11+ {
12+ string StatusText { get; set; }
13+ }
14+}
--- a/Infra/Adaptor/ViewModel/PropertyChangedEventHandlerExtensions.cs
+++ b/Infra/Adaptor/ViewModel/PropertyChangedEventHandlerExtensions.cs
@@ -2,6 +2,7 @@
22 using System.Collections.Generic;
33 using System.ComponentModel;
44 using System.Linq.Expressions;
5+using UmaTest.Infra.Log;
56
67 namespace UmaTest.App.Adaptor.Gateway.ViewModel
78 {
@@ -37,6 +38,7 @@ namespace UmaTest.App.Adaptor.Gateway.ViewModel
3738
3839 // 下準備が出来たので、イベント発行!!
3940 _this(sender, new PropertyChangedEventArgs(memberEx.Member.Name));
41+ Logger.Debug($"PropertyChangedEvent raised: sender - {sender}, propertyName - {memberEx.Member.Name}");
4042 }
4143
4244 /// <summary>
--- /dev/null
+++ b/Infra/Adaptor/ViewModel/StatusBarViewModel .cs
@@ -0,0 +1,28 @@
1+using System;
2+using System.Collections.Generic;
3+using System.ComponentModel;
4+using System.Linq;
5+using System.Text;
6+using System.Threading.Tasks;
7+using UmaTest.Infra.Adaptor.ViewModel;
8+using UmaTest.Infra.Log;
9+
10+namespace UmaTest.App.Adaptor.Gateway.ViewModel
11+{
12+ public class StatusBarViewModel : IStatusBarViewModel
13+ {
14+ public event PropertyChangedEventHandler PropertyChanged;
15+
16+ private string _statusText = AppConst.STATUS_BAR_READY;
17+ public string StatusText
18+ {
19+ get => _statusText;
20+ set
21+ {
22+ string old = _statusText;
23+ bool raised = PropertyChanged.RaiseIfSet(() => StatusText, ref _statusText, value);
24+ Logger.Debug($"StatusText: old: {old}, new: {value}, raised: {raised}");
25+ }
26+ }
27+ }
28+}
--- a/Infra/Helper/TaskHelper.cs
+++ b/Infra/Helper/TaskHelper.cs
@@ -13,9 +13,9 @@ namespace UmaTest.Infra.Helper
1313 return task.Result;
1414 }
1515
16- public static Task<TResult> RunWithContinuation<TResult>(Task<TResult> task, Action<Task<TResult>> action)
16+ public static Task<TResult> RunWithUIAction<TResult>(Task<TResult> task, Action<Task<TResult>> uiAction)
1717 {
18- task.ContinueWith(action, TaskScheduler.FromCurrentSynchronizationContext());
18+ task.ContinueWith(uiAction, TaskScheduler.FromCurrentSynchronizationContext());
1919
2020 return task;
2121 }
--- a/Infra/Presentation/View/DataContextHelper.cs
+++ b/Infra/Presentation/View/DataContextHelper.cs
@@ -1,9 +1,11 @@
11 using System;
22 using System.Collections.Generic;
3+using System.ComponentModel;
34 using System.Linq;
45 using System.Text;
56 using System.Threading.Tasks;
67 using System.Windows.Forms;
8+using UmaTest.Infra.Log;
79
810 namespace UmaTest.Infra.Presentation.View
911 {
@@ -13,5 +15,43 @@ namespace UmaTest.Infra.Presentation.View
1315 {
1416 control.DataBindings.Add(propertyName, dataSource, dataMember);
1517 }
18+
19+ public static void Bind(ToolStripItem control, string propertyName, object dataSource, string dataMember)
20+ {
21+ //control.DataBindings.Add(propertyName, dataSource, dataMember);
22+ }
23+
24+ public static void BindText(Control control, object dataSource, string dataMember)
25+ {
26+ Bind(control, "Text", dataSource, dataMember);
27+ }
28+
29+ public static void BindText(ToolStripItem control, object dataSource, string dataMember)
30+ {
31+ control.Text = ExtractPropertyText(dataSource, dataMember);
32+
33+ if (dataSource is INotifyPropertyChanged notify)
34+ {
35+ Logger.Debug($"BindText: sender - {dataSource} is INotifyPropertyChanged");
36+
37+ notify.PropertyChanged += (o, e) =>
38+ {
39+ Logger.Debug($"BindText.PropertyChangedEventHandler: sender - {o}, propertyName - {e.PropertyName}");
40+ if (e.PropertyName == dataMember)
41+ {
42+ control.Text = ExtractPropertyText(o, dataMember);
43+ }
44+ };
45+ }
46+ }
47+
48+ private static string ExtractPropertyText(object dataSource, string dataMember)
49+ {
50+ string text = dataSource.GetType().GetProperty(dataMember)?.GetValue(dataSource) as string;
51+
52+ Logger.Debug($"dataSource: {dataSource}, dataMember: {dataMember}, text: {text}");
53+
54+ return text;
55+ }
1656 }
1757 }
--- a/UmaTest.csproj
+++ b/UmaTest.csproj
@@ -116,7 +116,11 @@
116116 <Compile Include="App\Domain\Model\Logic\IUmaLogic.cs" />
117117 <Compile Include="App\Domain\Model\Logic\IUmaRaceLogic.cs" />
118118 <Compile Include="App\Domain\UseCase\Response\AsyncLoadHorseRaceSummaryResponse.cs" />
119+ <Compile Include="Infra\Adaptor\Gateway\UI\IStatusBarProxy.cs" />
120+ <Compile Include="Infra\Adaptor\Gateway\UI\StatusBarProxy.cs" />
119121 <Compile Include="Infra\Adaptor\Presenter\IAsyncPresenter.cs" />
122+ <Compile Include="Infra\Adaptor\ViewModel\StatusBarViewModel .cs" />
123+ <Compile Include="Infra\Adaptor\ViewModel\IStatusBarViewModel.cs" />
120124 <Compile Include="Infra\Helper\TaskHelper.cs" />
121125 <Compile Include="App\Domain\UseCase\Interactor\IAsyncLoadHorseRaceSummaryInteractor.cs" />
122126 <Compile Include="App\Domain\UseCase\Interactor\AsyncLoadHorseRaceSummaryInteractor.cs" />