質問編集履歴

2

公開できない内容の割愛2

2021/05/16 06:05

投稿

K.KATSU2
K.KATSU2

スコア10

test CHANGED
File without changes
test CHANGED
@@ -152,25 +152,9 @@
152
152
 
153
153
  <StackPanel>
154
154
 
155
- <Label Content="以下のファイルに対する処理を選択してください。"/>
156
-
157
- <TextBlock Text="{Binding Files}"/>
158
-
159
- <RadioButton Content="承認"/>
160
-
161
- <RadioButton Content="却下"/>
162
-
163
- <Label Content="コメント:"/>
164
-
165
- <TextBox TextWrapping="Wrap" AcceptsReturn="True" VerticalContentAlignment="Bottom" Height="45"/>
166
-
167
- <StackPanel FlowDirection="RightToLeft" Orientation="Horizontal">
168
-
169
155
  <Button Content="キャンセル" Margin="5,5,5,0" Width="70"/>
170
156
 
171
- <Button Content="実行" Command="{Binding ApprovalProcess}" Margin="5,5,5,0" Width="70"/>
157
+ <Button Content="実行" Command="{Binding Execution}" Margin="5,5,5,0" Width="70"/>
172
-
173
- </StackPanel>
174
158
 
175
159
  </StackPanel>
176
160
 
@@ -200,7 +184,7 @@
200
184
 
201
185
 
202
186
 
203
- ApprovalProcess = new DelegateCommand(ApprovalProcessExecute);
187
+ Execution = new DelegateCommand(ExecutionExecute);
204
188
 
205
189
  }
206
190
 
@@ -210,27 +194,13 @@
210
194
 
211
195
 
212
196
 
213
- private string _files;
214
-
215
- public string Files
216
-
217
- {
218
-
219
- get { return _files; }
220
-
221
- set { SetProperty(ref _files, value); }
222
-
223
- }
224
-
225
-
226
-
227
197
      public event Action<IDialogResult> RequestClose;
228
198
 
229
199
 
230
200
 
231
- public DelegateCommand ApprovalProcess { get; }
201
+ public DelegateCommand Execution { get; }
232
-
202
+
233
- private void ApprovalProcessExecute()
203
+ private void ExecutionExecute()
234
204
 
235
205
  {
236
206
 

1

公開できない内容の割愛

2021/05/16 06:05

投稿

K.KATSU2
K.KATSU2

スコア10

test CHANGED
File without changes
test CHANGED
@@ -60,7 +60,7 @@
60
60
 
61
61
  containerRegistry.RegisterSingleton<MainWindowViewModel>();
62
62
 
63
- containerRegistry.RegisterDialog<ConfirmDialog, ConfirmDialogViewModel>();
63
+ containerRegistry.RegisterDialog<Dialog, DialogViewModel>();
64
64
 
65
65
  }
66
66
 
@@ -72,59 +72,63 @@
72
72
 
73
73
 
74
74
 
75
+
76
+
75
- [メインウィンドウ側のコードビハインド]
77
+ [メインウィンドで表示するWIPListのコードビハインド]
76
78
 
77
79
  ```C#
78
80
 
79
- public class MainWindowViewModel : BindableBase
81
+ public class ListViewModel : BindableBase
80
82
 
81
83
  {
82
84
 
83
- private IRegionManager _regionManager;
85
+ private MainWindowViewModel _mainWindowViewModel;
84
86
 
85
87
  private IDialogService _dialogService;
86
88
 
87
89
 
88
90
 
89
- private string _title = "承認フロー画面";
91
+ public ListViewModel(MainWindowViewModel mainWindowViewModel, IDialogService dialogService)
90
-
91
- public string Title
92
+
92
-
93
- {
93
+ {
94
-
95
- get { return _title; }
94
+
96
-
97
- set { SetProperty(ref _title, value); }
98
-
99
- }
100
-
101
-
102
-
103
- public MainWindowViewModel(IRegionManager regionManager, IDialogService dialogService)
104
-
105
- {
106
-
107
- _regionManager = regionManager;
95
+ _mainWindowViewModel = mainWindowViewModel;
108
96
 
109
97
  _dialogService = dialogService;
110
98
 
111
- _regionManager.RegisterViewWithRegion("ContentRegion", typeof(WIPList));
99
+
112
-
113
-
114
-
100
+
115
- ShowWIPList = new DelegateCommand(ShowWIPListExecute);
101
+ ApproveFiles = new DelegateCommand(ApproveFilesExecute);
116
-
102
+
117
- }
103
+ }
118
-
119
-
120
-
104
+
105
+
106
+
121
- public DelegateCommand ShowWIPList { get; }
107
+ public DelegateCommand ApproveFiles { get; }
122
-
108
+
123
- private void ShowWIPListExecute()
109
+ private void ApproveFilesExecute()
124
-
110
+
125
- {
111
+ {
112
+
126
-
113
+ var p = new DialogParameters();
114
+
127
- _regionManager.RequestNavigate("ContentRegion", nameof(WIPList));
115
+ p.Add(nameof(DialogViewModel.Files), "テスト表示");
116
+
117
+ _dialogService.ShowDialog(nameof(Dialog), p, DialogClose);
118
+
119
+ }
120
+
121
+
122
+
123
+ private void DialogClose(IDialogResult dialogResult)
124
+
125
+ {
126
+
127
+ if (dialogResult.Result == ButtonResult.OK)
128
+
129
+ {
130
+
131
+ }
128
132
 
129
133
  }
130
134
 
@@ -134,63 +138,135 @@
134
138
 
135
139
 
136
140
 
141
+ [ConfirmDialog ]
142
+
143
+ ```Xaml
144
+
145
+ < !-- 省略 --
146
+
147
+ Height="200" Width="300"
148
+
149
+ prism:ViewModelLocator.AutoWireViewModel="True">
150
+
151
+ <Grid>
152
+
153
+ <StackPanel>
154
+
155
+ <Label Content="以下のファイルに対する処理を選択してください。"/>
156
+
157
+ <TextBlock Text="{Binding Files}"/>
158
+
159
+ <RadioButton Content="承認"/>
160
+
161
+ <RadioButton Content="却下"/>
162
+
163
+ <Label Content="コメント:"/>
164
+
165
+ <TextBox TextWrapping="Wrap" AcceptsReturn="True" VerticalContentAlignment="Bottom" Height="45"/>
166
+
167
+ <StackPanel FlowDirection="RightToLeft" Orientation="Horizontal">
168
+
169
+ <Button Content="キャンセル" Margin="5,5,5,0" Width="70"/>
170
+
171
+ <Button Content="実行" Command="{Binding ApprovalProcess}" Margin="5,5,5,0" Width="70"/>
172
+
137
- [メインウィンドで表示するWIPListのコードビハインド]
173
+ </StackPanel>
174
+
175
+ </StackPanel>
176
+
177
+ </Grid>
178
+
179
+ </Window>
180
+
181
+ ```
182
+
183
+
138
184
 
139
185
  ```C#
140
186
 
141
- public class WIPListViewModel : BindableBase
187
+ public class DialogViewModel : BindableBase, IDialogAware
142
188
 
143
189
  {
144
190
 
145
- private MainWindowViewModel _mainWindowViewModel;
146
-
147
- private IDialogService _dialogService;
191
+ IDialogService _dialogService;
148
-
149
-
150
-
192
+
193
+
194
+
151
- public WIPListViewModel(MainWindowViewModel mainWindowViewModel, IDialogService dialogService)
195
+ public DialogViewModel(IDialogService dialogService)
152
-
196
+
153
- {
197
+ {
154
-
155
- _mainWindowViewModel = mainWindowViewModel;
156
198
 
157
199
  _dialogService = dialogService;
158
200
 
159
201
 
160
202
 
161
- ApproveFiles = new DelegateCommand(ApproveFilesExecute);
203
+ ApprovalProcess = new DelegateCommand(ApprovalProcessExecute);
162
-
204
+
163
- }
205
+ }
206
+
207
+
208
+
164
-
209
+      public string Title => "承認確認";
210
+
211
+
212
+
165
-
213
+ private string _files;
214
+
166
-
215
+ public string Files
216
+
217
+ {
218
+
219
+ get { return _files; }
220
+
221
+ set { SetProperty(ref _files, value); }
222
+
223
+ }
224
+
225
+
226
+
227
+     public event Action<IDialogResult> RequestClose;
228
+
229
+
230
+
167
- public DelegateCommand ApproveFiles { get; }
231
+ public DelegateCommand ApprovalProcess { get; }
168
-
232
+
169
- private void ApproveFilesExecute()
233
+ private void ApprovalProcessExecute()
170
234
 
171
235
  {
172
236
 
173
237
  var p = new DialogParameters();
174
238
 
175
- p.Add(nameof(ConfirmDialogViewModel.Files), "テスト表示");
239
+ p.Add(nameof(Files), Files);
176
-
240
+
177
- _dialogService.ShowDialog(nameof(ConfirmDialog), p, ConfirmDialogClose);
241
+ RequestClose?.Invoke(new DialogResult(ButtonResult.OK, p));
178
-
242
+
179
- }
243
+ }
180
-
181
-
182
-
244
+
245
+
246
+
183
- private void ConfirmDialogClose(IDialogResult dialogResult)
247
+ public bool CanCloseDialog()
184
-
248
+
185
- {
249
+ {
250
+
186
-
251
+ return true;
252
+
253
+ }
254
+
255
+
256
+
187
- if (dialogResult.Result == ButtonResult.OK)
257
+ public void OnDialogClosed()
188
-
258
+
189
- {
259
+ {
190
-
191
- //TODO:WIPListの更新
260
+
192
-
193
- }
261
+ }
262
+
263
+
264
+
265
+ public void OnDialogOpened(IDialogParameters parameters)
266
+
267
+ {
268
+
269
+ Files = parameters.GetValue<string>(nameof(Files));
194
270
 
195
271
  }
196
272
 
@@ -200,150 +276,6 @@
200
276
 
201
277
 
202
278
 
203
- [ConfirmDialog ]
204
-
205
- ```Xaml
206
-
207
- <Window x:Class="ApprovalFlow.Views.ConfirmDialog"
208
-
209
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
210
-
211
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
212
-
213
- xmlns:prism="http://prismlibrary.com/"
214
-
215
- Height="200" Width="300"
216
-
217
- prism:ViewModelLocator.AutoWireViewModel="True">
218
-
219
- <Grid>
220
-
221
- <StackPanel>
222
-
223
- <Label Content="以下のファイルに対する処理を選択してください。"/>
224
-
225
- <TextBlock Text="{Binding Files}"/>
226
-
227
- <RadioButton Content="承認"/>
228
-
229
- <RadioButton Content="却下"/>
230
-
231
- <Label Content="コメント:"/>
232
-
233
- <TextBox TextWrapping="Wrap" AcceptsReturn="True" VerticalContentAlignment="Bottom" Height="45"/>
234
-
235
- <StackPanel FlowDirection="RightToLeft" Orientation="Horizontal">
236
-
237
- <Button Content="キャンセル" Margin="5,5,5,0" Width="70"/>
238
-
239
- <Button Content="実行" Command="{Binding ApprovalProcess}" Margin="5,5,5,0" Width="70"/>
240
-
241
- </StackPanel>
242
-
243
- </StackPanel>
244
-
245
- </Grid>
246
-
247
- </Window>
248
-
249
- ```
250
-
251
-
252
-
253
- ```C#
254
-
255
- public class ConfirmDialogViewModel : BindableBase, IDialogAware
256
-
257
- {
258
-
259
- IDialogService _dialogService;
260
-
261
-
262
-
263
- public ConfirmDialogViewModel(IDialogService dialogService)
264
-
265
- {
266
-
267
- _dialogService = dialogService;
268
-
269
-
270
-
271
- ApprovalProcess = new DelegateCommand(ApprovalProcessExecute);
272
-
273
- }
274
-
275
-
276
-
277
-      public string Title => "承認確認";
278
-
279
-
280
-
281
- private string _files;
282
-
283
- public string Files
284
-
285
- {
286
-
287
- get { return _files; }
288
-
289
- set { SetProperty(ref _files, value); }
290
-
291
- }
292
-
293
-
294
-
295
-     public event Action<IDialogResult> RequestClose;
296
-
297
-
298
-
299
- public DelegateCommand ApprovalProcess { get; }
300
-
301
- private void ApprovalProcessExecute()
302
-
303
- {
304
-
305
- var p = new DialogParameters();
306
-
307
- p.Add(nameof(Files), Files);
308
-
309
- RequestClose?.Invoke(new DialogResult(ButtonResult.OK, p));
310
-
311
- }
312
-
313
-
314
-
315
- public bool CanCloseDialog()
316
-
317
- {
318
-
319
- return true;
320
-
321
- }
322
-
323
-
324
-
325
- public void OnDialogClosed()
326
-
327
- {
328
-
329
- }
330
-
331
-
332
-
333
- public void OnDialogOpened(IDialogParameters parameters)
334
-
335
- {
336
-
337
- Files = parameters.GetValue<string>(nameof(Files));
338
-
339
- }
340
-
341
- }
342
-
343
- ```
344
-
345
-
346
-
347
279
  ### 備考
348
280
 
349
281
  ・VisualStudio2019