Example #1
0
        private void WindowKeyUp(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Escape)
            {
                Close();
            }
            else
            {
                // testing
                if (e.Key == Key.D1)
                {
                    // prev
                    PerformDiscreteInput(0.58);
                }
                else if (e.Key == Key.D2)
                {
                    // next
                    PerformDiscreteInput(0.82);
                }
                else if (e.Key == Key.D3)
                {
                    // play/pause
                    PerformDiscreteInput(0.39);
                }
                else if (e.Key == Key.S)
                {
                    // load a file
                    if (!Directory.Exists(System.IO.Path.GetDirectoryName(
                                              Assembly.GetEntryAssembly().Location) + "\\Files"))
                    {
                        return;
                    }

                    string fileName = null;

                    OpenFileDialog openFileDialog = new OpenFileDialog
                    {
                        Filter           = "EchoTube Settings (*.ets)|*.ets",
                        InitialDirectory = System.IO.Path.GetDirectoryName(
                            Assembly.GetEntryAssembly().Location) + "\\Files"
                    };

                    if (openFileDialog.ShowDialog() == true)
                    {
                        fileName = openFileDialog.FileName;
                    }

                    if (fileName != null)
                    {
                        // open the file
                        m_sensor.LoadSettings(fileName);
                    }
                }
                else if (e.Key == Key.C)
                {
                    // calbrate the device
                    m_sensor.DeviceState = DeviceState.Startup;
                }
            }
        }
Example #2
0
        private void WindowKeyUp(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Escape)
            {
                Close();
            }
            else if (e.Key == Key.S)
            {
                // load a file
                if (!Directory.Exists(System.IO.Path.GetDirectoryName(
                                          Assembly.GetEntryAssembly().Location) + "\\Files"))
                {
                    return;
                }

                string fileName = null;

                OpenFileDialog openFileDialog = new OpenFileDialog
                {
                    Filter           = "EchoTube Settings (*.ets)|*.ets",
                    InitialDirectory = System.IO.Path.GetDirectoryName(
                        Assembly.GetEntryAssembly().Location) + "\\Files"
                };

                if (openFileDialog.ShowDialog() == true)
                {
                    fileName = openFileDialog.FileName;
                }

                if (fileName != null)
                {
                    // open the file
                    m_sensor.LoadSettings(fileName);
                    m_sensor.EndCutOff = 1000;
                }
            }
            else if (e.Key == Key.C)
            {
                // calbrate the device
                m_sensor.DeviceState = DeviceState.Startup;
            }
        }