EveryDB2のデータベースを読み込んでWinFormでGUI表示するサンプル
Revision | bb888324b43146bdd91838fcff0522d5549480b9 (tree) |
---|---|
Zeit | 2021-06-01 06:55:19 |
Autor | yoshy <yoshy@user...> |
Commiter | yoshy |
temp_20210601_0655
@@ -27,5 +27,7 @@ namespace UmaTest.App.Adaptor.Gateway.ViewModel.Dto | ||
27 | 27 | public string RaceName => CodeHelper.GetInstance().GetRaceName(this, "不明"); |
28 | 28 | |
29 | 29 | public string GradeName => CodeHelper.GetInstance().GetName(CodeHelper.GRADE_CODE, Gradecd, "-"); |
30 | + | |
31 | + public string CourseName => CodeHelper.GetInstance().GetTrackKubun(Trackcd, "不明") + Kyori; | |
30 | 32 | } |
31 | 33 | } |
@@ -22,8 +22,12 @@ namespace UmaTest.App.Adaptor.Gateway.ViewModel.Dto | ||
22 | 22 | |
23 | 23 | public string YearMonthDay { get => Year + "/" + Monthday.Substring(0, 2) + "/" + Monthday.Substring(2, 2); } |
24 | 24 | |
25 | + public string JyoName { get => CodeHelper.GetInstance().GetName(CodeHelper.JYO_CODE, Jyocd, 3, "不明"); } | |
26 | + | |
25 | 27 | public string RaceName => CodeHelper.GetInstance().GetRaceName(this, "不明"); |
26 | 28 | |
27 | 29 | public string GradeName => CodeHelper.GetInstance().GetName(CodeHelper.GRADE_CODE, Gradecd, "-"); |
30 | + | |
31 | + public string CourseName => CodeHelper.GetInstance().GetTrackKubun(Trackcd, "不明") + Kyori; | |
28 | 32 | } |
29 | 33 | } |
@@ -21,10 +21,14 @@ namespace UmaTest.App.Adaptor.Gateway.ViewModel.Dto | ||
21 | 21 | |
22 | 22 | public string YearMonthDay { get => Year + "/" + Monthday.Substring(0, 2) + "/" + Monthday.Substring(2, 2); } |
23 | 23 | |
24 | - public string RaceName => CodeHelper.GetInstance().GetRaceName(Race, "不明"); | |
24 | + public string JyoName { get => CodeHelper.GetInstance().GetName(CodeHelper.JYO_CODE, Jyocd, 3, "不明"); } | |
25 | + | |
26 | + public string RaceName => Race != null ? CodeHelper.GetInstance().GetRaceName(Race, "不明") : string.Empty; | |
25 | 27 | |
26 | 28 | public string GradeName => CodeHelper.GetInstance().GetName(CodeHelper.GRADE_CODE, Race.Gradecd, "-"); |
27 | 29 | |
30 | + public string CourseName => Race != null ? CodeHelper.GetInstance().GetTrackKubun(Race.Trackcd, "不明") + Race.Kyori : string.Empty; | |
31 | + | |
28 | 32 | public string Kimete => CodeHelper.GetInstance().GetName(CodeHelper.KYAKUSITU_KUBUN, Kyakusitukubun, "不明"); |
29 | 33 | |
30 | 34 | public string BataijyuFormatted |
@@ -10,6 +10,7 @@ namespace UmaTest.App.Adaptor.Gateway.ViewModel | ||
10 | 10 | { |
11 | 11 | public interface IMainWindowViewModel |
12 | 12 | { |
13 | + string Caption { get; set; } | |
13 | 14 | ICommand CommandOpenHorseList { get; } |
14 | 15 | ICommand CommandOpenTokuRaceList { get; } |
15 | 16 | ICommand CommandSearchRace { get; } |
@@ -19,11 +20,10 @@ namespace UmaTest.App.Adaptor.Gateway.ViewModel | ||
19 | 20 | ISearchRaceViewProxy SearchRaceViewProxy { get; } |
20 | 21 | ITokuRaceListProxy TokuRaceListProxy { get; } |
21 | 22 | BindingList<UmaSummaryRowDto> UmaSummaryList { get; set; } |
23 | + EventObserver UmaSummaryListChangingEvent { get; set; } | |
22 | 24 | |
23 | 25 | event PropertyChangedEventHandler PropertyChanged; |
24 | 26 | |
25 | - EventObserver UmaSummaryListChangingEvent { get; set; } | |
26 | - | |
27 | 27 | void RefreshModel(List<UmaSummaryRowDto> umaSummaryList, Dictionary<string, List<UmaRaceRowDto>> umaRaceMap); |
28 | 28 | } |
29 | 29 | } |
\ No newline at end of file |
@@ -63,6 +63,14 @@ namespace UmaTest.App.Adaptor.Gateway.ViewModel | ||
63 | 63 | EventSelectedHorseChanged = new EventHandler(OnSelectedHorseChanged); |
64 | 64 | } |
65 | 65 | |
66 | + private string _caption; | |
67 | + | |
68 | + public string Caption | |
69 | + { | |
70 | + get => _caption; | |
71 | + set => PropertyChanged.RaiseIfSet(() => Caption, ref _caption, value); | |
72 | + } | |
73 | + | |
66 | 74 | private BindingList<UmaSummaryRowDto> _umaSummaryList = new BindingList<UmaSummaryRowDto>(); |
67 | 75 | |
68 | 76 | public BindingList<UmaSummaryRowDto> UmaSummaryList |
@@ -22,6 +22,8 @@ namespace UmaTest.App.Gateway.Presenter | ||
22 | 22 | private IMainWindowViewModel vm; |
23 | 23 | private IStatusBarProxy statusBar; |
24 | 24 | |
25 | + private AsyncLoadSelectedRaceUmaListRequest req; | |
26 | + | |
25 | 27 | private List<UmaSummaryRowDto> umaSummaryList = new List<UmaSummaryRowDto>(); |
26 | 28 | private Dictionary<string, List<UmaRaceRowDto>> umaRaceMap = new Dictionary<string, List<UmaRaceRowDto>>(); |
27 | 29 |
@@ -36,7 +38,7 @@ namespace UmaTest.App.Gateway.Presenter | ||
36 | 38 | { |
37 | 39 | return TaskHelper.RunWithUIAction<UseCaseResponse>(Task.Run<UseCaseResponse>(() => |
38 | 40 | { |
39 | - AsyncLoadSelectedRaceUmaListRequest req = baseRes.Request as AsyncLoadSelectedRaceUmaListRequest; | |
41 | + req = baseRes.Request as AsyncLoadSelectedRaceUmaListRequest; | |
40 | 42 | AsyncLoadSelectedRaceUmaListResponse res = baseRes as AsyncLoadSelectedRaceUmaListResponse; |
41 | 43 | |
42 | 44 | IEnumerable<UmaInfo> horses = res.Horses; |
@@ -156,6 +158,8 @@ namespace UmaTest.App.Gateway.Presenter | ||
156 | 158 | { |
157 | 159 | statusBar.SetStatusText("ビューモデルを更新中です..."); |
158 | 160 | |
161 | + SearchRaceRowDto race = req.Race; | |
162 | + vm.Caption = $"レース検索結果:[ {race.YearMonthDay} {race.JyoName}{int.Parse(race.Racenum)}R {race.RaceName} ({race.CourseName}m) ]"; | |
159 | 163 | vm.RefreshModel(umaSummaryList, umaRaceMap); |
160 | 164 | }); |
161 | 165 | } |
@@ -22,6 +22,7 @@ namespace UmaTest.App.Gateway.Presenter | ||
22 | 22 | private IMainWindowViewModel vm; |
23 | 23 | private IStatusBarProxy statusBar; |
24 | 24 | |
25 | + private AsyncLoadTokuUmaListRequest req; | |
25 | 26 | private List<UmaSummaryRowDto> umaSummaryList = new List<UmaSummaryRowDto>(); |
26 | 27 | private Dictionary<string, List<UmaRaceRowDto>> umaRaceMap = new Dictionary<string, List<UmaRaceRowDto>>(); |
27 | 28 |
@@ -36,7 +37,7 @@ namespace UmaTest.App.Gateway.Presenter | ||
36 | 37 | { |
37 | 38 | return TaskHelper.RunWithUIAction<UseCaseResponse>(Task.Run<UseCaseResponse>(() => |
38 | 39 | { |
39 | - AsyncLoadTokuUmaListRequest req = baseRes.Request as AsyncLoadTokuUmaListRequest; | |
40 | + req = baseRes.Request as AsyncLoadTokuUmaListRequest; | |
40 | 41 | AsyncLoadTokuUmaListResponse res = baseRes as AsyncLoadTokuUmaListResponse; |
41 | 42 | |
42 | 43 | List<string> kettoNums = res.KettoNums; |
@@ -157,6 +158,10 @@ namespace UmaTest.App.Gateway.Presenter | ||
157 | 158 | }), |
158 | 159 | task => |
159 | 160 | { |
161 | + statusBar.SetStatusText("ビューモデルを更新中です..."); | |
162 | + | |
163 | + TokuRaceRowDto race = req.Race; | |
164 | + vm.Caption = $"特別登録:[ {race.YearMonthDay} {race.JyoName}{int.Parse(race.Racenum)}R {race.RaceName} ({race.CourseName}m) ]"; | |
160 | 165 | vm.RefreshModel(umaSummaryList, umaRaceMap); |
161 | 166 | }); |
162 | 167 | } |
@@ -23,7 +23,7 @@ namespace UmaTest.App.Domain.Model.Repository.Database.Dto | ||
23 | 23 | |
24 | 24 | try |
25 | 25 | { |
26 | - return (int.Parse(Tanodds) / 10.0f).ToString(); | |
26 | + return (int.Parse(Tanodds) / 10.0f).ToString("#.0"); | |
27 | 27 | } |
28 | 28 | catch (Exception) |
29 | 29 | { |
@@ -12,12 +12,12 @@ namespace UmaTest.App.Domain.UseCase.Request | ||
12 | 12 | { |
13 | 13 | public class AsyncLoadSelectedRaceUmaListRequest : UseCaseRequest |
14 | 14 | { |
15 | - public AsyncLoadSelectedRaceUmaListRequest(NRace race) | |
15 | + public AsyncLoadSelectedRaceUmaListRequest(SearchRaceRowDto race) | |
16 | 16 | { |
17 | 17 | Race = race; |
18 | 18 | } |
19 | 19 | |
20 | - public NRace Race { get; private set; } | |
20 | + public SearchRaceRowDto Race { get; private set; } | |
21 | 21 | |
22 | 22 | |
23 | 23 | protected override UseCaseResponse CreateResponse() |
@@ -12,12 +12,12 @@ namespace UmaTest.App.Domain.UseCase.Request | ||
12 | 12 | { |
13 | 13 | public class AsyncLoadTokuUmaListRequest : UseCaseRequest |
14 | 14 | { |
15 | - public AsyncLoadTokuUmaListRequest(NTokuRace race) | |
15 | + public AsyncLoadTokuUmaListRequest(TokuRaceRowDto race) | |
16 | 16 | { |
17 | 17 | Race = race; |
18 | 18 | } |
19 | 19 | |
20 | - public NTokuRace Race { get; private set; } | |
20 | + public TokuRaceRowDto Race { get; private set; } | |
21 | 21 | |
22 | 22 | |
23 | 23 | protected override UseCaseResponse CreateResponse() |
@@ -138,6 +138,11 @@ namespace UmaTest.App.Presentation.View | ||
138 | 138 | }, |
139 | 139 | new DataGridViewTextBoxColumn |
140 | 140 | { |
141 | + DataPropertyName = "Konso.FutanFormatted", | |
142 | + Name = "斤量", | |
143 | + }, | |
144 | + new DataGridViewTextBoxColumn | |
145 | + { | |
141 | 146 | DataPropertyName = "BataijyuFormatted", |
142 | 147 | Name = "馬体重", |
143 | 148 | }, |
@@ -153,6 +158,11 @@ namespace UmaTest.App.Presentation.View | ||
153 | 158 | }, |
154 | 159 | new DataGridViewTextBoxColumn |
155 | 160 | { |
161 | + DataPropertyName = "Konso.Kakuteijyuni", | |
162 | + Name = "着順", | |
163 | + }, | |
164 | + new DataGridViewTextBoxColumn | |
165 | + { | |
156 | 166 | DataPropertyName = "Short.G1", |
157 | 167 | Name = "短G1", |
158 | 168 | }, |
@@ -254,9 +264,16 @@ namespace UmaTest.App.Presentation.View | ||
254 | 264 | }; |
255 | 265 | |
256 | 266 | grid1Cols.Do(col => col.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter); |
257 | - | |
258 | 267 | dataGridView1.Columns.AddRange(grid1Cols); |
259 | 268 | |
269 | + dataGridView1.Columns["調教師"].HeaderCell.Style.WrapMode = DataGridViewTriState.False; | |
270 | + dataGridView1.Columns["馬体重"].HeaderCell.Style.WrapMode = DataGridViewTriState.False; | |
271 | + dataGridView1.Columns["オッズ"].HeaderCell.Style.WrapMode = DataGridViewTriState.False; | |
272 | + | |
273 | + dataGridView1.Columns["枠番"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; | |
274 | + dataGridView1.Columns["戦数"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; | |
275 | + dataGridView1.Columns["オッズ"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; | |
276 | + | |
260 | 277 | // |
261 | 278 | // Initialize DataGridView2 |
262 | 279 | // |
@@ -276,6 +293,11 @@ namespace UmaTest.App.Presentation.View | ||
276 | 293 | }, |
277 | 294 | new DataGridViewTextBoxColumn |
278 | 295 | { |
296 | + DataPropertyName = "JyoName", | |
297 | + Name = "場所", | |
298 | + }, | |
299 | + new DataGridViewTextBoxColumn | |
300 | + { | |
279 | 301 | DataPropertyName = "RaceName", |
280 | 302 | Name = "レース名", |
281 | 303 | }, |
@@ -286,8 +308,8 @@ namespace UmaTest.App.Presentation.View | ||
286 | 308 | }, |
287 | 309 | new DataGridViewTextBoxColumn |
288 | 310 | { |
289 | - DataPropertyName = "Race.Kyori", | |
290 | - Name = "距離", | |
311 | + DataPropertyName = "CourseName", | |
312 | + Name = "コース", | |
291 | 313 | }, |
292 | 314 | new DataGridViewTextBoxColumn |
293 | 315 | { |
@@ -322,7 +344,7 @@ namespace UmaTest.App.Presentation.View | ||
322 | 344 | new DataGridViewTextBoxColumn |
323 | 345 | { |
324 | 346 | DataPropertyName = "FutanFormatted", |
325 | - Name = "負担", | |
347 | + Name = "斤量", | |
326 | 348 | }, |
327 | 349 | new DataGridViewTextBoxColumn |
328 | 350 | { |
@@ -337,9 +359,14 @@ namespace UmaTest.App.Presentation.View | ||
337 | 359 | }; |
338 | 360 | |
339 | 361 | grid2Cols.Do(col => col.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter); |
340 | - | |
341 | 362 | dataGridView2.Columns.AddRange(grid2Cols); |
342 | 363 | |
364 | + dataGridView2.Columns["レース名"].HeaderCell.Style.WrapMode = DataGridViewTriState.False; | |
365 | + dataGridView2.Columns["コース"].HeaderCell.Style.WrapMode = DataGridViewTriState.False; | |
366 | + dataGridView2.Columns["馬体重"].HeaderCell.Style.WrapMode = DataGridViewTriState.False; | |
367 | + | |
368 | + dataGridView2.Columns["枠番"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; | |
369 | + | |
343 | 370 | // |
344 | 371 | // Custom Type Descriptor for Child Entity Properties |
345 | 372 | // |
@@ -424,6 +451,9 @@ namespace UmaTest.App.Presentation.View | ||
424 | 451 | |
425 | 452 | switch (args.PropertyName) |
426 | 453 | { |
454 | + case "Caption": | |
455 | + this.Text = AppConst.CAPTION + " - " + vm.Caption; | |
456 | + break; | |
427 | 457 | case "UmaSummaryList": |
428 | 458 | { |
429 | 459 | bindingSource1.DataSource = vm.UmaSummaryList; |
@@ -107,8 +107,8 @@ namespace UmaTest.App.Presentation.View | ||
107 | 107 | }, |
108 | 108 | new DataGridViewTextBoxColumn |
109 | 109 | { |
110 | - DataPropertyName = "Kyori", | |
111 | - Name = "距離", | |
110 | + DataPropertyName = "CourseName", | |
111 | + Name = "コース", | |
112 | 112 | }, |
113 | 113 | new DataGridViewTextBoxColumn |
114 | 114 | { |
@@ -87,6 +87,16 @@ namespace UmaTest.App.Presentation.View | ||
87 | 87 | }, |
88 | 88 | new DataGridViewTextBoxColumn |
89 | 89 | { |
90 | + DataPropertyName = "JyoName", | |
91 | + Name = "場所", | |
92 | + }, | |
93 | + new DataGridViewTextBoxColumn | |
94 | + { | |
95 | + DataPropertyName = "Racenum", | |
96 | + Name = "R", | |
97 | + }, | |
98 | + new DataGridViewTextBoxColumn | |
99 | + { | |
90 | 100 | DataPropertyName = "RaceName", |
91 | 101 | Name = "レース名", |
92 | 102 | }, |
@@ -97,8 +107,8 @@ namespace UmaTest.App.Presentation.View | ||
97 | 107 | }, |
98 | 108 | new DataGridViewTextBoxColumn |
99 | 109 | { |
100 | - DataPropertyName = "Kyori", | |
101 | - Name = "距離", | |
110 | + DataPropertyName = "CourseName", | |
111 | + Name = "コース", | |
102 | 112 | }, |
103 | 113 | }; |
104 | 114 |
@@ -14,6 +14,7 @@ namespace UmaTest.Infra.Helper | ||
14 | 14 | public static readonly string JYO_CODE = "2001"; |
15 | 15 | public static readonly string GRADE_CODE = "2003"; |
16 | 16 | public static readonly string JYOKEN_CODE = "2007"; |
17 | + public static readonly string TRACK_CODE = "2009"; | |
17 | 18 | |
18 | 19 | public static readonly string SEX_CODE = "2202"; |
19 | 20 |
@@ -86,6 +87,48 @@ namespace UmaTest.Infra.Helper | ||
86 | 87 | return GetName(CodeHelper.JYOKEN_CODE, jyokenCd, errorValue); |
87 | 88 | } |
88 | 89 | |
90 | + public string GetTrackKubun(string trackCd, string errorValue) | |
91 | + { | |
92 | + string trackEngName = GetName(TRACK_CODE, trackCd, 2, errorValue); | |
93 | + | |
94 | + if (trackCd.CompareTo("50") < 0) | |
95 | + { | |
96 | + return ExtractTurfDartKbn(trackEngName); | |
97 | + } | |
98 | + else | |
99 | + { | |
100 | + string turfDartKbn = (trackCd != "52") ? ExtractTurfDartKbn(trackEngName) : "芝ダ"; | |
101 | + return "障" + turfDartKbn; | |
102 | + } | |
103 | + } | |
104 | + | |
105 | + private static string ExtractTurfDartKbn(string trackEngName) | |
106 | + { | |
107 | + if (string.IsNullOrEmpty(trackEngName)) | |
108 | + { | |
109 | + return string.Empty; | |
110 | + } | |
111 | + | |
112 | + string turfDartKbn; | |
113 | + switch (trackEngName.Substring(0, 1)) | |
114 | + { | |
115 | + case "T": | |
116 | + turfDartKbn = "芝"; | |
117 | + break; | |
118 | + case "D": | |
119 | + turfDartKbn = "ダ"; | |
120 | + break; | |
121 | + case "S": | |
122 | + turfDartKbn = "砂"; | |
123 | + break; | |
124 | + default: | |
125 | + turfDartKbn = "?"; | |
126 | + break; | |
127 | + } | |
128 | + | |
129 | + return turfDartKbn; | |
130 | + } | |
131 | + | |
89 | 132 | public string GetName(string code, string value, string errorValue = ERROR_VALUE) |
90 | 133 | { |
91 | 134 | return GetName(code, value, 0, errorValue); |
@@ -102,6 +102,7 @@ | ||
102 | 102 | <Reference Include="System.Xml" /> |
103 | 103 | </ItemGroup> |
104 | 104 | <ItemGroup> |
105 | + <Compile Include="App\Adaptor\Gateway\ViewModel\IMainWindowViewModel.cs" /> | |
105 | 106 | <Compile Include="App\Domain\Model\Repository\Database\Dto\OddsInfo.cs" /> |
106 | 107 | <Compile Include="App\Domain\Model\Repository\Database\Dto\TokuUmaInfo.cs" /> |
107 | 108 | <Compile Include="App\Domain\Model\Repository\Database\Dto\UmaInfo.cs" /> |
@@ -116,7 +117,6 @@ | ||
116 | 117 | <Compile Include="App\Adaptor\Gateway\ViewModel\Dto\UmaRaceRowDto.cs" /> |
117 | 118 | <Compile Include="App\Adaptor\Gateway\ViewModel\Dto\UmaSummaryRowDto.cs" /> |
118 | 119 | <Compile Include="App\Adaptor\Gateway\UI\ITokuRaceListProxy.cs" /> |
119 | - <Compile Include="App\Adaptor\Gateway\ViewModel\IMainWindowViewModel.cs" /> | |
120 | 120 | <Compile Include="App\Adaptor\Gateway\ViewModel\ISearchRaceViewModel.cs" /> |
121 | 121 | <Compile Include="App\Adaptor\Gateway\ViewModel\ITokuRaceListViewModel.cs" /> |
122 | 122 | <Compile Include="App\Adaptor\Gateway\ViewModel\SearchRaceViewModel.cs" /> |