using System;
using System.ComponentModel;
+using System.Threading.Tasks;
namespace Crow {
public class CommandGroup : ObservableList<Command>, IValueChange
/// trigger the execution of the command
/// </summary>
public void Execute(){
- if (execute != null && CanExecute)
- execute ();
+ if (execute != null && CanExecute){
+ Task task = new Task(execute);
+ task.Start();
+ }
}
internal void raiseAllValuesChanged(){
NotifyValueChanged ("CanExecute", CanExecute);
if (type == null)
type = typeof(T);
if (parsingNeeded) {
- MethodInfo miParse = type.GetMethod ("Parse", new Type[] {typeof(string)});
- if (miParse != null)
- curVal = miParse.Invoke (null, new object[]{ curVal });
+ if (type.IsEnum) {
+ curVal = Enum.Parse (typeof(T), (string)curVal);
+ }else{
+ MethodInfo miParse = type.GetMethod ("Parse", new Type[] {typeof(string)});
+ if (miParse != null)
+ curVal = miParse.Invoke (null, new object[]{ curVal });
+ }
parsingNeeded = false;
}
return (T)Convert.ChangeType (curVal, type);
MIT License
-Copyright (c) [2016] [Jean-Philippe Bruyère]
+Copyright (c) [2016-2021] [Jean-Philippe Bruyère]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal