Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><code>Keys</code> is an enum and <code>moveleftkey</code> is not one of the values. However, <code>moveleftkey</code> - after parsing - <strong>is</strong> the enum value (or should be).</p> <p>Remove the <code>Keys.</code> prepending <code>moveleftkey</code> and <code>moverightkey</code> and give that a try. </p> <p>I would recommend simplifying your assignment of control keys as well. You certainly do not need to create multiple files.</p> <p>Copy the following to an Xml file (<code>control_keys.xml</code> for instance): </p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;control_keys&gt; &lt;move_left key="l"/&gt; &lt;move_right key="r"/&gt; &lt;!-- add more control keys --&gt; &lt;/control_keys&gt; </code></pre> <p>Load that xml and get <code>Keys</code> as follows: (see here for learning how to use <a href="http://msdn.microsoft.com/en-us/library/bb387098.aspx" rel="nofollow">Linq-to-Xml</a>) </p> <pre><code>var conrolKeys = XDocument.Load("control_keys.xml").Root; // now get your Keys text values var moveLeftText = controlKeys.Element("move_left").Attribute("key").Value; var moveRightText = controlKeys.Element("move_right").Attribute("key").Value; // now get your Keys values var moveLeftKey = (Keys)Enum.Parse(typeof(Keys), moveLeftText); var moveRightKey = (Keys)Enum.Parse(typeof(Keys), moveRightText); </code></pre> <p><strong>Edit per comment regarding namespaces</strong><br> Add project references to:</p> <ul> <li>System.Xml</li> <li>System.Linq.Xml</li> </ul> <p>Visual Studio should then assist in resolving your <code>using</code> statements. But, in short:</p> <pre><code>using System.Xml; using System.Linq.Xml; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload