Permalink
Browse files

Change itemWithCommand to ItemWithAction

  • Loading branch information...
1 parent 1f4ac5d commit 8fd6c23877bbf6498021f44124cf343d4a5698c9 @PeterForstmeier PeterForstmeier committed Dec 27, 2011
@@ -297,12 +297,12 @@ void ActivateMetricsExecute ()
#region testregion
- List<ItemWithCommand> itemsWithCommand;
+ List<ItemWithAction> itemsWithCommand;
- public List<ItemWithCommand> ItemsWithCommand {
+ public List<ItemWithAction> ItemsWithCommand {
get {
if (itemsWithCommand == null) {
- itemsWithCommand = new List<ItemWithCommand>();
+ itemsWithCommand = new List<ItemWithAction>();
}
return itemsWithCommand;
}
@@ -324,31 +324,34 @@ void ActivateMetricsExecute ()
break;
case MetricsLevel.Method:
- ItemsWithCommand.Add(new ItemWithCommand()
+
+ ItemsWithCommand.Add(new ItemWithAction()
{
Description = "IL Instructions",
- Command = new RelayCommand (ExecuteMerhodIlInstructions)
+ Action = ExecuteMerhodIlInstructions
});
- ItemsWithCommand.Add(new ItemWithCommand()
+ ItemsWithCommand.Add(new ItemWithAction()
{
Description = "Cyclomatic Complexity",
- Command = new RelayCommand (ExecuteMethodComplexity)
+ Action = ExecuteMethodComplexity
});
- ItemsWithCommand.Add(new ItemWithCommand()
+ ItemsWithCommand.Add(new ItemWithAction()
{
Description = "Variables",
- Command = new RelayCommand (ExecuteMethodVariables)
+ Action = ExecuteMethodVariables
});
-
+
+// var t = new testclass(MainModule);
+// ItemsWithCommand = t.MethodList();
break;
default:
throw new Exception("Invalid value for MetricsLevel");
}
}
- ItemWithCommand selectedItemWithCommand;
+ ItemWithAction selectedItemWithCommand;
- public ItemWithCommand SelectedItemWithCommand {
+ public ItemWithAction SelectedItemWithCommand {
get { return selectedItemWithCommand; }
set { selectedItemWithCommand = value;
base.RaisePropertyChanged(() => SelectedItemWithCommand);}
@@ -385,7 +388,8 @@ private void ExecuteMethodVariables ()
void ExecuteSelectedItem()
{
- SelectedItemWithCommand.Command.Execute(null);
+ //SelectedItemWithCommand.Command.Execute(null);
+ SelectedItemWithCommand.Action.Invoke();
}
@@ -491,13 +495,13 @@ ObservableCollection<INode> PrepareNodes()
}
- public class ItemWithCommand
+ public class ItemWithAction
{
- public ItemWithCommand()
+ public ItemWithAction()
{
}
public string Description {get; set;}
- public ICommand Command {get; set;}
+ public Action Action {get; set;}
}
}
@@ -34,5 +34,54 @@ public testclass(Module mainModule)
select method;
return new ObservableCollection <INode>(list);
}
+
+ public List<ItemWithAction> MethodList()
+ {
+ List<ItemWithAction> itemsWithCommand = new List<ItemWithAction>();
+ itemsWithCommand.Add(new ItemWithAction()
+ {
+ Description = "IL Instructions",
+ Action = ExecuteMerhodIlInstructions
+ });
+ itemsWithCommand.Add(new ItemWithAction()
+ {
+ Description = "Cyclomatic Complexity",
+ Action = ExecuteMethodComplexity
+ });
+ itemsWithCommand.Add(new ItemWithAction()
+ {
+ Description = "Variables",
+ Action = ExecuteMethodVariables
+ });
+ return itemsWithCommand;
+ }
+
+
+ private void ExecuteMerhodIlInstructions()
+ {
+// var t = new testclass(MainModule);
+// TreeValueProperty = "Instructions.Count";
+// Nodes = t.QueryMethod();
+ }
+
+ private void ExecuteMethodComplexity ()
+ {
+// var t = new testclass(MainModule);
+// TreeValueProperty = Metrics.CyclomaticComplexity.ToString();
+// var tt = t.QueryMethod();
+// foreach (var element in tt) {
+// var m = element as Method;
+// Console.WriteLine("{0} - {1}",m.Name,m.CyclomaticComplexity);
+// }
+// Nodes = t.QueryMethod();
+ }
+
+
+ private void ExecuteMethodVariables ()
+ {
+// var t = new testclass(MainModule);
+// TreeValueProperty = Metrics.Variables.ToString();
+// Nodes = t.QueryMethod();
+ }
}
}

0 comments on commit 8fd6c23

Please sign in to comment.