Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
ScriptMethodViewModel.cs
Go to the documentation of this file.
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using System.Threading.Tasks;
6 using SiliconStudio.Paradox.Framework.MicroThreading;
7 using SiliconStudio.Paradox.Extensions;
8 using System.Windows.Input;
9 using SiliconStudio.Presentation;
11 
12 namespace SiliconStudio.Paradox.DebugTools.ViewModels
13 {
15  {
16  public ScriptAssemblyViewModel AssemblyParent { get; private set; }
17  public ScriptTypeViewModel TypeParent { get; private set; }
18 
19  public ICommand RunScriptCommand { get; private set; }
20  public ICommand CloseMicroThreadView { get; private set; }
21 
22  private ScriptEntry2 scriptEntry;
23 
24  public ScriptMethodViewModel(ScriptEntry2 scriptEntry, ScriptTypeViewModel parent)
25  {
26  if (parent == null)
27  throw new ArgumentNullException("parent");
28 
29  TypeParent = parent;
30  AssemblyParent = TypeParent.Parent;
31 
32  this.scriptEntry = scriptEntry;
33 
34  RunScriptCommand = new AnonymousCommand(_ => OnRunScriptCommand());
35  CloseMicroThreadView = new AnonymousCommand(_ => MicroThread = null);
36  }
37 
38  public string Name
39  {
40  get
41  {
42  return scriptEntry.MethodName;
43  }
44  }
45 
46  public bool IsAssemblyStartup
47  {
48  get
49  {
50  return scriptEntry.Flags == ScriptFlags.AssemblyStartup;
51  }
52  }
53 
54  public bool HasNoFlags
55  {
56  get
57  {
58  return scriptEntry.Flags == ScriptFlags.None;
59  }
60  }
61 
62  public ScriptFlags FlagsDisplay
63  {
64  get
65  {
66  return scriptEntry.Flags;
67  }
68  }
69 
70  private void OnRunScriptCommand()
71  {
72  MicroThread mt = AssemblyParent.Parent.EngineContext.ScriptManager.RunScript(scriptEntry, null);
73  MicroThread = new MicroThreadViewModel(mt);
74  }
75 
76  private MicroThreadViewModel microThread;
77  public MicroThreadViewModel MicroThread
78  {
79  get
80  {
81  return microThread;
82  }
83  private set
84  {
85  if (microThread != value)
86  {
87  microThread = value;
88  OnPropertyChanged("MicroThread");
89  }
90  }
91  }
92  }
93 }
An implementation of CommandBase that route Execute calls to a given anonymous method.
Flags
Enumeration of the new Assimp's flags.
ScriptMethodViewModel(ScriptEntry2 scriptEntry, ScriptTypeViewModel parent)