EveryDB2のデータベースを読み込んでWinFormでGUI表示するサンプル
Revisão | e87fe26795e0e5dafde145d880c0f5f6305ef7a4 (tree) |
---|---|
Hora | 2021-05-29 04:12:20 |
Autor | yoshy <yoshy@user...> |
Commiter | yoshy |
temp_20210529_0412
@@ -0,0 +1,10 @@ | ||
1 | +using UmaTest.App.Adaptor.Gateway.ViewModel; | |
2 | +using UmaTest.Infra.Gateway.UI; | |
3 | + | |
4 | +namespace UmaTest.App.Adaptor.Gateway.UI | |
5 | +{ | |
6 | + public interface ITokuRaceListProxy : IShowChildWindowProxy<ITokuRaceListViewModel> | |
7 | + { | |
8 | + void ShowChildWindow(); | |
9 | + } | |
10 | +} | |
\ No newline at end of file |
@@ -0,0 +1,23 @@ | ||
1 | +using System.Windows.Forms; | |
2 | +using UmaTest.App.Adaptor.Gateway.ViewModel; | |
3 | +using UmaTest.App.Presentation.View; | |
4 | +using UmaTest.Infra.Gateway.UI; | |
5 | + | |
6 | +namespace UmaTest.App.Adaptor.Gateway.UI | |
7 | +{ | |
8 | + internal class TokuRaceListProxy | |
9 | + : ShowChildWindowProxy<TokuRaceListView, ITokuRaceListViewModel>, ITokuRaceListProxy | |
10 | + { | |
11 | + private readonly ITokuRaceListViewModel vm; | |
12 | + | |
13 | + public TokuRaceListProxy(TokuRaceListView window, ITokuRaceListViewModel vm) : base(window) | |
14 | + { | |
15 | + this.vm = vm; | |
16 | + } | |
17 | + | |
18 | + public void ShowChildWindow() | |
19 | + { | |
20 | + ShowChildWindow(this.vm); | |
21 | + } | |
22 | + } | |
23 | +} | |
\ No newline at end of file |
@@ -0,0 +1,31 @@ | ||
1 | +using System; | |
2 | +using System.Collections.Generic; | |
3 | +using System.Linq; | |
4 | +using System.Text; | |
5 | +using System.Threading.Tasks; | |
6 | +using UmaTest.App.Domain.Model.Repository.Database.Dto; | |
7 | +using UmaTest.App.Domain.Model.Repository.Database.Entity.EveryDB2; | |
8 | +using UmaTest.Infra.Helper; | |
9 | + | |
10 | +namespace UmaTest.App.Adaptor.Gateway.ViewModel.Dto | |
11 | +{ | |
12 | + public class TokuRaceRowDto : NTokuRace | |
13 | + { | |
14 | + public TokuRaceRowDto() | |
15 | + { | |
16 | + } | |
17 | + | |
18 | + public TokuRaceRowDto(NTokuRace race) | |
19 | + { | |
20 | + BeanHelper.Copy(this, race); | |
21 | + } | |
22 | + | |
23 | + public string YearMonthDay { get => Year + "/" + Monthday.Substring(0, 2) + "/" + Monthday.Substring(2, 2); } | |
24 | + | |
25 | + public string RaceName => !String.IsNullOrEmpty(Hondai) | |
26 | + ? Hondai | |
27 | + : CodeHelper.GetInstance().GetName(CodeHelper.JYOKEN_CODE1, Jyokencd1, "不明"); | |
28 | + | |
29 | + public string GradeName => CodeHelper.GetInstance().GetName(CodeHelper.GRADE_CODE, Gradecd, "-"); | |
30 | + } | |
31 | +} |
@@ -4,18 +4,21 @@ 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.ViewModel; | |
8 | 7 | |
9 | 8 | namespace UmaTest.App.Adaptor.Gateway.ViewModel |
10 | 9 | { |
11 | - public interface IMainWindowViewModel : INotifyPropertyChanged | |
10 | + public interface IMainWindowViewModel | |
12 | 11 | { |
13 | - ICommand CommandReadHorseList { get; } | |
12 | + ICommand CommandOpenHorseList { get; } | |
13 | + ICommand CommandOpenTokuRaceList { get; } | |
14 | 14 | EventHandler EventSelectedHorseChanged { get; } |
15 | 15 | IManualHorseListProxy ManualHorseListProxy { get; } |
16 | 16 | BindingList<UmaRaceRowDto> RaceList { get; set; } |
17 | + ITokuRaceListProxy TokuRaceListProxy { get; } | |
17 | 18 | BindingList<UmaSummaryRowDto> UmaSummaryList { get; set; } |
18 | 19 | |
20 | + event PropertyChangedEventHandler PropertyChanged; | |
21 | + | |
19 | 22 | void RefreshModel(List<UmaSummaryRowDto> umaSummaryList, Dictionary<string, List<UmaRaceRowDto>> umaRaceMap); |
20 | 23 | } |
21 | 24 | } |
\ No newline at end of file |
@@ -0,0 +1,18 @@ | ||
1 | +using System; | |
2 | +using System.ComponentModel; | |
3 | +using UmaTest.App.Adaptor.Gateway.ViewModel.Dto; | |
4 | +using UmaTest.Infra.Adaptor.Command; | |
5 | + | |
6 | +namespace UmaTest.App.Adaptor.Gateway.ViewModel | |
7 | +{ | |
8 | + public interface ITokuRaceListViewModel | |
9 | + { | |
10 | + ICommand CommandExecuteReadTokuUmaRaceList { get; } | |
11 | + ICommand CommandInitReadTokuRaceList { get; } | |
12 | + EventHandler EventSelectedRaceChanged { get; } | |
13 | + int SelectedIndex { get; } | |
14 | + BindingList<TokuRaceRowDto> TokuRaceList { get; set; } | |
15 | + | |
16 | + event PropertyChangedEventHandler PropertyChanged; | |
17 | + } | |
18 | +} | |
\ No newline at end of file |
@@ -25,20 +25,28 @@ namespace UmaTest.App.Adaptor.Gateway.ViewModel | ||
25 | 25 | |
26 | 26 | public EventHandler EventSelectedHorseChanged { get; private set; } |
27 | 27 | |
28 | - public ICommand CommandReadHorseList { get; private set; } | |
28 | + public ICommand CommandOpenHorseList { get; private set; } | |
29 | + | |
30 | + public ICommand CommandOpenTokuRaceList { get; private set; } | |
29 | 31 | |
30 | 32 | public IManualHorseListProxy ManualHorseListProxy { get; private set; } |
31 | 33 | |
34 | + public ITokuRaceListProxy TokuRaceListProxy { get; private set; } | |
35 | + | |
32 | 36 | private IWindowController wc; |
33 | 37 | |
34 | 38 | private Dictionary<string, List<UmaRaceRowDto>> _umaRaceMap = null; |
35 | 39 | |
36 | - public MainWindowViewModel(IWindowController wc, IManualHorseListProxy horseListProxy) | |
40 | + public MainWindowViewModel(IWindowController wc | |
41 | + , IManualHorseListProxy horseListProxy | |
42 | + , ITokuRaceListProxy tokuRaceListProxy) | |
37 | 43 | { |
38 | 44 | this.wc = wc; |
39 | 45 | this.ManualHorseListProxy = horseListProxy; |
46 | + this.TokuRaceListProxy = tokuRaceListProxy; | |
40 | 47 | |
41 | - CommandReadHorseList = new DelegateCommand("Read Horse List (&R)", () => true, OnReadHorseList); | |
48 | + CommandOpenHorseList = new DelegateCommand("Read Horse List (&H)", () => true, OnOpenHorseList); | |
49 | + CommandOpenTokuRaceList = new DelegateCommand("Open Toku Race List (&T)", () => true, OnOpenTokuRaceList); | |
42 | 50 | EventSelectedHorseChanged = new EventHandler(OnSelectedHorseChanged); |
43 | 51 | } |
44 | 52 |
@@ -69,11 +77,16 @@ namespace UmaTest.App.Adaptor.Gateway.ViewModel | ||
69 | 77 | ChangeRaceList(0); |
70 | 78 | } |
71 | 79 | } |
72 | - private void OnReadHorseList() | |
80 | + private void OnOpenHorseList() | |
73 | 81 | { |
74 | 82 | ManualHorseListProxy.ShowChildWindow(); |
75 | 83 | } |
76 | 84 | |
85 | + private void OnOpenTokuRaceList() | |
86 | + { | |
87 | + TokuRaceListProxy.ShowChildWindow(); | |
88 | + } | |
89 | + | |
77 | 90 | private void OnSelectedHorseChanged(object sender, EventArgs e) |
78 | 91 | { |
79 | 92 | DataGridView dgv = sender as DataGridView; |
@@ -0,0 +1,93 @@ | ||
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 System.Windows.Forms; | |
8 | +using System.Windows.Input; | |
9 | +using UmaTest.App.Adaptor.Controller; | |
10 | +using UmaTest.App.Adaptor.Gateway.ViewModel.Dto; | |
11 | +using UmaTest.App.Domain.Model.Repository.Database.Entity.EveryDB2; | |
12 | +using UmaTest.App.Domain.UseCase.Request; | |
13 | +using UmaTest.App.Domain.UseCase.Response; | |
14 | +using UmaTest.Infra.Adaptor.Command; | |
15 | +using UmaTest.Infra.Adaptor.Controller; | |
16 | +using UmaTest.Infra.Log; | |
17 | +using ICommand = UmaTest.Infra.Adaptor.Command.ICommand; | |
18 | + | |
19 | +namespace UmaTest.App.Adaptor.Gateway.ViewModel | |
20 | +{ | |
21 | + public class TokuRaceListViewModel : ITokuRaceListViewModel | |
22 | + { | |
23 | + public event PropertyChangedEventHandler PropertyChanged; | |
24 | + | |
25 | + public EventHandler EventSelectedRaceChanged { get; private set; } | |
26 | + | |
27 | + public ICommand CommandInitReadTokuRaceList { get; private set; } | |
28 | + | |
29 | + public ICommand CommandExecuteReadTokuUmaRaceList { get; private set; } | |
30 | + | |
31 | + private IWindowController wc; | |
32 | + | |
33 | + public TokuRaceListViewModel(IWindowController wc) | |
34 | + { | |
35 | + this.wc = wc; | |
36 | + | |
37 | + this.CommandInitReadTokuRaceList = new DelegateCommand( | |
38 | + "Init", () => true, OnInitReadTokuRaceList); | |
39 | + | |
40 | + this.CommandExecuteReadTokuUmaRaceList = new DelegateCommand( | |
41 | + "Select", () => SelectedIndex != -1, OnExecuteReadTokuUmaRaceList); | |
42 | + | |
43 | + EventSelectedRaceChanged = new EventHandler(OnSelectedRaceChanged); | |
44 | + } | |
45 | + | |
46 | + private async void OnInitReadTokuRaceList() | |
47 | + { | |
48 | + AsyncLoadTokuRaceListRequest req = new AsyncLoadTokuRaceListRequest(); | |
49 | + Logger.Debug($"OnInitReadTokuRaceList"); | |
50 | + await wc.ExecuteAsync(req); | |
51 | + } | |
52 | + | |
53 | + private async void OnExecuteReadTokuUmaRaceList() | |
54 | + { | |
55 | + if (SelectedIndex == -1) | |
56 | + { | |
57 | + return; | |
58 | + } | |
59 | + | |
60 | + AsyncLoadTokuUmaRaceListRequest req = new AsyncLoadTokuUmaRaceListRequest(TokuRaceList[SelectedIndex]); | |
61 | + Logger.Debug($"OnExecuteReadTokuUmaRaceList: {SelectedIndex}"); | |
62 | + await wc.ExecuteAsync(req); | |
63 | + } | |
64 | + | |
65 | + private BindingList<TokuRaceRowDto> _tokuRaceList; | |
66 | + | |
67 | + public BindingList<TokuRaceRowDto> TokuRaceList | |
68 | + { | |
69 | + get => _tokuRaceList; | |
70 | + set => PropertyChanged.RaiseIfSet(() => TokuRaceList, ref _tokuRaceList, value); | |
71 | + } | |
72 | + | |
73 | + public int SelectedIndex { get; private set; } = -1; | |
74 | + | |
75 | + private void OnSelectedRaceChanged(object sender, EventArgs e) | |
76 | + { | |
77 | + DataGridView dgv = sender as DataGridView; | |
78 | + | |
79 | + var selected = dgv.SelectedRows; | |
80 | + | |
81 | + if (selected.Count == 0) | |
82 | + { | |
83 | + Logger.Debug($"OnSelectedRaceChanged: count - {selected.Count}"); | |
84 | + return; | |
85 | + } | |
86 | + | |
87 | + Logger.Debug($"OnSelectedRaceChanged: index - {selected[0].Index}"); | |
88 | + | |
89 | + SelectedIndex = selected[0].Index; | |
90 | + } | |
91 | + | |
92 | + } | |
93 | +} |
@@ -59,6 +59,9 @@ namespace UmaTest.App.DI | ||
59 | 59 | di.RegisterSingleton<ManualHorseListView>(); |
60 | 60 | di.RegisterSingleton<IManualHorseListViewModel, ManualHorseListViewModel>(); |
61 | 61 | |
62 | + di.RegisterSingleton<TokuRaceListView>(); | |
63 | + di.RegisterSingleton<ITokuRaceListViewModel, TokuRaceListViewModel>(); | |
64 | + | |
62 | 65 | /// |
63 | 66 | /// UI Proxy |
64 | 67 | /// |
@@ -66,6 +69,7 @@ namespace UmaTest.App.DI | ||
66 | 69 | di.RegisterSingleton<IUserDialogProxy, UserDialogProxy>(); |
67 | 70 | di.RegisterSingleton<IStatusBarProxy, StatusBarProxy>(); |
68 | 71 | di.RegisterSingleton<IManualHorseListProxy, ManualHorseListProxy>(); |
72 | + di.RegisterSingleton<ITokuRaceListProxy, TokuRaceListProxy>(); | |
69 | 73 | |
70 | 74 | /// |
71 | 75 | /// Interactors |
@@ -0,0 +1,22 @@ | ||
1 | +using System; | |
2 | +using System.Collections.Generic; | |
3 | +using System.Linq; | |
4 | +using System.Text; | |
5 | +using System.Threading.Tasks; | |
6 | +using UmaTest.App.Domain.UseCase.Response; | |
7 | +using UmaTest.Infra.Domain.UseCase; | |
8 | + | |
9 | +namespace UmaTest.App.Domain.UseCase.Request | |
10 | +{ | |
11 | + public class AsyncLoadTokuRaceListRequest : UseCaseRequest | |
12 | + { | |
13 | + public AsyncLoadTokuRaceListRequest() | |
14 | + { | |
15 | + } | |
16 | + | |
17 | + protected override UseCaseResponse CreateResponse() | |
18 | + { | |
19 | + return new AsyncLoadTokuRaceListResponse(this); | |
20 | + } | |
21 | + } | |
22 | +} |
@@ -0,0 +1,28 @@ | ||
1 | +using System; | |
2 | +using System.Collections.Generic; | |
3 | +using System.Linq; | |
4 | +using System.Text; | |
5 | +using System.Threading.Tasks; | |
6 | +using UmaTest.App.Adaptor.Gateway.ViewModel.Dto; | |
7 | +using UmaTest.App.Domain.Model.Repository.Database.Entity.EveryDB2; | |
8 | +using UmaTest.App.Domain.UseCase.Response; | |
9 | +using UmaTest.Infra.Domain.UseCase; | |
10 | + | |
11 | +namespace UmaTest.App.Domain.UseCase.Request | |
12 | +{ | |
13 | + public class AsyncLoadTokuUmaRaceListRequest : UseCaseRequest | |
14 | + { | |
15 | + public AsyncLoadTokuUmaRaceListRequest(NTokuRace race) | |
16 | + { | |
17 | + Race = race; | |
18 | + } | |
19 | + | |
20 | + public NTokuRace Race { get; private set; } | |
21 | + | |
22 | + | |
23 | + protected override UseCaseResponse CreateResponse() | |
24 | + { | |
25 | + return new AsyncLoadTokuUmaRaceListResponse(this); | |
26 | + } | |
27 | + } | |
28 | +} |
@@ -0,0 +1,21 @@ | ||
1 | +using System; | |
2 | +using System.Collections.Generic; | |
3 | +using System.Linq; | |
4 | +using System.Text; | |
5 | +using System.Threading.Tasks; | |
6 | +using UmaTest.App.Domain.Model.Repository.Database.Dto; | |
7 | +using UmaTest.App.Domain.Model.Repository.Database.Entity.EveryDB2; | |
8 | +using UmaTest.App.Domain.UseCase.Request; | |
9 | +using UmaTest.Infra.Domain.UseCase; | |
10 | + | |
11 | +namespace UmaTest.App.Domain.UseCase.Response | |
12 | +{ | |
13 | + public class AsyncLoadTokuRaceListResponse : UseCaseResponse | |
14 | + { | |
15 | + public AsyncLoadTokuRaceListResponse(AsyncLoadTokuRaceListRequest req) : base(req) | |
16 | + { | |
17 | + } | |
18 | + | |
19 | + public IEnumerable<NTokuRace> Races { get; set; } | |
20 | + } | |
21 | +} |
@@ -0,0 +1,21 @@ | ||
1 | +using System; | |
2 | +using System.Collections.Generic; | |
3 | +using System.Linq; | |
4 | +using System.Text; | |
5 | +using System.Threading.Tasks; | |
6 | +using UmaTest.App.Domain.Model.Repository.Database.Dto; | |
7 | +using UmaTest.App.Domain.Model.Repository.Database.Entity.EveryDB2; | |
8 | +using UmaTest.App.Domain.UseCase.Request; | |
9 | +using UmaTest.Infra.Domain.UseCase; | |
10 | + | |
11 | +namespace UmaTest.App.Domain.UseCase.Response | |
12 | +{ | |
13 | + public class AsyncLoadTokuUmaRaceListResponse : UseCaseResponse | |
14 | + { | |
15 | + public AsyncLoadTokuUmaRaceListResponse(AsyncLoadTokuUmaRaceListRequest req) : base(req) | |
16 | + { | |
17 | + } | |
18 | + | |
19 | + public IEnumerable<NTokuRace> Races { get; set; } | |
20 | + } | |
21 | +} |
@@ -41,6 +41,7 @@ namespace UmaTest.App.Presentation.View | ||
41 | 41 | this.dataGridView2 = new System.Windows.Forms.DataGridView(); |
42 | 42 | this.statusStrip1 = new System.Windows.Forms.StatusStrip(); |
43 | 43 | this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); |
44 | + this.toolStripMenuOpenTokuRaceList = new System.Windows.Forms.ToolStripMenuItem(); | |
44 | 45 | this.menuStrip1.SuspendLayout(); |
45 | 46 | ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); |
46 | 47 | this.splitContainer1.Panel1.SuspendLayout(); |
@@ -70,6 +71,7 @@ namespace UmaTest.App.Presentation.View | ||
70 | 71 | // |
71 | 72 | this.toolStripMenuFile.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { |
72 | 73 | this.toolStripMenuOpenHorseList, |
74 | + this.toolStripMenuOpenTokuRaceList, | |
73 | 75 | this.toolStripSeparator1, |
74 | 76 | this.toolStripMenuQuit}); |
75 | 77 | this.toolStripMenuFile.Name = "toolStripMenuFile"; |
@@ -79,18 +81,18 @@ namespace UmaTest.App.Presentation.View | ||
79 | 81 | // toolStripMenuOpenHorseList |
80 | 82 | // |
81 | 83 | this.toolStripMenuOpenHorseList.Name = "toolStripMenuOpenHorseList"; |
82 | - this.toolStripMenuOpenHorseList.Size = new System.Drawing.Size(152, 22); | |
84 | + this.toolStripMenuOpenHorseList.Size = new System.Drawing.Size(180, 22); | |
83 | 85 | this.toolStripMenuOpenHorseList.Text = "OpenHorseList"; |
84 | 86 | // |
85 | 87 | // toolStripSeparator1 |
86 | 88 | // |
87 | 89 | this.toolStripSeparator1.Name = "toolStripSeparator1"; |
88 | - this.toolStripSeparator1.Size = new System.Drawing.Size(149, 6); | |
90 | + this.toolStripSeparator1.Size = new System.Drawing.Size(177, 6); | |
89 | 91 | // |
90 | 92 | // toolStripMenuQuit |
91 | 93 | // |
92 | 94 | this.toolStripMenuQuit.Name = "toolStripMenuQuit"; |
93 | - this.toolStripMenuQuit.Size = new System.Drawing.Size(152, 22); | |
95 | + this.toolStripMenuQuit.Size = new System.Drawing.Size(180, 22); | |
94 | 96 | this.toolStripMenuQuit.Text = "Quit"; |
95 | 97 | // |
96 | 98 | // splitContainer1 |
@@ -186,6 +188,12 @@ namespace UmaTest.App.Presentation.View | ||
186 | 188 | this.toolStripStatusLabel1.Size = new System.Drawing.Size(41, 17); |
187 | 189 | this.toolStripStatusLabel1.Text = "Ready."; |
188 | 190 | // |
191 | + // toolStripMenuopenTokuRaceList | |
192 | + // | |
193 | + this.toolStripMenuOpenTokuRaceList.Name = "toolStripMenuopenTokuRaceList"; | |
194 | + this.toolStripMenuOpenTokuRaceList.Size = new System.Drawing.Size(180, 22); | |
195 | + this.toolStripMenuOpenTokuRaceList.Text = "OpenTokuRaceList"; | |
196 | + // | |
189 | 197 | // MainWindow |
190 | 198 | // |
191 | 199 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); |
@@ -231,6 +239,7 @@ namespace UmaTest.App.Presentation.View | ||
231 | 239 | private System.Windows.Forms.DataGridView dataGridView2; |
232 | 240 | private System.Windows.Forms.StatusStrip statusStrip1; |
233 | 241 | private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1; |
242 | + private System.Windows.Forms.ToolStripMenuItem toolStripMenuOpenTokuRaceList; | |
234 | 243 | } |
235 | 244 | } |
236 | 245 |
@@ -40,6 +40,7 @@ namespace UmaTest.App.Presentation.View | ||
40 | 40 | // Initialize Child Window Onwer |
41 | 41 | |
42 | 42 | vm.ManualHorseListProxy.Owner = this; |
43 | + vm.TokuRaceListProxy.Owner = this; | |
43 | 44 | |
44 | 45 | // Register UI EventHandler |
45 | 46 |
@@ -49,7 +50,8 @@ namespace UmaTest.App.Presentation.View | ||
49 | 50 | // Bind UI Commands |
50 | 51 | // |
51 | 52 | |
52 | - cm.Bind(vm.CommandReadHorseList, this.toolStripMenuOpenHorseList); | |
53 | + cm.Bind(vm.CommandOpenHorseList, this.toolStripMenuOpenHorseList); | |
54 | + cm.Bind(vm.CommandOpenTokuRaceList, this.toolStripMenuOpenTokuRaceList); | |
53 | 55 | |
54 | 56 | // |
55 | 57 | // Bind UI Text |
@@ -0,0 +1,117 @@ | ||
1 | + | |
2 | +namespace UmaTest.App.Presentation.View | |
3 | +{ | |
4 | + partial class TokuRaceListView | |
5 | + { | |
6 | + /// <summary> | |
7 | + /// Required designer variable. | |
8 | + /// </summary> | |
9 | + private System.ComponentModel.IContainer components = null; | |
10 | + | |
11 | + /// <summary> | |
12 | + /// Clean up any resources being used. | |
13 | + /// </summary> | |
14 | + /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> | |
15 | + protected override void Dispose(bool disposing) | |
16 | + { | |
17 | + if (disposing && (components != null)) | |
18 | + { | |
19 | + components.Dispose(); | |
20 | + } | |
21 | + base.Dispose(disposing); | |
22 | + } | |
23 | + | |
24 | + #region Windows Form Designer generated code | |
25 | + | |
26 | + /// <summary> | |
27 | + /// Required method for Designer support - do not modify | |
28 | + /// the contents of this method with the code editor. | |
29 | + /// </summary> | |
30 | + private void InitializeComponent() | |
31 | + { | |
32 | + this.splitContainer1 = new System.Windows.Forms.SplitContainer(); | |
33 | + this.dataGridView1 = new System.Windows.Forms.DataGridView(); | |
34 | + this.btnCancel = new System.Windows.Forms.Button(); | |
35 | + this.btnSelect = new System.Windows.Forms.Button(); | |
36 | + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); | |
37 | + this.splitContainer1.Panel1.SuspendLayout(); | |
38 | + this.splitContainer1.Panel2.SuspendLayout(); | |
39 | + this.splitContainer1.SuspendLayout(); | |
40 | + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); | |
41 | + this.SuspendLayout(); | |
42 | + // | |
43 | + // splitContainer1 | |
44 | + // | |
45 | + this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; | |
46 | + this.splitContainer1.Location = new System.Drawing.Point(0, 0); | |
47 | + this.splitContainer1.Name = "splitContainer1"; | |
48 | + this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal; | |
49 | + // | |
50 | + // splitContainer1.Panel1 | |
51 | + // | |
52 | + this.splitContainer1.Panel1.Controls.Add(this.dataGridView1); | |
53 | + // | |
54 | + // splitContainer1.Panel2 | |
55 | + // | |
56 | + this.splitContainer1.Panel2.Controls.Add(this.btnCancel); | |
57 | + this.splitContainer1.Panel2.Controls.Add(this.btnSelect); | |
58 | + this.splitContainer1.Size = new System.Drawing.Size(416, 455); | |
59 | + this.splitContainer1.SplitterDistance = 425; | |
60 | + this.splitContainer1.TabIndex = 0; | |
61 | + // | |
62 | + // dataGridView1 | |
63 | + // | |
64 | + this.dataGridView1.AllowUserToAddRows = false; | |
65 | + this.dataGridView1.AllowUserToDeleteRows = false; | |
66 | + this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.ColumnHeader; | |
67 | + this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; | |
68 | + this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill; | |
69 | + this.dataGridView1.Location = new System.Drawing.Point(0, 0); | |
70 | + this.dataGridView1.Name = "dataGridView1"; | |
71 | + this.dataGridView1.RowTemplate.Height = 21; | |
72 | + this.dataGridView1.Size = new System.Drawing.Size(416, 425); | |
73 | + this.dataGridView1.TabIndex = 0; | |
74 | + // | |
75 | + // btnCancel | |
76 | + // | |
77 | + this.btnCancel.Location = new System.Drawing.Point(258, -1); | |
78 | + this.btnCancel.Name = "btnCancel"; | |
79 | + this.btnCancel.Size = new System.Drawing.Size(74, 25); | |
80 | + this.btnCancel.TabIndex = 1; | |
81 | + this.btnCancel.Text = "Cancel"; | |
82 | + this.btnCancel.UseVisualStyleBackColor = true; | |
83 | + // | |
84 | + // btnSelect | |
85 | + // | |
86 | + this.btnSelect.Location = new System.Drawing.Point(338, 0); | |
87 | + this.btnSelect.Name = "btnSelect"; | |
88 | + this.btnSelect.Size = new System.Drawing.Size(75, 23); | |
89 | + this.btnSelect.TabIndex = 0; | |
90 | + this.btnSelect.Text = "Select"; | |
91 | + this.btnSelect.UseVisualStyleBackColor = true; | |
92 | + // | |
93 | + // TokuRaceListView | |
94 | + // | |
95 | + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); | |
96 | + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; | |
97 | + this.ClientSize = new System.Drawing.Size(416, 455); | |
98 | + this.Controls.Add(this.splitContainer1); | |
99 | + this.Name = "TokuRaceListView"; | |
100 | + this.Text = "TokuRaceListView"; | |
101 | + this.splitContainer1.Panel1.ResumeLayout(false); | |
102 | + this.splitContainer1.Panel2.ResumeLayout(false); | |
103 | + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); | |
104 | + this.splitContainer1.ResumeLayout(false); | |
105 | + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); | |
106 | + this.ResumeLayout(false); | |
107 | + | |
108 | + } | |
109 | + | |
110 | + #endregion | |
111 | + | |
112 | + private System.Windows.Forms.SplitContainer splitContainer1; | |
113 | + private System.Windows.Forms.DataGridView dataGridView1; | |
114 | + private System.Windows.Forms.Button btnCancel; | |
115 | + private System.Windows.Forms.Button btnSelect; | |
116 | + } | |
117 | +} | |
\ No newline at end of file |
@@ -0,0 +1,130 @@ | ||
1 | +using System; | |
2 | +using System.Collections.Generic; | |
3 | +using System.ComponentModel; | |
4 | +using System.Data; | |
5 | +using System.Drawing; | |
6 | +using System.Linq; | |
7 | +using System.Text; | |
8 | +using System.Threading.Tasks; | |
9 | +using System.Windows.Forms; | |
10 | +using UmaTest.App.Adaptor.Gateway.ViewModel; | |
11 | +using UmaTest.Infra.Adaptor.Command; | |
12 | +using UmaTest.Infra.Presentation.View; | |
13 | + | |
14 | +namespace UmaTest.App.Presentation.View | |
15 | +{ | |
16 | + public partial class TokuRaceListView : Form, IChildWindow, IOwnerForm | |
17 | + { | |
18 | + private ITokuRaceListViewModel vm; | |
19 | + | |
20 | + private BindingSource bindingSource1 = new BindingSource(); | |
21 | + | |
22 | + public TokuRaceListView(ITokuRaceListViewModel vm, ICommandManager cm) | |
23 | + { | |
24 | + InitializeComponent(); | |
25 | + | |
26 | + Bind(vm, cm); | |
27 | + | |
28 | + this.vm = vm; | |
29 | + | |
30 | + this.Visible = false; | |
31 | + } | |
32 | + | |
33 | + public void ShowChildWindow() | |
34 | + { | |
35 | + vm.CommandInitReadTokuRaceList.Execute(); | |
36 | + | |
37 | + this.CenterToParent(); | |
38 | + this.Show(); | |
39 | + } | |
40 | + | |
41 | + public void HideChildWindow() | |
42 | + { | |
43 | + this.Hide(); | |
44 | + } | |
45 | + | |
46 | + private void Bind(ITokuRaceListViewModel vm, ICommandManager cm) | |
47 | + { | |
48 | + // Subscribe VM PropertyChanged event | |
49 | + | |
50 | + vm.PropertyChanged += new PropertyChangedEventHandler(OnViewModelChanged); | |
51 | + | |
52 | + // Register UI EventHandler | |
53 | + | |
54 | + this.dataGridView1.SelectionChanged += vm.EventSelectedRaceChanged; | |
55 | + | |
56 | + // | |
57 | + // Bind UI Commands | |
58 | + // | |
59 | + | |
60 | + ICommand commandHide = new DelegateCommand("Cancel", () => true, HideChildWindow); | |
61 | + | |
62 | + cm.Bind(commandHide, btnCancel); | |
63 | + | |
64 | + CompositeCommand commandRead = new CompositeCommand("Select"); | |
65 | + | |
66 | + commandRead.Add(vm.CommandExecuteReadTokuUmaRaceList); | |
67 | + commandRead.Add(commandHide); | |
68 | + | |
69 | + cm.Bind(commandRead, this.btnSelect); | |
70 | + | |
71 | + // | |
72 | + // Initialize DataGridView1 | |
73 | + // | |
74 | + | |
75 | + bindingSource1.DataSource = vm.TokuRaceList; | |
76 | + | |
77 | + dataGridView1.AutoGenerateColumns = false; | |
78 | + dataGridView1.AutoSize = true; | |
79 | + dataGridView1.DataSource = bindingSource1; | |
80 | + | |
81 | + DataGridViewColumn[] grid1Cols = new DataGridViewColumn[] | |
82 | + { | |
83 | + new DataGridViewTextBoxColumn | |
84 | + { | |
85 | + DataPropertyName = "YearMonthDay", | |
86 | + Name = "日付", | |
87 | + }, | |
88 | + new DataGridViewTextBoxColumn | |
89 | + { | |
90 | + DataPropertyName = "RaceName", | |
91 | + Name = "レース名", | |
92 | + }, | |
93 | + new DataGridViewTextBoxColumn | |
94 | + { | |
95 | + DataPropertyName = "GradeName", | |
96 | + Name = "グレード", | |
97 | + }, | |
98 | + new DataGridViewTextBoxColumn | |
99 | + { | |
100 | + DataPropertyName = "Race.Kyori", | |
101 | + Name = "距離", | |
102 | + }, | |
103 | + }; | |
104 | + | |
105 | + grid1Cols.Do(col => col.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter); | |
106 | + | |
107 | + dataGridView1.Columns.AddRange(grid1Cols); | |
108 | + } | |
109 | + | |
110 | + private void OnViewModelChanged(object sender, EventArgs e) | |
111 | + { | |
112 | + PropertyChangedEventArgs args = e as PropertyChangedEventArgs; | |
113 | + | |
114 | + switch (args.PropertyName) | |
115 | + { | |
116 | + case "TokuRaceList": | |
117 | + dataGridView1.SuspendLayout(); | |
118 | + //dataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.None; | |
119 | + dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.None; | |
120 | + bindingSource1.DataSource = vm.TokuRaceList; | |
121 | + //dataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells; | |
122 | + dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; | |
123 | + dataGridView1.ResumeLayout(); | |
124 | + break; | |
125 | + default: | |
126 | + break; | |
127 | + } | |
128 | + } | |
129 | + } | |
130 | +} |
@@ -0,0 +1,120 @@ | ||
1 | +<?xml version="1.0" encoding="utf-8"?> | |
2 | +<root> | |
3 | + <!-- | |
4 | + Microsoft ResX Schema | |
5 | + | |
6 | + Version 2.0 | |
7 | + | |
8 | + The primary goals of this format is to allow a simple XML format | |
9 | + that is mostly human readable. The generation and parsing of the | |
10 | + various data types are done through the TypeConverter classes | |
11 | + associated with the data types. | |
12 | + | |
13 | + Example: | |
14 | + | |
15 | + ... ado.net/XML headers & schema ... | |
16 | + <resheader name="resmimetype">text/microsoft-resx</resheader> | |
17 | + <resheader name="version">2.0</resheader> | |
18 | + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> | |
19 | + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> | |
20 | + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> | |
21 | + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> | |
22 | + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> | |
23 | + <value>[base64 mime encoded serialized .NET Framework object]</value> | |
24 | + </data> | |
25 | + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> | |
26 | + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> | |
27 | + <comment>This is a comment</comment> | |
28 | + </data> | |
29 | + | |
30 | + There are any number of "resheader" rows that contain simple | |
31 | + name/value pairs. | |
32 | + | |
33 | + Each data row contains a name, and value. The row also contains a | |
34 | + type or mimetype. Type corresponds to a .NET class that support | |
35 | + text/value conversion through the TypeConverter architecture. | |
36 | + Classes that don't support this are serialized and stored with the | |
37 | + mimetype set. | |
38 | + | |
39 | + The mimetype is used for serialized objects, and tells the | |
40 | + ResXResourceReader how to depersist the object. This is currently not | |
41 | + extensible. For a given mimetype the value must be set accordingly: | |
42 | + | |
43 | + Note - application/x-microsoft.net.object.binary.base64 is the format | |
44 | + that the ResXResourceWriter will generate, however the reader can | |
45 | + read any of the formats listed below. | |
46 | + | |
47 | + mimetype: application/x-microsoft.net.object.binary.base64 | |
48 | + value : The object must be serialized with | |
49 | + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter | |
50 | + : and then encoded with base64 encoding. | |
51 | + | |
52 | + mimetype: application/x-microsoft.net.object.soap.base64 | |
53 | + value : The object must be serialized with | |
54 | + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter | |
55 | + : and then encoded with base64 encoding. | |
56 | + | |
57 | + mimetype: application/x-microsoft.net.object.bytearray.base64 | |
58 | + value : The object must be serialized into a byte array | |
59 | + : using a System.ComponentModel.TypeConverter | |
60 | + : and then encoded with base64 encoding. | |
61 | + --> | |
62 | + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> | |
63 | + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> | |
64 | + <xsd:element name="root" msdata:IsDataSet="true"> | |
65 | + <xsd:complexType> | |
66 | + <xsd:choice maxOccurs="unbounded"> | |
67 | + <xsd:element name="metadata"> | |
68 | + <xsd:complexType> | |
69 | + <xsd:sequence> | |
70 | + <xsd:element name="value" type="xsd:string" minOccurs="0" /> | |
71 | + </xsd:sequence> | |
72 | + <xsd:attribute name="name" use="required" type="xsd:string" /> | |
73 | + <xsd:attribute name="type" type="xsd:string" /> | |
74 | + <xsd:attribute name="mimetype" type="xsd:string" /> | |
75 | + <xsd:attribute ref="xml:space" /> | |
76 | + </xsd:complexType> | |
77 | + </xsd:element> | |
78 | + <xsd:element name="assembly"> | |
79 | + <xsd:complexType> | |
80 | + <xsd:attribute name="alias" type="xsd:string" /> | |
81 | + <xsd:attribute name="name" type="xsd:string" /> | |
82 | + </xsd:complexType> | |
83 | + </xsd:element> | |
84 | + <xsd:element name="data"> | |
85 | + <xsd:complexType> | |
86 | + <xsd:sequence> | |
87 | + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | |
88 | + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> | |
89 | + </xsd:sequence> | |
90 | + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> | |
91 | + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> | |
92 | + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> | |
93 | + <xsd:attribute ref="xml:space" /> | |
94 | + </xsd:complexType> | |
95 | + </xsd:element> | |
96 | + <xsd:element name="resheader"> | |
97 | + <xsd:complexType> | |
98 | + <xsd:sequence> | |
99 | + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | |
100 | + </xsd:sequence> | |
101 | + <xsd:attribute name="name" type="xsd:string" use="required" /> | |
102 | + </xsd:complexType> | |
103 | + </xsd:element> | |
104 | + </xsd:choice> | |
105 | + </xsd:complexType> | |
106 | + </xsd:element> | |
107 | + </xsd:schema> | |
108 | + <resheader name="resmimetype"> | |
109 | + <value>text/microsoft-resx</value> | |
110 | + </resheader> | |
111 | + <resheader name="version"> | |
112 | + <value>2.0</value> | |
113 | + </resheader> | |
114 | + <resheader name="reader"> | |
115 | + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |
116 | + </resheader> | |
117 | + <resheader name="writer"> | |
118 | + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |
119 | + </resheader> | |
120 | +</root> | |
\ No newline at end of file |
@@ -103,10 +103,15 @@ | ||
103 | 103 | </ItemGroup> |
104 | 104 | <ItemGroup> |
105 | 105 | <Compile Include="App\Adaptor\Gateway\UI\IManualHorseListProxy.cs" /> |
106 | + <Compile Include="App\Adaptor\Gateway\UI\TokuRaceListProxy.cs" /> | |
107 | + <Compile Include="App\Adaptor\Gateway\ViewModel\Dto\TokuRaceRowDto.cs" /> | |
106 | 108 | <Compile Include="App\Adaptor\Gateway\ViewModel\Dto\ChakudosuuByGradeRowDto.cs" /> |
107 | 109 | <Compile Include="App\Adaptor\Gateway\ViewModel\Dto\UmaRaceRowDto.cs" /> |
108 | 110 | <Compile Include="App\Adaptor\Gateway\ViewModel\Dto\UmaSummaryRowDto.cs" /> |
111 | + <Compile Include="App\Adaptor\Gateway\UI\ITokuRaceListProxy.cs" /> | |
109 | 112 | <Compile Include="App\Adaptor\Gateway\ViewModel\IMainWindowViewModel.cs" /> |
113 | + <Compile Include="App\Adaptor\Gateway\ViewModel\ITokuRaceListViewModel.cs" /> | |
114 | + <Compile Include="App\Adaptor\Gateway\ViewModel\TokuRaceListViewModel.cs" /> | |
110 | 115 | <Compile Include="App\Adaptor\Presenter\IAsyncLoadHorseRaceSummaryPresenter.cs" /> |
111 | 116 | <Compile Include="App\Adaptor\Presenter\ILoadHorseRaceSummaryPresenter.cs" /> |
112 | 117 | <Compile Include="App\Adaptor\Presenter\AsyncLoadHorseRaceSummaryPresenter.cs" /> |
@@ -115,7 +120,17 @@ | ||
115 | 120 | <Compile Include="App\Adaptor\Gateway\UI\ManualHorseListProxy.cs" /> |
116 | 121 | <Compile Include="App\Domain\Model\Logic\IUmaLogic.cs" /> |
117 | 122 | <Compile Include="App\Domain\Model\Logic\IUmaRaceLogic.cs" /> |
123 | + <Compile Include="App\Domain\UseCase\Request\AsyncLoadTokuUmaRaceListRequest.cs" /> | |
124 | + <Compile Include="App\Domain\UseCase\Request\AsyncLoadTokuRaceListRequest .cs" /> | |
125 | + <Compile Include="App\Domain\UseCase\Response\AsyncLoadTokuUmaRaceListResponse.cs" /> | |
126 | + <Compile Include="App\Domain\UseCase\Response\AsyncLoadTokuRaceListResponse.cs" /> | |
118 | 127 | <Compile Include="App\Domain\UseCase\Response\AsyncLoadHorseRaceSummaryResponse.cs" /> |
128 | + <Compile Include="App\Presentation\View\TokuRaceListView.cs"> | |
129 | + <SubType>Form</SubType> | |
130 | + </Compile> | |
131 | + <Compile Include="App\Presentation\View\TokuRaceListView.Designer.cs"> | |
132 | + <DependentUpon>TokuRaceListView.cs</DependentUpon> | |
133 | + </Compile> | |
119 | 134 | <Compile Include="Infra\Adaptor\Gateway\UI\IStatusBarProxy.cs" /> |
120 | 135 | <Compile Include="Infra\Adaptor\Gateway\UI\StatusBarProxy.cs" /> |
121 | 136 | <Compile Include="Infra\Adaptor\Presenter\IAsyncPresenter.cs" /> |
@@ -220,6 +235,9 @@ | ||
220 | 235 | <EmbeddedResource Include="App\Presentation\View\ManualHorseListView.resx"> |
221 | 236 | <DependentUpon>ManualHorseListView.cs</DependentUpon> |
222 | 237 | </EmbeddedResource> |
238 | + <EmbeddedResource Include="App\Presentation\View\TokuRaceListView.resx"> | |
239 | + <DependentUpon>TokuRaceListView.cs</DependentUpon> | |
240 | + </EmbeddedResource> | |
223 | 241 | <EmbeddedResource Include="Properties\Resources.resx"> |
224 | 242 | <Generator>ResXFileCodeGenerator</Generator> |
225 | 243 | <LastGenOutput>Resources.Designer.cs</LastGenOutput> |