本文整理汇总了C#中Caliburn.Micro.ActionExecutionContext类的典型用法代码示例。如果您正苦于以下问题:C# ActionExecutionContext类的具体用法?C# ActionExecutionContext怎么用?C# ActionExecutionContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ActionExecutionContext类属于Caliburn.Micro命名空间,在下文中一共展示了ActionExecutionContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
public void Execute(ActionExecutionContext context)
{
// Server Side Error
var faultException = Error as System.ServiceModel.FaultException<ServiceFault>;
if (faultException != null) {
if (faultException.Reason.ToString() == "Unauthorized") {
Coroutine.BeginExecute(IoC.Get<IShell>().ExecuteSessionTimeout(), null, null);
} else {
if (Manual)
Caliburn.Micro.Execute.OnUIThread(()=> WindowManager.Value.Alert(faultException.Detail.Type, faultException.Detail.Message));
else
WindowManager.Value.Alert(faultException.Detail.Type, faultException.Detail.Message);
}
} else {
// General Exception
var communicationError = Error as System.ServiceModel.CommunicationException;
if (communicationError != null) {
if (Manual)
Caliburn.Micro.Execute.OnUIThread(() => WindowManager.Value.Alert(faultException.Detail.Type, faultException.Detail.Message));
else
WindowManager.Value.Alert("Communication Error", ValidationMessageResources.CommunicationError);
} else {
if (faultException != null) {
// Catch All other Errors
if (Manual)
Caliburn.Micro.Execute.OnUIThread(() => WindowManager.Value.Alert(faultException.Detail.Type, faultException.Detail.Message));
else
WindowManager.Value.Alert("Error", Error.Message);
}
}
}
// Execute Last
if (!Manual)
Caliburn.Micro.Execute.OnUIThread(() => Completed(this, new ResultCompletionEventArgs()));
}
示例2: Execute
public void Execute(ActionExecutionContext context)
{
DeploymentCatalog catalog;
if (Catalogs.TryGetValue(_uri, out catalog))
Completed(this, new ResultCompletionEventArgs());
else
{
catalog = new DeploymentCatalog(_uri);
catalog.DownloadCompleted += (s, e) =>
{
if (e.Error == null)
{
Catalogs[_uri] = catalog;
Catalog.Catalogs.Add(catalog);
catalog.Parts
.Select(part => ReflectionModelServices.GetPartType(part).Value.Assembly)
.Where(assembly => !AssemblySource.Instance.Contains(assembly))
.Apply(x => AssemblySource.Instance.Add(x));
}
else Loader.Hide().Execute(context);
Completed(this, new ResultCompletionEventArgs
{
Error = e.Error,
WasCancelled = false
});
};
catalog.DownloadAsync();
}
}
示例3: Execute
public void Execute(ActionExecutionContext context)
{
var shell = IoC.Get<IShell>();
shell.IsBusy = _isBusy;
Completed(this, new ResultCompletionEventArgs());
}
示例4: Execute
public override void Execute(ActionExecutionContext context)
{
var result = MessageBox.Show(this.messageBoxText, this.caption,
this.showCancel ? MessageBoxButton.OKCancel : MessageBoxButton.OK);
this.OnCompleted(new ResultCompletionEventArgs());
}
示例5: Execute
public void Execute(ActionExecutionContext context)
{
// simulating work
Task
.Run(() => Task.Delay(6000))
.ContinueWith(task => Completed(this, new ResultCompletionEventArgs()));
}
示例6: Execute
public void Execute(ActionExecutionContext context)
{
var view = context.View as UserControl;
if (view != null) {
// add support for controls here
List<Control> editableControls =
view.GetChildrenByType<Control>(c => c is RadComboBox ||
c is RadMaskedTextBox ||
c is NotifyButton ||
c is ModuleButton ||
c is RadButton);
var control = editableControls.SingleOrDefault(c =>
c.Name == controlToFocus);
if (control != null)
control.Dispatcher.BeginInvoke(() => {
control.Focus();
});
}
// Execute Last
if (!manual)
Caliburn.Micro.Execute.OnUIThread(() => Completed(this, new ResultCompletionEventArgs()));
}
示例7: Execute
public override void Execute(ActionExecutionContext context)
{
if(callback != null)
callback();
OnCompleted(this, new ResultCompletionEventArgs{WasCancelled = true});
}
示例8: Execute
public void Execute(ActionExecutionContext context)
{
var currentUser = SessionInfo.Instance.CurrentUser;
service = new ChannelFactory<IUserService>(ServiceConfig.UserServiceEndpoint);
var channel = service.CreateChannel();
ThreadPool.QueueUserWorkItem(x => channel.BeginAuthenticate(currentUser.Username, Security.GetSha2Hash(currentPassword.Trim(), currentUser.Username.Trim()), new AsyncCallback(AuthenticateResponse), channel));
}
示例9: EvaluateParameter
/// <summary>
/// Evaluates the parameter.
/// </summary>
/// <param name = "expression">The expression.</param>
/// <param name = "context">The context.</param>
/// <param name = "resultType">Type of the result.</param>
/// <returns>The evaluated parameter.</returns>
private static object EvaluateParameter(string expression, ActionExecutionContext context, Type resultType)
{
try
{
var index = 0;
var parameters = new ParameterExpression[MessageBinder.SpecialValues.Count];
var values = new object[MessageBinder.SpecialValues.Count];
foreach (var pair in MessageBinder.SpecialValues)
{
var name = "@" + index;
expression = expression.Replace(pair.Key, name);
var value = pair.Value(context);
parameters[index] = Expression.Parameter(GetParameterType(value), name);
values[index] = value;
index++;
}
var exp = DynamicExpression.ParseLambda(parameters, resultType, expression);
return exp.Compile().DynamicInvoke(values);
}
catch (Exception exc)
{
LogManager.GetLog(typeof(MessageBinder)).Error(exc);
return null;
}
}
示例10: Execute
public void Execute(ActionExecutionContext context = null)
{
Result = MessageBox.Show(_message, _caption, _button);
if (Completed != null)
Completed(this, new ResultCompletionEventArgs());
}
示例11: Execute
public void Execute(ActionExecutionContext context)
{
Exception error = null;
var worker = new BackgroundWorker();
worker.DoWork += (s, e) =>
{
try
{
_work();
}
catch (Exception ex)
{
error = ex;
}
};
worker.RunWorkerCompleted += (s, e) =>
{
if (error == null && _onSuccess != null)
_onSuccess.OnUIThread();
if (error != null && _onFail != null)
{
Caliburn.Micro.Execute.OnUIThread(() => _onFail(error));
}
Completed(this, new ResultCompletionEventArgs { Error = error });
};
worker.RunWorkerAsync();
}
示例12: Execute
public void Execute(ActionExecutionContext context)
{
IStockTickerContentViewModel contentViewModel = this.contentFactory.CreateContent(this.detailModel.Value);
this.conductor(contentViewModel);
this.Completed(this, new ResultCompletionEventArgs());
}
示例13: Execute
public override void Execute(ActionExecutionContext context)
{
Window window = Window.GetWindow(context.View);
if (window != null) window.Close();
base.Execute(context);
}
示例14: Execute
public override void Execute(ActionExecutionContext context)
{
var window = Window.GetWindow(context.View);
window.Close();
base.Execute(context);
}
示例15: Execute
public void Execute(ActionExecutionContext context)
{
service = new ChannelFactory<ISampleService>(ServiceConfig.SampleServiceEndpoint);
ISampleService channel = service.CreateChannel();
ThreadPool.QueueUserWorkItem(x => channel.BeginCloneSample(arlNumber, descriptionYN, storageYN, containersYN, containerDescriptionYN,
fillVolumeYN, dosageYN, analytesYN, testsYN, chargesYN, notesYN, AppLib.GetIdentification(), new AsyncCallback(GetRequestResponse), channel));
}