• 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

Revisión44c0c71583d2c32f739d266020fd99d0354e45bc (tree)
Tiempo2021-06-07 02:27:27
Autoryoshy <yoshy@user...>
Commiteryoshy

Log Message

temp_20210607_0227

Cambiar Resumen

Diferencia incremental

--- a/App/Presentation/View/MainWindow.cs
+++ b/App/Presentation/View/MainWindow.cs
@@ -18,6 +18,7 @@ using UmaTest.App.Domain.Model.Repository.Database.Entity.EveryDB2;
1818 using UmaTest.Infra.Adaptor.Command;
1919 using UmaTest.Infra.Adaptor.ViewModel;
2020 using UmaTest.Infra.Domain.Translator;
21+using UmaTest.Infra.Helper;
2122 using UmaTest.Infra.Presentation.View;
2223
2324 namespace UmaTest.App.Presentation.View
@@ -202,8 +203,8 @@ namespace UmaTest.App.Presentation.View
202203 },
203204 new DataGridViewTextBoxColumn
204205 {
205- DataPropertyName = "Zenso.GradeName",
206- Name = "前走G",
206+ DataPropertyName = "Zenso.JyoName",
207+ Name = "前走場所",
207208 },
208209 new DataGridViewTextBoxColumn
209210 {
@@ -212,6 +213,11 @@ namespace UmaTest.App.Presentation.View
212213 },
213214 new DataGridViewTextBoxColumn
214215 {
216+ DataPropertyName = "Zenso.GradeName",
217+ Name = "前走G",
218+ },
219+ new DataGridViewTextBoxColumn
220+ {
215221 DataPropertyName = "Zenso.RaceName",
216222 Name = "前走レース名",
217223 },
@@ -287,8 +293,8 @@ namespace UmaTest.App.Presentation.View
287293 },
288294 new DataGridViewTextBoxColumn
289295 {
290- DataPropertyName = "NisoMae.GradeName",
291- Name = "前々走G",
296+ DataPropertyName = "NisoMae.JyoName",
297+ Name = "前々走場所",
292298 },
293299 new DataGridViewTextBoxColumn
294300 {
@@ -297,6 +303,11 @@ namespace UmaTest.App.Presentation.View
297303 },
298304 new DataGridViewTextBoxColumn
299305 {
306+ DataPropertyName = "NisoMae.GradeName",
307+ Name = "前々走G",
308+ },
309+ new DataGridViewTextBoxColumn
310+ {
300311 DataPropertyName = "NisoMae.RaceName",
301312 Name = "前々走レース名",
302313 },
@@ -546,13 +557,13 @@ namespace UmaTest.App.Presentation.View
546557 },
547558 new DataGridViewTextBoxColumn
548559 {
549- DataPropertyName = "GradeName",
550- Name = "G",
560+ DataPropertyName = "CourseName",
561+ Name = "コース",
551562 },
552563 new DataGridViewTextBoxColumn
553564 {
554- DataPropertyName = "CourseName",
555- Name = "コース",
565+ DataPropertyName = "GradeName",
566+ Name = "G",
556567 },
557568 new DataGridViewTextBoxColumn
558569 {
@@ -841,9 +852,13 @@ namespace UmaTest.App.Presentation.View
841852 {
842853 foreach (DataGridViewRow row in dataGridView1.Rows)
843854 {
855+ UmaSummaryRowDto rowDto = row.DataBoundItem as UmaSummaryRowDto;
856+
857+ DataGridViewCell cellJyuni = row.Cells["着順"];
844858 DataGridViewCell cellNinki = row.Cells["人気"];
845859
846860 ColorizeNinki(cellNinki);
861+ ColorizeJyuni(cellJyuni, cellNinki);
847862
848863 DataGridViewCell cellKankaku = row.Cells["間隔"];
849864
@@ -853,6 +868,18 @@ namespace UmaTest.App.Presentation.View
853868
854869 ColorizeKankaku(cellZensoKankaku);
855870
871+ DataGridViewCell cellZensoGrade = row.Cells["前走G"];
872+ DataGridViewCell cellZensoBasyo = row.Cells["前走場所"];
873+ DataGridViewCell cellZensoCourse = row.Cells["前走コース"];
874+
875+ ColorizeGradeBasyoCourse(rowDto.Zenso?.Race, cellZensoGrade, cellZensoBasyo, cellZensoCourse);
876+
877+ DataGridViewCell cellNisoMaeGrade = row.Cells["前々走G"];
878+ DataGridViewCell cellNisoMaeBasyo = row.Cells["前々走場所"];
879+ DataGridViewCell cellNisoMaeCourse = row.Cells["前々走コース"];
880+
881+ ColorizeGradeBasyoCourse(rowDto.NisoMae?.Race, cellNisoMaeGrade, cellNisoMaeBasyo, cellNisoMaeCourse);
882+
856883 DataGridViewCell cellZensoJyuni = row.Cells["前走着順"];
857884 DataGridViewCell cellZensoNinki = row.Cells["前走人気"];
858885
@@ -891,23 +918,20 @@ namespace UmaTest.App.Presentation.View
891918 }
892919 }
893920
894- private static void ChangeCellBackColor(DataGridViewCell cell, Color backColor)
895- {
896- cell.Style.BackColor = backColor;
897- cell.Style.SelectionBackColor = backColor;
898- cell.Style.SelectionForeColor = SystemColors.WindowText;
899- }
900-
901921 private void ColorizeUmaRaceListView()
902922 {
903923 foreach (DataGridViewRow row in dataGridView2.Rows)
904924 {
905- DataGridViewCell cellNinki = row.Cells["人気"];
925+ DataGridViewCell cellGrade = row.Cells["G"];
926+ DataGridViewCell cellBasyo = row.Cells["場所"];
927+ DataGridViewCell cellCourse = row.Cells["コース"];
906928
907- ColorizeNinki(cellNinki);
929+ ColorizeGradeBasyoCourse(row, cellGrade, cellBasyo, cellCourse);
908930
931+ DataGridViewCell cellNinki = row.Cells["人気"];
909932 DataGridViewCell cellJyuni = row.Cells["着順"];
910933
934+ ColorizeNinki(cellNinki);
911935 ColorizeJyuni(cellJyuni, cellNinki);
912936
913937 DataGridViewCell cellPCI = row.Cells["ペース変化指数"];
@@ -924,9 +948,182 @@ namespace UmaTest.App.Presentation.View
924948 }
925949 }
926950
951+ private void ColorizeGradeBasyoCourse(DataGridViewRow row, DataGridViewCell cellGrade, DataGridViewCell cellBasyo, DataGridViewCell cellCourse)
952+ {
953+ NRace race = null;
954+
955+ if (row.DataBoundItem.GetType() == typeof(UmaRaceRowDto))
956+ {
957+ UmaRaceRowDto rowDto = row.DataBoundItem as UmaRaceRowDto;
958+ race = rowDto.Race;
959+ }
960+
961+ if (race == null)
962+ {
963+ return;
964+ }
965+
966+ ColorizeGradeBasyoCourse(race, cellGrade, cellBasyo, cellCourse);
967+ }
968+
969+ private void ColorizeGradeBasyoCourse(NRace race, DataGridViewCell cellGrade, DataGridViewCell cellBasyo, DataGridViewCell cellCourse)
970+ {
971+ if ( (race == null) || (cellGrade?.Value == null) || (cellBasyo?.Value == null) || (cellCourse?.Value == null) )
972+ {
973+ return;
974+ }
975+
976+ if (!int.TryParse(raceInfo?.Kyori, out int raceKyori))
977+ {
978+ return;
979+ }
980+
981+ if (!int.TryParse(race?.Kyori, out int rowKyori))
982+ {
983+ return;
984+ }
985+
986+ string raceTurfDirt = CodeHelper.GetInstance().GetTurfDurtName(raceInfo?.Trackcd, string.Empty);
987+ string rowTurfDirt = CodeHelper.GetInstance().GetTurfDurtName(race.Trackcd, string.Empty);
988+
989+ bool isRowNearKyori = Math.Abs(raceKyori - rowKyori) <= 200;
990+ bool isRowEqualKyori = raceKyori == rowKyori;
991+ bool isRowEqualTrackCd = raceInfo?.Trackcd == race.Trackcd;
992+ bool isRowEqualJyoCd = raceInfo?.Jyocd == race.Jyocd;
993+ bool isRowEqualTurfDirt = raceTurfDirt == rowTurfDirt;
994+ bool isRowEqualGrade = raceInfo?.GradeName == CodeHelper.GetInstance().GetGradeName(race, string.Empty);
995+
996+ bool isNearCourse = isRowEqualTurfDirt && isRowNearKyori;
997+ bool isEqualCourse = isNearCourse && isRowEqualKyori && isRowEqualTrackCd;
998+
999+ bool isNearBasyoCourse = isNearCourse && isRowEqualJyoCd;
1000+ bool isEqualBasyoCourse = isNearBasyoCourse && isEqualCourse;
1001+
1002+ bool isNearGrade = isNearCourse && isRowEqualGrade;
1003+ bool isEqualGrade = isNearGrade && isEqualBasyoCourse;
1004+
1005+ Color colorGrade = isNearGrade
1006+ ? isEqualGrade
1007+ ? Color.Yellow
1008+ : Color.Cyan
1009+ : Color.Transparent;
1010+
1011+ Color colorBasyo = isNearBasyoCourse
1012+ ? isEqualBasyoCourse
1013+ ? Color.Yellow
1014+ : Color.Cyan
1015+ : Color.Transparent;
1016+
1017+ Color colorCourse = isNearCourse
1018+ ? isEqualCourse
1019+ ? Color.Yellow
1020+ : Color.Cyan
1021+ : Color.Transparent;
1022+
1023+ if (colorGrade != Color.Transparent)
1024+ {
1025+ ChangeCellBackColor(cellGrade, colorGrade);
1026+ }
1027+
1028+ if (colorBasyo != Color.Transparent)
1029+ {
1030+ ChangeCellBackColor(cellBasyo, colorBasyo);
1031+ }
1032+
1033+ if (colorCourse != Color.Transparent)
1034+ {
1035+ ChangeCellBackColor(cellCourse, colorCourse);
1036+ }
1037+ }
1038+
1039+ private static void ColorizeKankaku(DataGridViewCell cellKankaku)
1040+ {
1041+ if (cellKankaku?.Value == null)
1042+ {
1043+ return;
1044+ }
1045+
1046+ if (int.TryParse(cellKankaku.Value.ToString(), out int kankaku))
1047+ {
1048+ if (kankaku >= 30)
1049+ {
1050+ ChangeCellBackColor(cellKankaku, Color.Orange);
1051+ }
1052+ else if (kankaku >= 10)
1053+ {
1054+ ChangeCellBackColor(cellKankaku, Color.Yellow);
1055+ }
1056+ }
1057+ }
1058+
1059+ private static void ColorizeNinki(DataGridViewCell cellNinki)
1060+ {
1061+ if (cellNinki?.Value == null)
1062+ {
1063+ return;
1064+ }
1065+
1066+ if (int.TryParse(cellNinki.Value.ToString(), out int ninki))
1067+ {
1068+ switch (ninki)
1069+ {
1070+ case 1:
1071+ ChangeCellBackColor(cellNinki, Color.Yellow);
1072+ break;
1073+ case 2:
1074+ ChangeCellBackColor(cellNinki, Color.Cyan);
1075+ break;
1076+ case 3:
1077+ ChangeCellBackColor(cellNinki, Color.LightGreen);
1078+ break;
1079+ default:
1080+ break;
1081+ }
1082+ }
1083+ }
1084+
1085+ private static void ColorizeJyuni(DataGridViewCell cellJyuni, DataGridViewCell cellNinki)
1086+ {
1087+ if ((cellJyuni?.Value == null) || (cellNinki?.Value == null))
1088+ {
1089+ return;
1090+ }
1091+
1092+ if (int.TryParse(cellJyuni.Value.ToString(), out int jyuni)
1093+ && int.TryParse(cellNinki.Value.ToString(), out int ninki))
1094+ {
1095+ switch (jyuni)
1096+ {
1097+ case 1:
1098+ ChangeCellBackColor(cellJyuni, Color.Yellow);
1099+ break;
1100+ case 2:
1101+ ChangeCellBackColor(cellJyuni, Color.Cyan);
1102+ break;
1103+ case 3:
1104+ ChangeCellBackColor(cellJyuni, Color.LightGreen);
1105+ break;
1106+ default:
1107+ if ( (ninki >= 6) && (jyuni <= 6) && (ninki - jyuni > 1) )
1108+ {
1109+ ChangeCellBackColor(cellJyuni, Color.LightSkyBlue);
1110+ }
1111+ else if ((ninki <= 3) && (jyuni > 3))
1112+ {
1113+ ChangeCellBackColor(cellJyuni, Color.Orange);
1114+ }
1115+ else if (ninki - jyuni < -2)
1116+ {
1117+ ChangeCellBackColor(cellJyuni, Color.Orange);
1118+ }
1119+ break;
1120+ }
1121+ }
1122+ }
1123+
9271124 private void ColorizePCI(DataGridViewCell cellPCI, DataGridViewCell cellJyuni)
9281125 {
929- if ( (cellPCI?.Value == null) || (cellJyuni?.Value == null) )
1126+ if ((cellPCI?.Value == null) || (cellJyuni?.Value == null))
9301127 {
9311128 return;
9321129 }
@@ -1099,89 +1296,11 @@ namespace UmaTest.App.Presentation.View
10991296 }
11001297 }
11011298
1102- private static void ColorizeKankaku(DataGridViewCell cellKankaku)
1103- {
1104- if (cellKankaku?.Value == null)
1105- {
1106- return;
1107- }
1108-
1109- if (int.TryParse(cellKankaku.Value.ToString(), out int kankaku))
1110- {
1111- if (kankaku >= 30)
1112- {
1113- ChangeCellBackColor(cellKankaku, Color.Orange);
1114- }
1115- else if (kankaku >= 10)
1116- {
1117- ChangeCellBackColor(cellKankaku, Color.Yellow);
1118- }
1119- }
1120- }
1121-
1122- private static void ColorizeNinki(DataGridViewCell cellNinki)
1123- {
1124- if (cellNinki?.Value == null)
1125- {
1126- return;
1127- }
1128-
1129- if (int.TryParse(cellNinki.Value.ToString(), out int ninki))
1130- {
1131- switch (ninki)
1132- {
1133- case 1:
1134- ChangeCellBackColor(cellNinki, Color.Yellow);
1135- break;
1136- case 2:
1137- ChangeCellBackColor(cellNinki, Color.Cyan);
1138- break;
1139- case 3:
1140- ChangeCellBackColor(cellNinki, Color.LightGreen);
1141- break;
1142- default:
1143- break;
1144- }
1145- }
1146- }
1147-
1148- private static void ColorizeJyuni(DataGridViewCell cellJyuni, DataGridViewCell cellNinki)
1299+ private static void ChangeCellBackColor(DataGridViewCell cell, Color backColor)
11491300 {
1150- if ((cellJyuni?.Value == null) || (cellNinki?.Value == null))
1151- {
1152- return;
1153- }
1154-
1155- if (int.TryParse(cellJyuni.Value.ToString(), out int jyuni)
1156- && int.TryParse(cellNinki.Value.ToString(), out int ninki))
1157- {
1158- switch (jyuni)
1159- {
1160- case 1:
1161- ChangeCellBackColor(cellJyuni, Color.Yellow);
1162- break;
1163- case 2:
1164- ChangeCellBackColor(cellJyuni, Color.Cyan);
1165- break;
1166- case 3:
1167- ChangeCellBackColor(cellJyuni, Color.LightGreen);
1168- break;
1169- default:
1170- if ( (ninki >= 6) && (jyuni <= 6) && (ninki - jyuni > 1) )
1171- {
1172- ChangeCellBackColor(cellJyuni, Color.LightSkyBlue);
1173- }
1174- else if ((ninki <= 3) && (jyuni > 3))
1175- {
1176- ChangeCellBackColor(cellJyuni, Color.Orange);
1177- }
1178- else if (ninki - jyuni < -2)
1179- {
1180- ChangeCellBackColor(cellJyuni, Color.Orange);
1181- }
1182- break;
1183- }
1184- }
1301+ cell.Style.BackColor = backColor;
1302+ cell.Style.SelectionBackColor = backColor;
1303+ cell.Style.SelectionForeColor = SystemColors.WindowText;
11851304 }
11861305
11871306 private void MainWindow_ResizeBegin(object sender, EventArgs e)