2using System.Collections.Generic;
6using System.Threading.Tasks;
13 [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession)]
16 static Dictionary<int, FormGym> m_rgGyms =
new Dictionary<int, FormGym>();
17 static object m_syncObjGym =
new object();
28 private void dlg_FormClosing(
object sender,
System.Windows.Forms.FormClosingEventArgs e)
30 if (m_callback !=
null)
43 if (!m_rgGyms.ContainsKey(nId))
48 if (m_callback !=
null)
62 public int OpenUi(
string strName,
int nId,
bool bStartRecording =
false)
66 if (m_rgGyms.ContainsKey(nId))
68 m_rgGyms[nId].BringToFront();
73 dlg.FormClosing += dlg_FormClosing;
78 m_rgGyms.Add(nId, dlg);
91 if (!m_rgGyms.ContainsKey(nId))
94 if (!m_rgGyms[nId].Visible)
100 double[] rgData = obs.
State;
112 if (!m_rgGyms.ContainsKey(nId))
115 return m_rgGyms[nId].Visible;
The MyCaffeGymUiService provides the service used to show the Gym visualizations.
void CloseUi(int nId)
Close the user interface of a Gym.
bool IsOpen(int nId)
Returns true when the visualization is open, false otherwise.
MyCaffeGymUiService()
The constructor.
int OpenUi(string strName, int nId, bool bStartRecording=false)
Open the Gym user interface.
void Render(int nId, Observation obs)
Render an observation on the Gym user-interface.
The Observation contains data describing the Gym as it runs.
double[] State
Get/set the state data.
bool RequireDisplayImage
Get/set whether or not the image for display (ImageDisplay) is required.
Bitmap ImageDisplay
Get/set the image to display.
Bitmap Image
Get/set the action image, if it exists.
The IXMyCaffeGymUiCallback is used to interact with the user of the IXMyCaffeGymUiService interface.
void Closing()
The Closing method is called when closing the Gym user interface.
The IXMYCaffeGymUiService interface provides access to the MyCaffeGymUiService used to display the vi...
The MyCaffe.gym namespace contains all classes related to the Gym's supported by MyCaffe.