bovender framework
C# framework that implements MVVM and more
FileFolderActionBase.cs
1
/* FileFolderActionBase.cs
2
* part of Daniel's XL Toolbox NG
3
*
4
* Copyright 2014-2018 Daniel Kraus
5
*
6
* Licensed under the Apache License, Version 2.0 (the "License");
7
* you may not use this file except in compliance with the License.
8
* You may obtain a copy of the License at
9
*
10
* http://www.apache.org/licenses/LICENSE-2.0
11
*
12
* Unless required by applicable law or agreed to in writing, software
13
* distributed under the License is distributed on an "AS IS" BASIS,
14
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
* See the License for the specific language governing permissions and
16
* limitations under the License.
17
*/
18
using
Bovender
.
Mvvm
.
Messaging
;
19
using
System
;
20
using
System
.Collections.Generic;
21
using
System
.Linq;
22
using
System
.Text;
23
24
namespace
Bovender
.Mvvm.Actions
25
{
30
public
abstract
class
FileFolderActionBase
:
NotificationAction
31
{
32
#region Public properties
33
34
public
string
Description {
get
;
set
; }
35
36
#endregion
37
38
#region Abstract methods
39
47
protected
abstract
string
GetDialogResult(
48
string
defaultString,
49
string
filter);
50
51
#endregion
52
53
#region Protected properties
54
55
protected
StringMessageContent
MessageContent
{
get
;
private
set
; }
56
57
#endregion
58
59
#region Overrides
60
61
protected
override
void
Invoke(
object
parameter)
62
{
63
if
(parameter == null)
64
{
65
throw
new
ArgumentNullException(
"FileFolderActionBase parameter must not be null"
);
66
}
67
MessageArgs<FileNameMessageContent>
args = parameter as
MessageArgs<FileNameMessageContent>
;
68
if
(args == null)
69
{
70
throw
new
ArgumentException(
71
String.Format(
72
"FileFolderActionBase must be invoked with FileNameMessageContent; got {0}"
,
73
parameter.GetType().ToString()
74
)
75
);
76
}
77
MessageContent
= args.Content;
78
string
result = GetDialogResult(args.Content.Value, args.Content.Filter);
79
args.Content.Confirmed = !
string
.IsNullOrEmpty(result);
80
if
(args.Content.Confirmed)
81
{
82
args.Content.Value = result;
83
};
84
args.Respond();
85
}
86
87
protected
override
System
.Windows.Window
CreateView
()
88
{
89
throw
new
InvalidOperationException(
90
"This class does not create WPF views and this method should never be called."
);
91
}
92
93
#endregion
94
}
95
}
Bovender.Mvvm.Messaging
Definition:
DownloadProcessMessageContent.cs:24
Bovender.Mvvm.Messaging.MessageArgs
Definition:
MessageArgs.cs:25
Bovender.Mvvm.Messaging.StringMessageContent
Encapsulates a string message that is part of the content that a view model sends to a consumer (view...
Definition:
StringMessageContent.cs:31
Bovender.Mvvm
Bovender.Mvvm.Actions.FileFolderActionBase
Abstract base class for the ChooseFileSaveAction and ChooseFolderAction classes.
Definition:
FileFolderActionBase.cs:30
Bovender.Mvvm.Actions.FileFolderActionBase.CreateView
override System.Windows.Window CreateView()
Returns a view that can bind to expected message contents.
Definition:
FileFolderActionBase.cs:87
Bovender
Definition:
ComHelpers.cs:24
System
Bovender.Mvvm.Messaging.MessageContent
Simple object that encapsulates a boolean value; to be used in MVVM interaction with MessageArgs...
Definition:
MessageContent.cs:26
Bovender.Mvvm.Actions.NotificationAction
Opens a generic WPF dialog window that displays a message and has a single OK button.
Definition:
NotificationAction.cs:33
Bovender
Mvvm
Actions
FileFolderActionBase.cs
Generated on Tue Aug 14 2018 13:04:33 for bovender framework by
1.8.11