MyCaffe  1.12.2.41
Deep learning software for Windows C# programmers.
FormGyms.cs
1using System;
2using System.Collections.Generic;
4using System.Data;
5using System.Drawing;
6using System.Linq;
7using System.Text;
8using System.Threading.Tasks;
9using System.Windows.Forms;
10
11namespace MyCaffe.gym
12{
16 public partial class FormGyms : Form
17 {
18 GymCollection m_col;
19 IXMyCaffeGym m_selectedGym;
20
25 public FormGyms(GymCollection col = null)
26 {
27 if (col == null)
28 {
29 col = new GymCollection();
30 col.Load();
31 }
32
33 m_col = col;
34 InitializeComponent();
35 }
36
41 {
42 get { return m_selectedGym; }
43 }
44
45 private void FormGyms_Load(object sender, EventArgs e)
46 {
47 foreach (IXMyCaffeGym igym in m_col)
48 {
49 ListViewItem lvi = new ListViewItem(igym.Name);
50 lvi.Tag = igym;
51
52 lstItems.Items.Add(lvi);
53 }
54 }
55
56 private void timerUI_Tick(object sender, EventArgs e)
57 {
58 if (lstItems.SelectedItems.Count == 0)
59 btnOpen.Enabled = false;
60 else
61 btnOpen.Enabled = true;
62 }
63
64 private void btnOpen_Click(object sender, EventArgs e)
65 {
66 m_selectedGym = lstItems.SelectedItems[0].Tag as IXMyCaffeGym;
67 }
68
69 private void lstItems_MouseDoubleClick(object sender, MouseEventArgs e)
70 {
71 ListViewHitTestInfo hti = lstItems.HitTest(e.Location);
72 if (hti == null)
73 return;
74
75 m_selectedGym = hti.Item.Tag as IXMyCaffeGym;
76 DialogResult = DialogResult.OK;
77 }
78 }
79}
The FormGyms dialog displays the available gyms.
Definition: FormGyms.cs:17
FormGyms(GymCollection col=null)
The constructor.
Definition: FormGyms.cs:25
IXMyCaffeGym SelectedGym
Returns the selected Gym.
Definition: FormGyms.cs:41
The GymCollection contains the available Gyms.
The IXMyCaffeGym interface is used to interact with each Gym.
Definition: Interfaces.cs:99
string Name
Returns the name of the gym.
Definition: Interfaces.cs:119
The MyCaffe.gym namespace contains all classes related to the Gym's supported by MyCaffe.