EveryDB2のデータベースを読み込んでWinFormでGUI表示するサンプル
Revision | f9d45d51c5764c098d0edb6b6698fd4db722bb3c (tree) |
---|---|
Zeit | 2021-05-31 20:23:21 |
Autor | yoshy <yoshy@user...> |
Commiter | yoshy |
temp_20210531_2023
@@ -16,6 +16,8 @@ namespace UmaTest.App.Adaptor.Controller | ||
16 | 16 | { |
17 | 17 | public class WindowController : IWindowController |
18 | 18 | { |
19 | + public static readonly string EVENT_UMA_SUMMARY_EVENT_CHANGING = "UmaSummaryListChangingEvent"; | |
20 | + | |
19 | 21 | private IUseCaseRouter router; |
20 | 22 | private IAsyncUseCaseRouter asyncRouter; |
21 | 23 | private IUserDialogProxy dialog; |
@@ -28,16 +30,12 @@ namespace UmaTest.App.Adaptor.Controller | ||
28 | 30 | this.dialog = dialog; |
29 | 31 | this.statusBar = statusBar; |
30 | 32 | |
31 | - Events = new Dictionary<String, EventHandler>() | |
32 | - { | |
33 | - //{ | |
34 | - // "ON_SIZE_CHANGED", | |
35 | - // new EventHandler(OnSizeChanged) | |
36 | - //} | |
37 | - }; | |
38 | - | |
39 | - MouseEvents = new Dictionary<String, MouseEventHandler>() | |
33 | + Events = new Dictionary<String, EventObserver>() | |
40 | 34 | { |
35 | + { | |
36 | + EVENT_UMA_SUMMARY_EVENT_CHANGING, | |
37 | + new EventObserver() | |
38 | + } | |
41 | 39 | }; |
42 | 40 | |
43 | 41 | Commands = new Dictionary<String, ICommand>() |
@@ -45,19 +43,10 @@ namespace UmaTest.App.Adaptor.Controller | ||
45 | 43 | }; |
46 | 44 | } |
47 | 45 | |
48 | - public Dictionary<String, EventHandler> Events { get; private set; } | |
49 | - | |
50 | - public Dictionary<String, MouseEventHandler> MouseEvents { get; private set; } | |
46 | + public Dictionary<String, EventObserver> Events { get; private set; } | |
51 | 47 | |
52 | 48 | public Dictionary<String, ICommand> Commands { get; private set; } |
53 | 49 | |
54 | - //private void OnSizeChanged(object sender, EventArgs e) | |
55 | - //{ | |
56 | - // vm.ChangeOuterRectSize(((Control)sender).Size); | |
57 | - | |
58 | - // // Handle(vm.CreateEkiMapRefreshRequest()); | |
59 | - //} | |
60 | - | |
61 | 50 | public UseCaseResponse Execute(UseCaseRequest req) |
62 | 51 | { |
63 | 52 | UseCaseResponse res = router.Handle(req); |
@@ -24,5 +24,7 @@ namespace UmaTest.App.Adaptor.Gateway.ViewModel.Dto | ||
24 | 24 | public string RaceName => CodeHelper.GetInstance().GetRaceName(Race, "不明"); |
25 | 25 | |
26 | 26 | public string GradeName => CodeHelper.GetInstance().GetName(CodeHelper.GRADE_CODE, Race.Gradecd, "-"); |
27 | + | |
28 | + public string Kimete => CodeHelper.GetInstance().GetName(CodeHelper.KYAKUSITU_KUBUN, Kyakusitukubun, "不明"); | |
27 | 29 | } |
28 | 30 | } |
@@ -42,6 +42,29 @@ namespace UmaTest.App.Adaptor.Gateway.ViewModel.Dto | ||
42 | 42 | |
43 | 43 | public string HahaChichiBamei { get => Konso?.HahaChichi.Bamei; } |
44 | 44 | |
45 | + public string BataijyuFormatted { | |
46 | + get | |
47 | + { | |
48 | + return !String.IsNullOrEmpty(Konso?.Bataijyu) ? $"{Konso?.Bataijyu} ({Konso?.Zogenfugo + int.Parse(Konso?.Zogensa).ToString()})" : ""; | |
49 | + } | |
50 | + } | |
51 | + | |
52 | + public string KonsoNinki { get => Konso?.OddsTanpku?.Tanninki; } | |
53 | + | |
54 | + public float KonsoTanOdds { | |
55 | + get | |
56 | + { | |
57 | + string odds = Konso?.OddsTanpku?.Tanodds; | |
58 | + if(String.IsNullOrEmpty(odds)) | |
59 | + { | |
60 | + return 0; // String.Empty; | |
61 | + } | |
62 | + | |
63 | + //return int.Parse(odds.Substring(0, 3)).ToString() + "." + odds.Substring(3, 1); | |
64 | + return int.Parse(odds) / 10.0f; | |
65 | + } | |
66 | + } | |
67 | + | |
45 | 68 | public UmaRaceRowDto Konso { get; set; } |
46 | 69 | |
47 | 70 | public UmaRaceRowDto Zenso { get; set; } |
@@ -4,6 +4,7 @@ using System.ComponentModel; | ||
4 | 4 | using UmaTest.App.Adaptor.Gateway.UI; |
5 | 5 | using UmaTest.App.Adaptor.Gateway.ViewModel.Dto; |
6 | 6 | using UmaTest.Infra.Adaptor.Command; |
7 | +using UmaTest.Infra.Adaptor.Controller; | |
7 | 8 | |
8 | 9 | namespace UmaTest.App.Adaptor.Gateway.ViewModel |
9 | 10 | { |
@@ -15,12 +16,14 @@ namespace UmaTest.App.Adaptor.Gateway.ViewModel | ||
15 | 16 | EventHandler EventSelectedHorseChanged { get; } |
16 | 17 | IManualHorseListProxy ManualHorseListProxy { get; } |
17 | 18 | BindingList<UmaRaceRowDto> RaceList { get; set; } |
18 | - ITokuRaceListProxy TokuRaceListProxy { get; } | |
19 | 19 | ISearchRaceViewProxy SearchRaceViewProxy { get; } |
20 | + ITokuRaceListProxy TokuRaceListProxy { get; } | |
20 | 21 | BindingList<UmaSummaryRowDto> UmaSummaryList { get; set; } |
21 | 22 | |
22 | 23 | event PropertyChangedEventHandler PropertyChanged; |
23 | 24 | |
25 | + EventObserver UmaSummaryListChangingEvent { get; set; } | |
26 | + | |
24 | 27 | void RefreshModel(List<UmaSummaryRowDto> umaSummaryList, Dictionary<string, List<UmaRaceRowDto>> umaRaceMap); |
25 | 28 | } |
26 | 29 | } |
\ No newline at end of file |
@@ -37,6 +37,12 @@ namespace UmaTest.App.Adaptor.Gateway.ViewModel | ||
37 | 37 | |
38 | 38 | public ISearchRaceViewProxy SearchRaceViewProxy { get; private set; } |
39 | 39 | |
40 | + public EventObserver UmaSummaryListChangingEvent | |
41 | + { | |
42 | + get => wc?.Events[WindowController.EVENT_UMA_SUMMARY_EVENT_CHANGING]; | |
43 | + set => wc.Events[WindowController.EVENT_UMA_SUMMARY_EVENT_CHANGING] = value; | |
44 | + } | |
45 | + | |
40 | 46 | private IWindowController wc; |
41 | 47 | |
42 | 48 | private Dictionary<string, List<UmaRaceRowDto>> _umaRaceMap = null; |
@@ -31,7 +31,7 @@ namespace UmaTest.App.Adaptor.Gateway.ViewModel | ||
31 | 31 | "Read", () => !String.IsNullOrEmpty(HorseList), OnExecuteReadManualHorseList); |
32 | 32 | //"Read", () => true, OnExecuteReadManualHorseList); |
33 | 33 | |
34 | - 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"; | |
34 | + 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"; | |
35 | 35 | } |
36 | 36 | |
37 | 37 | private async void OnExecuteReadManualHorseList() |
@@ -59,6 +59,8 @@ namespace UmaTest.App.Adaptor.Gateway.ViewModel | ||
59 | 59 | return; |
60 | 60 | } |
61 | 61 | |
62 | + wc.Events[WindowController.EVENT_UMA_SUMMARY_EVENT_CHANGING].Raise(this, new EventArgs()); | |
63 | + | |
62 | 64 | AsyncLoadSelectedRaceUmaListRequest req = new AsyncLoadSelectedRaceUmaListRequest(SearchResultRaceList[SelectedIndex]); |
63 | 65 | Logger.Debug($"OnSelectRace: {SelectedIndex}"); |
64 | 66 | await wc.ExecuteAsync(req); |
@@ -153,6 +153,8 @@ namespace UmaTest.App.Gateway.Presenter | ||
153 | 153 | }), |
154 | 154 | task => |
155 | 155 | { |
156 | + statusBar.SetStatusText("ビューモデルを更新中です..."); | |
157 | + | |
156 | 158 | vm.RefreshModel(umaSummaryList, umaRaceMap); |
157 | 159 | }); |
158 | 160 | } |
@@ -68,22 +68,23 @@ namespace UmaTest.App.Domain.Model.Repository.Database.Dao | ||
68 | 68 | // res.Add(kettoNum, races.ToList()); |
69 | 69 | //} |
70 | 70 | |
71 | - string sql = "SELECT ur.*, r.*, k.*, c.*, h1.*, h5.* " | |
71 | + string sql = "SELECT ur.*, r.*, k.*, c.*, ot.*, h1.*, h5.* " | |
72 | 72 | + "FROM n_uma_race ur " |
73 | 73 | + "INNER JOIN n_uma u USING(kettonum) " |
74 | 74 | + "INNER JOIN n_race r USING(year, jyocd, kaiji, nichiji, racenum) " |
75 | 75 | + "LEFT JOIN n_kisyu k USING(kisyucode) " |
76 | 76 | + "LEFT JOIN n_chokyo c ON ur.chokyosicode = c.chokyosicode " |
77 | + + "LEFT JOIN n_odds_tanpuku ot USING(year, jyocd, kaiji, nichiji, racenum, umaban) " | |
77 | 78 | + "LEFT JOIN n_hansyoku h1 ON u.ketto3infohansyokunum1 = h1.hansyokunum " |
78 | 79 | + "LEFT JOIN n_hansyoku h5 ON u.ketto3infohansyokunum5 = h5.hansyokunum " |
79 | 80 | + "WHERE ur.kettonum in (@KettoNums) " |
80 | 81 | + "ORDER BY ur.kettonum, ur.year desc, ur.monthday desc"; |
81 | 82 | |
82 | - Func<NUmaRace, NRace, NKisyu, NChokyo, NHansyoku, NHansyoku, NUmaRaceInfo> mapper = | |
83 | - (ur, r, k, c, h1, h5) => new NUmaRaceInfo(ur, r, k, c, h1, h5); | |
83 | + Func<NUmaRace, NRace, NKisyu, NChokyo, NOddsTanpuku, NHansyoku, NHansyoku, NUmaRaceInfo> mapper = | |
84 | + (ur, r, k, c, o, h1, h5) => new NUmaRaceInfo(ur, r, k, c, o, h1, h5); | |
84 | 85 | |
85 | 86 | Type[] mapTypes = new Type[] { typeof(NUmaRace), typeof(NRace), typeof(NKisyu), |
86 | - typeof(NChokyo), typeof(NHansyoku), typeof(NHansyoku) }; | |
87 | + typeof(NChokyo), typeof(NOddsTanpuku), typeof(NHansyoku), typeof(NHansyoku) }; | |
87 | 88 | |
88 | 89 | IEnumerable<NUmaRaceInfo> races = db.Query<NUmaRaceInfo>( |
89 | 90 | mapTypes, mapper, sql, new { KettoNums = kettoNumList.ToArray() }); |
@@ -15,12 +15,13 @@ namespace UmaTest.App.Domain.Model.Repository.Database.Dto | ||
15 | 15 | { |
16 | 16 | } |
17 | 17 | |
18 | - public NUmaRaceInfo(NUmaRace ur, NRace r, NKisyu kisyu, NChokyo chokyo, NHansyoku chichi, NHansyoku hahachichi) | |
18 | + public NUmaRaceInfo(NUmaRace ur, NRace r, NKisyu kisyu, NChokyo chokyo, NOddsTanpuku oddsTanpuku, NHansyoku chichi, NHansyoku hahachichi) | |
19 | 19 | { |
20 | 20 | BeanHelper.Copy(this, ur); |
21 | 21 | Race = r; |
22 | 22 | Kisyu = kisyu; |
23 | 23 | Chokyo = chokyo; |
24 | + OddsTanpku = oddsTanpuku; | |
24 | 25 | Chichi = chichi; |
25 | 26 | HahaChichi = hahachichi; |
26 | 27 | } |
@@ -35,6 +36,9 @@ namespace UmaTest.App.Domain.Model.Repository.Database.Dto | ||
35 | 36 | public NChokyo Chokyo { get; set; } |
36 | 37 | |
37 | 38 | [Ignore] |
39 | + public NOddsTanpuku OddsTanpku { get; set; } | |
40 | + | |
41 | + [Ignore] | |
38 | 42 | public NHansyoku Chichi { get; set; } |
39 | 43 | |
40 | 44 | [Ignore] |
@@ -29,10 +29,16 @@ namespace UmaTest.App.Presentation.View | ||
29 | 29 | /// </summary> |
30 | 30 | private void InitializeComponent() |
31 | 31 | { |
32 | + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); | |
33 | + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); | |
34 | + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); | |
35 | + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); | |
36 | + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); | |
32 | 37 | this.menuStrip1 = new System.Windows.Forms.MenuStrip(); |
33 | 38 | this.toolStripMenuFile = new System.Windows.Forms.ToolStripMenuItem(); |
34 | 39 | this.toolStripMenuOpenHorseList = new System.Windows.Forms.ToolStripMenuItem(); |
35 | 40 | this.toolStripMenuOpenTokuRaceList = new System.Windows.Forms.ToolStripMenuItem(); |
41 | + this.toolStripMenuSearchRace = new System.Windows.Forms.ToolStripMenuItem(); | |
36 | 42 | this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); |
37 | 43 | this.toolStripMenuQuit = new System.Windows.Forms.ToolStripMenuItem(); |
38 | 44 | this.splitContainer1 = new System.Windows.Forms.SplitContainer(); |
@@ -42,7 +48,6 @@ namespace UmaTest.App.Presentation.View | ||
42 | 48 | this.dataGridView2 = new System.Windows.Forms.DataGridView(); |
43 | 49 | this.statusStrip1 = new System.Windows.Forms.StatusStrip(); |
44 | 50 | this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); |
45 | - this.toolStripMenuSearchRace = new System.Windows.Forms.ToolStripMenuItem(); | |
46 | 51 | this.menuStrip1.SuspendLayout(); |
47 | 52 | ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); |
48 | 53 | this.splitContainer1.Panel1.SuspendLayout(); |
@@ -92,6 +97,12 @@ namespace UmaTest.App.Presentation.View | ||
92 | 97 | this.toolStripMenuOpenTokuRaceList.Size = new System.Drawing.Size(171, 22); |
93 | 98 | this.toolStripMenuOpenTokuRaceList.Text = "OpenTokuRaceList"; |
94 | 99 | // |
100 | + // toolStripMenuSearchRace | |
101 | + // | |
102 | + this.toolStripMenuSearchRace.Name = "toolStripMenuSearchRace"; | |
103 | + this.toolStripMenuSearchRace.Size = new System.Drawing.Size(171, 22); | |
104 | + this.toolStripMenuSearchRace.Text = "SearchRace"; | |
105 | + // | |
95 | 106 | // toolStripSeparator1 |
96 | 107 | // |
97 | 108 | this.toolStripSeparator1.Name = "toolStripSeparator1"; |
@@ -106,6 +117,7 @@ namespace UmaTest.App.Presentation.View | ||
106 | 117 | // splitContainer1 |
107 | 118 | // |
108 | 119 | this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; |
120 | + this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1; | |
109 | 121 | this.splitContainer1.Location = new System.Drawing.Point(0, 24); |
110 | 122 | this.splitContainer1.Name = "splitContainer1"; |
111 | 123 | // |
@@ -115,6 +127,7 @@ namespace UmaTest.App.Presentation.View | ||
115 | 127 | // |
116 | 128 | // splitContainer1.Panel2 |
117 | 129 | // |
130 | + this.splitContainer1.Panel2.BackColor = System.Drawing.SystemColors.AppWorkspace; | |
118 | 131 | this.splitContainer1.Panel2.Controls.Add(this.splitContainer2); |
119 | 132 | this.splitContainer1.Size = new System.Drawing.Size(862, 471); |
120 | 133 | this.splitContainer1.SplitterDistance = 92; |
@@ -131,6 +144,8 @@ namespace UmaTest.App.Presentation.View | ||
131 | 144 | // splitContainer2 |
132 | 145 | // |
133 | 146 | this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill; |
147 | + this.splitContainer2.FixedPanel = System.Windows.Forms.FixedPanel.Panel1; | |
148 | + this.splitContainer2.ForeColor = System.Drawing.SystemColors.ControlText; | |
134 | 149 | this.splitContainer2.Location = new System.Drawing.Point(0, 0); |
135 | 150 | this.splitContainer2.Name = "splitContainer2"; |
136 | 151 | this.splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal; |
@@ -143,7 +158,7 @@ namespace UmaTest.App.Presentation.View | ||
143 | 158 | // |
144 | 159 | this.splitContainer2.Panel2.Controls.Add(this.dataGridView2); |
145 | 160 | this.splitContainer2.Size = new System.Drawing.Size(766, 471); |
146 | - this.splitContainer2.SplitterDistance = 289; | |
161 | + this.splitContainer2.SplitterDistance = 350; | |
147 | 162 | this.splitContainer2.TabIndex = 0; |
148 | 163 | // |
149 | 164 | // dataGridView1 |
@@ -152,15 +167,27 @@ namespace UmaTest.App.Presentation.View | ||
152 | 167 | this.dataGridView1.AllowUserToDeleteRows = false; |
153 | 168 | this.dataGridView1.AllowUserToResizeRows = false; |
154 | 169 | this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.ColumnHeader; |
170 | + dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; | |
171 | + dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control; | |
172 | + dataGridViewCellStyle1.Font = new System.Drawing.Font("MS UI Gothic", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128))); | |
173 | + dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText; | |
174 | + dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; | |
175 | + dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText; | |
176 | + dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True; | |
177 | + this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1; | |
155 | 178 | this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; |
156 | 179 | this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill; |
157 | 180 | this.dataGridView1.Location = new System.Drawing.Point(0, 0); |
158 | 181 | this.dataGridView1.MultiSelect = false; |
159 | 182 | this.dataGridView1.Name = "dataGridView1"; |
160 | 183 | this.dataGridView1.ReadOnly = true; |
184 | + this.dataGridView1.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing; | |
185 | + dataGridViewCellStyle2.Font = new System.Drawing.Font("Meiryo UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128))); | |
186 | + this.dataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle2; | |
161 | 187 | this.dataGridView1.RowTemplate.Height = 21; |
188 | + this.dataGridView1.RowTemplate.ReadOnly = true; | |
162 | 189 | this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; |
163 | - this.dataGridView1.Size = new System.Drawing.Size(766, 289); | |
190 | + this.dataGridView1.Size = new System.Drawing.Size(766, 350); | |
164 | 191 | this.dataGridView1.TabIndex = 0; |
165 | 192 | // |
166 | 193 | // dataGridView2 |
@@ -169,15 +196,35 @@ namespace UmaTest.App.Presentation.View | ||
169 | 196 | this.dataGridView2.AllowUserToDeleteRows = false; |
170 | 197 | this.dataGridView2.AllowUserToResizeRows = false; |
171 | 198 | this.dataGridView2.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.ColumnHeader; |
199 | + dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; | |
200 | + dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Control; | |
201 | + dataGridViewCellStyle3.Font = new System.Drawing.Font("MS UI Gothic", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128))); | |
202 | + dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.WindowText; | |
203 | + dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight; | |
204 | + dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText; | |
205 | + dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True; | |
206 | + this.dataGridView2.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle3; | |
172 | 207 | this.dataGridView2.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; |
173 | 208 | this.dataGridView2.Dock = System.Windows.Forms.DockStyle.Fill; |
174 | 209 | this.dataGridView2.Location = new System.Drawing.Point(0, 0); |
175 | 210 | this.dataGridView2.MultiSelect = false; |
176 | 211 | this.dataGridView2.Name = "dataGridView2"; |
177 | 212 | this.dataGridView2.ReadOnly = true; |
213 | + dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; | |
214 | + dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Control; | |
215 | + dataGridViewCellStyle4.Font = new System.Drawing.Font("MS UI Gothic", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128))); | |
216 | + dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText; | |
217 | + dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight; | |
218 | + dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText; | |
219 | + dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.False; | |
220 | + this.dataGridView2.RowHeadersDefaultCellStyle = dataGridViewCellStyle4; | |
221 | + this.dataGridView2.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing; | |
222 | + dataGridViewCellStyle5.Font = new System.Drawing.Font("Meiryo UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128))); | |
223 | + this.dataGridView2.RowsDefaultCellStyle = dataGridViewCellStyle5; | |
178 | 224 | this.dataGridView2.RowTemplate.Height = 21; |
225 | + this.dataGridView2.RowTemplate.ReadOnly = true; | |
179 | 226 | this.dataGridView2.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; |
180 | - this.dataGridView2.Size = new System.Drawing.Size(766, 178); | |
227 | + this.dataGridView2.Size = new System.Drawing.Size(766, 117); | |
181 | 228 | this.dataGridView2.TabIndex = 0; |
182 | 229 | // |
183 | 230 | // statusStrip1 |
@@ -196,16 +243,11 @@ namespace UmaTest.App.Presentation.View | ||
196 | 243 | this.toolStripStatusLabel1.Size = new System.Drawing.Size(41, 17); |
197 | 244 | this.toolStripStatusLabel1.Text = "Ready."; |
198 | 245 | // |
199 | - // toolStripMenuSearchRace | |
200 | - // | |
201 | - this.toolStripMenuSearchRace.Name = "toolStripMenuSearchRace"; | |
202 | - this.toolStripMenuSearchRace.Size = new System.Drawing.Size(171, 22); | |
203 | - this.toolStripMenuSearchRace.Text = "SearchRace"; | |
204 | - // | |
205 | 246 | // MainWindow |
206 | 247 | // |
207 | 248 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); |
208 | 249 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; |
250 | + this.BackColor = System.Drawing.SystemColors.Window; | |
209 | 251 | this.ClientSize = new System.Drawing.Size(862, 517); |
210 | 252 | this.Controls.Add(this.splitContainer1); |
211 | 253 | this.Controls.Add(this.statusStrip1); |
@@ -24,7 +24,7 @@ namespace UmaTest.App.Presentation.View | ||
24 | 24 | { |
25 | 25 | public partial class MainWindow : Form |
26 | 26 | { |
27 | - private IMainWindowViewModel vm; | |
27 | + private readonly IMainWindowViewModel vm; | |
28 | 28 | |
29 | 29 | private BindingSource bindingSource1 = new BindingSource(); |
30 | 30 | private BindingSource bindingSource2 = new BindingSource(); |
@@ -33,17 +33,31 @@ namespace UmaTest.App.Presentation.View | ||
33 | 33 | { |
34 | 34 | InitializeComponent(); |
35 | 35 | |
36 | - // Subscribe VM PropertyChanged event | |
37 | - | |
38 | - vm.PropertyChanged += new PropertyChangedEventHandler(OnViewModelChanged); | |
39 | - | |
40 | 36 | // Initialize Child Window Onwer |
41 | 37 | |
42 | 38 | vm.ManualHorseListProxy.Owner = this; |
43 | 39 | vm.TokuRaceListProxy.Owner = this; |
44 | 40 | vm.SearchRaceViewProxy.Owner = this; |
45 | 41 | |
46 | - // Register UI EventHandler | |
42 | + // Subscribe VM events | |
43 | + | |
44 | + vm.PropertyChanged += new PropertyChangedEventHandler(OnViewModelChanged); | |
45 | + vm.UmaSummaryListChangingEvent += new EventHandler(OnUmaSummaryListChanging); | |
46 | + | |
47 | + // Bind VM | |
48 | + | |
49 | + Bind(vm, vmStatusBar, cm); | |
50 | + | |
51 | + // Initialize DataGridView | |
52 | + | |
53 | + InitializeDataGridView(vm); | |
54 | + | |
55 | + this.vm = vm; | |
56 | + } | |
57 | + | |
58 | + private void Bind(IMainWindowViewModel vm, IStatusBarViewModel vmStatusBar, ICommandManager cm) | |
59 | + { | |
60 | + // Bind UI EventHandler | |
47 | 61 | |
48 | 62 | this.dataGridView1.SelectionChanged += vm.EventSelectedHorseChanged; |
49 | 63 |
@@ -59,7 +73,10 @@ namespace UmaTest.App.Presentation.View | ||
59 | 73 | // Bind UI Text |
60 | 74 | // |
61 | 75 | DataContextHelper.BindText(this.toolStripStatusLabel1, vmStatusBar, "StatusText"); |
76 | + } | |
62 | 77 | |
78 | + private void InitializeDataGridView(IMainWindowViewModel vm) | |
79 | + { | |
63 | 80 | // |
64 | 81 | // Initialize DataGridView1 |
65 | 82 | // |
@@ -119,6 +136,21 @@ namespace UmaTest.App.Presentation.View | ||
119 | 136 | }, |
120 | 137 | new DataGridViewTextBoxColumn |
121 | 138 | { |
139 | + DataPropertyName = "BataijyuFormatted", | |
140 | + Name = "馬体重", | |
141 | + }, | |
142 | + new DataGridViewTextBoxColumn | |
143 | + { | |
144 | + DataPropertyName = "KonsoTanOdds", | |
145 | + Name = "オッズ", | |
146 | + }, | |
147 | + new DataGridViewTextBoxColumn | |
148 | + { | |
149 | + DataPropertyName = "KonsoNinki", | |
150 | + Name = "人気", | |
151 | + }, | |
152 | + new DataGridViewTextBoxColumn | |
153 | + { | |
122 | 154 | DataPropertyName = "Short.G1", |
123 | 155 | Name = "短G1", |
124 | 156 | }, |
@@ -295,6 +327,11 @@ namespace UmaTest.App.Presentation.View | ||
295 | 327 | DataPropertyName = "Time", |
296 | 328 | Name = "タイム", |
297 | 329 | }, |
330 | + new DataGridViewTextBoxColumn | |
331 | + { | |
332 | + DataPropertyName = "Kimete", | |
333 | + Name = "決手", | |
334 | + }, | |
298 | 335 | }; |
299 | 336 | |
300 | 337 | grid2Cols.Do(col => col.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter); |
@@ -322,21 +359,30 @@ namespace UmaTest.App.Presentation.View | ||
322 | 359 | // Enable Double Buffering for too slow repaint problem on data grid view |
323 | 360 | // |
324 | 361 | |
325 | - typeof(DataGridView).InvokeMember( | |
326 | - "DoubleBuffered", | |
327 | - BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetProperty, | |
328 | - null, | |
329 | - dataGridView1, | |
330 | - new object[] { true }); | |
362 | + EnableDoubleBuffering(dataGridView1); | |
363 | + EnableDoubleBuffering(dataGridView2); | |
364 | + } | |
331 | 365 | |
366 | + private static void EnableDoubleBuffering(DataGridView dataGridView) | |
367 | + { | |
332 | 368 | typeof(DataGridView).InvokeMember( |
333 | 369 | "DoubleBuffered", |
334 | 370 | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetProperty, |
335 | 371 | null, |
336 | - dataGridView2, | |
372 | + dataGridView, | |
337 | 373 | new object[] { true }); |
374 | + } | |
338 | 375 | |
339 | - this.vm = vm; | |
376 | + private void OnUmaSummaryListChanging(object sender, EventArgs e) | |
377 | + { | |
378 | + DisconnectDataSource(dataGridView1); | |
379 | + DisconnectDataSource(dataGridView2); | |
380 | + } | |
381 | + | |
382 | + private static void DisconnectDataSource(DataGridView dataGridView) | |
383 | + { | |
384 | + dataGridView.DataSource = null; | |
385 | + dataGridView.Invalidate(); | |
340 | 386 | } |
341 | 387 | |
342 | 388 | private void OnViewModelChanged(object sender, EventArgs e) |
@@ -346,26 +392,61 @@ namespace UmaTest.App.Presentation.View | ||
346 | 392 | switch (args.PropertyName) |
347 | 393 | { |
348 | 394 | case "UmaSummaryList": |
349 | - dataGridView1.SuspendLayout(); | |
350 | - dataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.None; | |
351 | - dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.None; | |
352 | - bindingSource1.DataSource = vm.UmaSummaryList; | |
353 | - dataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells; | |
354 | - dataGridView1.AutoSizeColumnsMode = vm.UmaSummaryList.Count > 0 | |
355 | - ? DataGridViewAutoSizeColumnsMode.AllCellsExceptHeader | |
356 | - : DataGridViewAutoSizeColumnsMode.AllCells; | |
357 | - dataGridView1.ResumeLayout(); | |
395 | + { | |
396 | + bindingSource1.DataSource = vm.UmaSummaryList; | |
397 | + AdjustDataGridView(dataGridView1, bindingSource1, vm.UmaSummaryList.Count, splitContainer2.Panel1); | |
398 | + | |
399 | + splitContainer2.FixedPanel = FixedPanel.None; | |
400 | + int newHeight = dataGridView1.ColumnHeadersHeight | |
401 | + + (dataGridView1.Rows.Count > 0 ? dataGridView1.Rows.Count * dataGridView1.Rows[0].Height : 0) | |
402 | + + SystemInformation.HorizontalScrollBarHeight | |
403 | + + 2; | |
404 | + splitContainer2.SplitterDistance = (newHeight > 100 ? newHeight : 100) + 2; | |
405 | + splitContainer2.FixedPanel = FixedPanel.Panel1; | |
406 | + } | |
358 | 407 | break; |
408 | + | |
359 | 409 | case "RaceList": |
360 | - dataGridView2.SuspendLayout(); | |
361 | - //dataGridView2.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.None; | |
362 | - dataGridView2.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.None; | |
363 | - bindingSource2.DataSource = vm.RaceList; | |
364 | - //dataGridView2.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells; | |
365 | - dataGridView2.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; | |
366 | - dataGridView2.ResumeLayout(); | |
410 | + { | |
411 | + bindingSource2.DataSource = vm.RaceList; | |
412 | + AdjustDataGridView(dataGridView2, bindingSource2, vm.RaceList.Count, splitContainer2.Panel2); | |
413 | + } | |
367 | 414 | break; |
368 | 415 | } |
369 | 416 | } |
417 | + | |
418 | + private void AdjustDataGridView(DataGridView dataGridView, BindingSource bindingSource, int dataSourceCount, Panel panel) | |
419 | + { | |
420 | + Size size = dataGridView.Size; | |
421 | + | |
422 | + dataGridView.SuspendLayout(); | |
423 | + | |
424 | + dataGridView.ScrollBars = ScrollBars.None; | |
425 | + panel.BackColor = SystemColors.ControlText; | |
426 | + | |
427 | + size.Height = size.Height - 1; | |
428 | + dataGridView.Size = size; | |
429 | + | |
430 | + dataGridView.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.None; | |
431 | + dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.None; | |
432 | + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing; | |
433 | + dataGridView.DataSource = bindingSource; | |
434 | + | |
435 | + dataGridView.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells; | |
436 | + dataGridView.AutoSizeColumnsMode = dataSourceCount > 0 | |
437 | + ? DataGridViewAutoSizeColumnsMode.AllCellsExceptHeader | |
438 | + : DataGridViewAutoSizeColumnsMode.AllCells; | |
439 | + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; | |
440 | + | |
441 | + size.Height = size.Height + 1; | |
442 | + dataGridView.Size = size; | |
443 | + | |
444 | + dataGridView.ScrollBars = ScrollBars.Both; | |
445 | + panel.BackColor = SystemColors.AppWorkspace; | |
446 | + | |
447 | + dataGridView.ClearSelection(); | |
448 | + | |
449 | + dataGridView.ResumeLayout(); | |
450 | + } | |
370 | 451 | } |
371 | 452 | } |
@@ -65,6 +65,7 @@ namespace UmaTest.App.Presentation.View | ||
65 | 65 | // txtHorseList |
66 | 66 | // |
67 | 67 | this.txtHorseList.Dock = System.Windows.Forms.DockStyle.Fill; |
68 | + this.txtHorseList.Font = new System.Drawing.Font("Meiryo UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128))); | |
68 | 69 | this.txtHorseList.Location = new System.Drawing.Point(0, 0); |
69 | 70 | this.txtHorseList.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); |
70 | 71 | this.txtHorseList.Multiline = true; |
@@ -29,6 +29,8 @@ namespace UmaTest.App.Presentation.View | ||
29 | 29 | /// </summary> |
30 | 30 | private void InitializeComponent() |
31 | 31 | { |
32 | + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); | |
33 | + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); | |
32 | 34 | this.splitContainer1 = new System.Windows.Forms.SplitContainer(); |
33 | 35 | this.dataGridView1 = new System.Windows.Forms.DataGridView(); |
34 | 36 | this.btnSearch = new System.Windows.Forms.Button(); |
@@ -59,8 +61,8 @@ namespace UmaTest.App.Presentation.View | ||
59 | 61 | this.splitContainer1.Panel2.Controls.Add(this.btnSearch); |
60 | 62 | this.splitContainer1.Panel2.Controls.Add(this.btnCancel); |
61 | 63 | this.splitContainer1.Panel2.Controls.Add(this.btnSelect); |
62 | - this.splitContainer1.Size = new System.Drawing.Size(552, 563); | |
63 | - this.splitContainer1.SplitterDistance = 500; | |
64 | + this.splitContainer1.Size = new System.Drawing.Size(695, 584); | |
65 | + this.splitContainer1.SplitterDistance = 521; | |
64 | 66 | this.splitContainer1.TabIndex = 0; |
65 | 67 | // |
66 | 68 | // dataGridView1 |
@@ -68,21 +70,39 @@ namespace UmaTest.App.Presentation.View | ||
68 | 70 | this.dataGridView1.AllowUserToAddRows = false; |
69 | 71 | this.dataGridView1.AllowUserToDeleteRows = false; |
70 | 72 | this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.ColumnHeader; |
73 | + dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; | |
74 | + dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control; | |
75 | + dataGridViewCellStyle1.Font = new System.Drawing.Font("MS UI Gothic", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128))); | |
76 | + dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText; | |
77 | + dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; | |
78 | + dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText; | |
79 | + dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True; | |
80 | + this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1; | |
71 | 81 | this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; |
82 | + dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; | |
83 | + dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Window; | |
84 | + dataGridViewCellStyle2.Font = new System.Drawing.Font("Meiryo UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128))); | |
85 | + dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.ControlText; | |
86 | + dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight; | |
87 | + dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText; | |
88 | + dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False; | |
89 | + this.dataGridView1.DefaultCellStyle = dataGridViewCellStyle2; | |
72 | 90 | this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill; |
73 | 91 | this.dataGridView1.Location = new System.Drawing.Point(0, 0); |
74 | 92 | this.dataGridView1.MultiSelect = false; |
75 | 93 | this.dataGridView1.Name = "dataGridView1"; |
94 | + this.dataGridView1.ReadOnly = true; | |
76 | 95 | this.dataGridView1.RowTemplate.Height = 21; |
96 | + this.dataGridView1.RowTemplate.ReadOnly = true; | |
77 | 97 | this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; |
78 | - this.dataGridView1.Size = new System.Drawing.Size(552, 500); | |
98 | + this.dataGridView1.Size = new System.Drawing.Size(695, 521); | |
79 | 99 | this.dataGridView1.TabIndex = 0; |
80 | 100 | // |
81 | 101 | // btnSearch |
82 | 102 | // |
83 | 103 | this.btnSearch.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); |
84 | 104 | this.btnSearch.DialogResult = System.Windows.Forms.DialogResult.Cancel; |
85 | - this.btnSearch.Location = new System.Drawing.Point(474, 3); | |
105 | + this.btnSearch.Location = new System.Drawing.Point(617, 3); | |
86 | 106 | this.btnSearch.Name = "btnSearch"; |
87 | 107 | this.btnSearch.Size = new System.Drawing.Size(75, 24); |
88 | 108 | this.btnSearch.TabIndex = 2; |
@@ -93,7 +113,7 @@ namespace UmaTest.App.Presentation.View | ||
93 | 113 | // |
94 | 114 | this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); |
95 | 115 | this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; |
96 | - this.btnCancel.Location = new System.Drawing.Point(394, 32); | |
116 | + this.btnCancel.Location = new System.Drawing.Point(537, 32); | |
97 | 117 | this.btnCancel.Name = "btnCancel"; |
98 | 118 | this.btnCancel.Size = new System.Drawing.Size(74, 25); |
99 | 119 | this.btnCancel.TabIndex = 1; |
@@ -104,7 +124,7 @@ namespace UmaTest.App.Presentation.View | ||
104 | 124 | // |
105 | 125 | this.btnSelect.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); |
106 | 126 | this.btnSelect.DialogResult = System.Windows.Forms.DialogResult.Cancel; |
107 | - this.btnSelect.Location = new System.Drawing.Point(474, 33); | |
127 | + this.btnSelect.Location = new System.Drawing.Point(617, 33); | |
108 | 128 | this.btnSelect.Name = "btnSelect"; |
109 | 129 | this.btnSelect.Size = new System.Drawing.Size(75, 24); |
110 | 130 | this.btnSelect.TabIndex = 0; |
@@ -117,7 +137,7 @@ namespace UmaTest.App.Presentation.View | ||
117 | 137 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); |
118 | 138 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; |
119 | 139 | this.CancelButton = this.btnCancel; |
120 | - this.ClientSize = new System.Drawing.Size(552, 563); | |
140 | + this.ClientSize = new System.Drawing.Size(695, 584); | |
121 | 141 | this.ControlBox = false; |
122 | 142 | this.Controls.Add(this.splitContainer1); |
123 | 143 | this.MaximizeBox = false; |
@@ -29,6 +29,8 @@ namespace UmaTest.App.Presentation.View | ||
29 | 29 | /// </summary> |
30 | 30 | private void InitializeComponent() |
31 | 31 | { |
32 | + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); | |
33 | + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); | |
32 | 34 | this.splitContainer1 = new System.Windows.Forms.SplitContainer(); |
33 | 35 | this.dataGridView1 = new System.Windows.Forms.DataGridView(); |
34 | 36 | this.btnCancel = new System.Windows.Forms.Button(); |
@@ -66,7 +68,23 @@ namespace UmaTest.App.Presentation.View | ||
66 | 68 | this.dataGridView1.AllowUserToAddRows = false; |
67 | 69 | this.dataGridView1.AllowUserToDeleteRows = false; |
68 | 70 | this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.ColumnHeader; |
71 | + dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; | |
72 | + dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control; | |
73 | + dataGridViewCellStyle1.Font = new System.Drawing.Font("MS UI Gothic", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128))); | |
74 | + dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText; | |
75 | + dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; | |
76 | + dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText; | |
77 | + dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True; | |
78 | + this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1; | |
69 | 79 | this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; |
80 | + dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; | |
81 | + dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Window; | |
82 | + dataGridViewCellStyle2.Font = new System.Drawing.Font("Meiryo UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128))); | |
83 | + dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.ControlText; | |
84 | + dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight; | |
85 | + dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText; | |
86 | + dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False; | |
87 | + this.dataGridView1.DefaultCellStyle = dataGridViewCellStyle2; | |
70 | 88 | this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill; |
71 | 89 | this.dataGridView1.Location = new System.Drawing.Point(0, 0); |
72 | 90 | this.dataGridView1.MultiSelect = false; |
@@ -0,0 +1,29 @@ | ||
1 | +using System; | |
2 | +using System.Collections.Generic; | |
3 | + | |
4 | +namespace UmaTest.Infra.Adaptor.Controller | |
5 | +{ | |
6 | + public class EventObserver | |
7 | + { | |
8 | + List<EventHandler> delegates = new List<EventHandler>(); | |
9 | + | |
10 | + public static EventObserver operator +(EventObserver o, EventHandler a) | |
11 | + { | |
12 | + o.delegates.Add(a); | |
13 | + | |
14 | + return o; | |
15 | + } | |
16 | + | |
17 | + public static EventObserver operator -(EventObserver o, EventHandler a) | |
18 | + { | |
19 | + o.delegates.RemoveAll(e => e == a); | |
20 | + | |
21 | + return o; | |
22 | + } | |
23 | + | |
24 | + public void Raise(object sender, EventArgs e) | |
25 | + { | |
26 | + delegates.ForEach(a => a.Invoke(sender, e)); | |
27 | + } | |
28 | + } | |
29 | +} | |
\ No newline at end of file |
@@ -10,9 +10,7 @@ namespace UmaTest.Infra.Adaptor.Controller | ||
10 | 10 | public interface IWindowController |
11 | 11 | { |
12 | 12 | Dictionary<string, ICommand> Commands { get; } |
13 | - Dictionary<string, EventHandler> Events { get; } | |
14 | - Dictionary<string, MouseEventHandler> MouseEvents { get; } | |
15 | - | |
13 | + Dictionary<string, EventObserver> Events { get; } | |
16 | 14 | UseCaseResponse Execute(UseCaseRequest req); |
17 | 15 | |
18 | 16 | Task<UseCaseResponse> ExecuteAsync(UseCaseRequest req); |
@@ -14,8 +14,11 @@ 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 | + | |
17 | 18 | public static readonly string SEX_CODE = "2202"; |
18 | 19 | |
20 | + public static readonly string KYAKUSITU_KUBUN = "9201"; | |
21 | + | |
19 | 22 | private const string ERROR_VALUE = "#ERROR"; |
20 | 23 | |
21 | 24 | private static CodeHelper me = null; |
@@ -136,6 +139,14 @@ namespace UmaTest.Infra.Helper | ||
136 | 139 | |
137 | 140 | Logger.Debug($"CodeMaster [code={code}, value={value}, {String.Join(", ", names)}]"); |
138 | 141 | } |
142 | + | |
143 | + var kyakusituKbn = new Dictionary<string, string[]>(); | |
144 | + master.Add(KYAKUSITU_KUBUN, kyakusituKbn); | |
145 | + kyakusituKbn.Add("0", new string[] { "-" }); | |
146 | + kyakusituKbn.Add("1", new string[] { "逃げ" }); | |
147 | + kyakusituKbn.Add("2", new string[] { "先行" }); | |
148 | + kyakusituKbn.Add("3", new string[] { "差し" }); | |
149 | + kyakusituKbn.Add("4", new string[] { "追込" }); | |
139 | 150 | } |
140 | 151 | } |
141 | 152 | } |
@@ -102,6 +102,7 @@ | ||
102 | 102 | <Reference Include="System.Xml" /> |
103 | 103 | </ItemGroup> |
104 | 104 | <ItemGroup> |
105 | + <Compile Include="Infra\Adaptor\Controller\EventObserver.cs" /> | |
105 | 106 | <Compile Include="App\Adaptor\Gateway\UI\IManualHorseListProxy.cs" /> |
106 | 107 | <Compile Include="App\Adaptor\Gateway\UI\ISearchRaceViewProxy.cs" /> |
107 | 108 | <Compile Include="App\Adaptor\Gateway\UI\SearchRaceViewProxy.cs" /> |