bovender framework
C# framework that implements MVVM and more
ProcessAction.cs
1
/* ProcessAction.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
System
;
19
using
System
.Collections.Generic;
20
using
System
.Linq;
21
using
System
.Text;
22
using
System
.Windows;
23
using
Bovender
.
Mvvm
.
Messaging
;
24
using
Bovender
.
Mvvm
.
Views
;
25
26
namespace
Bovender
.Mvvm.Actions
27
{
42
public
class
ProcessAction
:
ShowViewAction
43
{
44
#region Overrides
45
46
protected
override
System
.Windows.Window
CreateView
()
47
{
48
Window view;
49
// Attempt to create a view from the Assembly and View
50
// parameters. If this fails, create a generic ProcessView.
51
try
52
{
53
view = base.CreateView();
54
}
55
catch
56
{
57
view =
new
ProcessView
();
58
}
59
// The ShowViewAction injects a ViewModelBase object into the view.
60
// The ProcessAction returns a view with a ProcessMessageContent injected
61
// into it.
62
return
view;
63
}
64
65
protected
override
ViewModels.ViewModelBase
GetDataContext
(
MessageContent
messageContent)
66
{
67
ProcessMessageContent
pmc = messageContent as
ProcessMessageContent
;
68
if
(pmc == null)
69
{
70
Logger.Debug(
"ProcessMessageContent: Need ProcessMessageContent, got {0}"
,
71
messageContent == null ?
"null"
: messageContent.GetType().AssemblyQualifiedName);
72
throw
new
ArgumentException(
"Cannot process because the message did not contain a ProcessMessageContent"
);
73
}
74
if
(!
string
.IsNullOrEmpty(CancelButtonText))
75
{
76
Logger.Info(
"ProcessMessageContent: Overriding CancelButtonText"
);
77
pmc.CancelButtonText = CancelButtonText;
78
}
79
return
pmc;
80
}
81
82
#endregion
83
84
#region Class logger
85
86
private
static
NLog
.Logger Logger {
get
{
return
_logger.Value; } }
87
88
private
static
readonly Lazy<
NLog
.Logger> _logger =
new
Lazy<
NLog
.Logger>(() =>
NLog
.LogManager.GetCurrentClassLogger());
89
90
#endregion
91
}
92
}
Bovender.Mvvm.Actions.ProcessAction.CreateView
override System.Windows.Window CreateView()
Returns a view that can bind to expected message contents.
Definition:
ProcessAction.cs:46
Bovender.Mvvm.Messaging.ProcessMessageContent
Holds information about percent completion of a process and defines events that occur when the proces...
Definition:
ProcessMessageContent.cs:30
Bovender.Mvvm.Views
Definition:
ConfirmationView.xaml.cs:20
Bovender.Mvvm.Actions.ShowViewAction
Injects a view with a view model that is referenced in a ViewModelMessageContent, and shows the view ...
Definition:
ShowViewAction.cs:32
Bovender.Mvvm.Actions.ProcessAction
Invokes a process view and injects the ProcessMessageContent as a view model into it...
Definition:
ProcessAction.cs:42
Bovender.Mvvm.Messaging
Definition:
DownloadProcessMessageContent.cs:24
Bovender.Mvvm.Actions.ProcessAction.GetDataContext
override ViewModels.ViewModelBase GetDataContext(MessageContent messageContent)
Gets a ViewModelBase object that will be injected into the view In the abstract base class...
Definition:
ProcessAction.cs:65
Bovender.Mvvm
Bovender
Definition:
ComHelpers.cs:24
System
NLog
Bovender.Mvvm.Views.ProcessView
Interaction logic for ProcessView.xaml
Definition:
ProcessView.xaml.cs:38
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
ProcessAction.cs
Generated on Tue Aug 14 2018 13:04:33 for bovender framework by
1.8.11