Exemple #1
0
        /// <summary>
        /// Lets the user edit the record in command line.
        /// </summary>
        /// <param name="record">The PositionRecord that has been recorded.</param>
        private static void editRecord(PositionRecord record)
        {
            string input = "";

            do
            {
                Console.WriteLine(record.Name);
                Console.WriteLine(record.CSV);
                Console.WriteLine("Anything you still want to do?");
                Console.WriteLine("  s : Save record");
                Console.WriteLine("  q!: Discard record");
                Console.WriteLine("  w: Ignore wrist.");
                Console.WriteLine("  a: Ignore abductions.");
                Console.WriteLine("  t: Ignore thumb.");
                Console.WriteLine("  Enter any number from 0 to 21 to");
                Console.WriteLine("  add a joint to the ignore list.");

                Console.Write(">>> ");
                input = Console.ReadLine().Trim();
                int joint = -1;
                if (input == "q!")
                {
                    break;
                }
                else if (input == "w")
                {
                    record.IgnoreWrist();
                }
                else if (input == "t")
                {
                    record.IgnoreThumb();
                }
                else if (input == "a")
                {
                    record.IgnoreAbductions();
                }
                else if (input == "s")
                {
                    PositionParser p = new PositionParser("positions.txt");
                    Console.WriteLine("Saving record!");
                    for (int i = 0; i < 22; i++)
                    {
                        Console.WriteLine("[{0,2}]: {1,5} : {2,5}", i, record[i].Value, hand[i].Value);
                    }
                    p.Save(record);
                    break;
                }
                else if (Int32.TryParse(input, out joint))
                {
                    record.Ignored[joint] = true;
                }
                else
                {
                    Console.WriteLine("Unrecognized command!!");
                }
            } while (true);
        }