Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
MicroThreadViewModel.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 SiliconStudio.Paradox.Framework.MicroThreading;
6 using System.Windows.Input;
8 using SiliconStudio.Presentation;
9 
10 namespace SiliconStudio.Paradox.DebugTools.ViewModels
11 {
13  {
14  private readonly MicroThread microThread;
15 
16  public MicroThreadViewModel(MicroThread microThread)
17  {
18  if (microThread == null)
19  throw new ArgumentNullException("microThread");
20 
21  if (microThread.Scheduler == null)
22  throw new ArgumentException("Invalid Scheduler in MicroThread " + microThread.Id);
23 
24  this.microThread = microThread;
25 
26  // New MicroThread system doesn't have any PropertyChanged event yet.
27  throw new NotImplementedException();
28  //this.microThread.Scheduler.MicroThreadStateChanged += OnMicroThreadStateChanged;
29  }
30 
31  private void OnMicroThreadStateChanged(object sender, SchedulerEventArgs e)
32  {
33  if (e.MicroThread == microThread)
34  {
35  OnPropertyChanged<MicroThreadViewModel>(n => n.State);
36  }
37  }
38 
39  public long Id
40  {
41  get
42  {
43  return microThread.Id;
44  }
45  }
46 
47  public string Name
48  {
49  get
50  {
51  return microThread.Name;
52  }
53  }
54 
55  public MicroThreadState State
56  {
57  get
58  {
59  return microThread.State;
60  }
61  }
62 
63  public Exception Exception
64  {
65  get
66  {
67  return microThread.Exception;
68  }
69  }
70  }
71 }