示例#1
0
 private void Myo_Disconnected(object sender, MyoEventArgs e)
 {
     OnMyoDisconnected(e);
     UnhookMyoEvents(e.Myo);
     _myos.Remove(e.Myo.Handle);
     e.Myo.Dispose();
 }
示例#2
0
文件: Hub.cs 项目: Hellyon/MyoGame
 private void Myo_Locked(object sender, MyoEventArgs e)
 {
     if (MyoUnlocked != null)
     {
         MyoUnlocked.Invoke(this, e);
     }
 }
示例#3
0
        /// <summary>
        /// Raises the <see cref="E:MyoDisconnected" /> event.
        /// </summary>
        /// <param name="e">The <see cref="MyoEventArgs"/> instance containing the event data.</param>
        protected virtual void OnMyoDisconnected(MyoEventArgs e)
        {
            var handler = MyoDisconnected;

            if (handler != null)
            {
                handler.Invoke(this, e);
            }
        }
示例#4
0
        /// <summary>
        /// Raises the <see cref="E:MyoDisconnected" /> event.
        /// </summary>
        /// <param name="e">The <see cref="MyoEventArgs"/> instance containing the event data.</param>
        protected virtual void OnMyoDisconnected(MyoEventArgs e)
        {
            Contract.Requires <ArgumentNullException>(e != null, "e");

            var handler = MyoDisconnected;

            if (handler != null)
            {
                handler.Invoke(this, e);
            }
        }
示例#5
0
        /// <summary>
        /// Called when the Myo has unlocked.
        /// </summary>
        /// <param name="timestamp">The timestamp of the event.</param>
        protected virtual void OnUnLock(DateTime timestamp)
        {
            this.IsUnlocked = true;
            var handler = Unlocked;

            if (handler != null)
            {
                var args = new MyoEventArgs(this, timestamp);
                handler(this, args);
            }
        }
示例#6
0
        /// <summary>
        /// Called when the Myo can no longer recognize which arm it is on.
        /// </summary>
        /// <param name="timestamp">The timestamp of the event.</param>
        protected virtual void OnArmLost(DateTime timestamp)
        {
            this.Arm = Arm.Unknown;

            var handler = ArmLost;

            if (handler != null)
            {
                var args = new MyoEventArgs(this, timestamp);
                handler.Invoke(this, args);
            }
        }
示例#7
0
        /// <summary>
        /// Called when the Myo has disconnected.
        /// </summary>
        /// <param name="timestamp">The timestamp of the event.</param>
        protected virtual void OnDisconnected(DateTime timestamp)
        {
            this.IsConnected = false;

            var handler = Disconnected;

            if (handler != null)
            {
                var args = new MyoEventArgs(this, timestamp);
                handler(this, args);
            }
        }
示例#8
0
        /// <summary>
        /// Called when the Myo has connected..
        /// </summary>
        /// <param name="timestamp">The timestamp of the event.</param>
        protected virtual void OnConnected(DateTime timestamp)
        {
            this.IsConnected = true;

            var handler = Connected;

            if (handler != null)
            {
                var args = new MyoEventArgs(this, timestamp);
                handler.Invoke(this, args);
            }
        }
示例#9
0
        /// <summary>
        /// Called when the Myo has locked.
        /// </summary>
        /// <param name="timestamp">The timestamp of the event.</param>
        protected virtual void OnLock(DateTime timestamp)
        {
            this.IsUnlocked = false;

            var handler = Locked;

            if (handler != null)
            {
                var args = new MyoEventArgs(this, timestamp);
                handler.Invoke(this, args);
            }
        }
示例#10
0
        public void GetMyo_ValidState_EqualsConstructorParameter()
        {
            // Setup
            var myo = new Mock<IMyo>();
            
            var args = new MyoEventArgs(
                myo.Object,
                DateTime.UtcNow);

            // Execute
            var result = args.Myo;

            // Assert
            Assert.Equal(myo.Object, result);
        }
示例#11
0
        public void GetTimestamp_ValidState_EqualsConstructorParameter()
        {
            // Setup
            var timestamp = DateTime.UtcNow;
            
            var args = new MyoEventArgs(
                new Mock<IMyo>().Object,
                timestamp);

            // Execute
            var result = args.Timestamp;

            // Assert
            Assert.Equal(timestamp, result);
        }
 private void OnUnlocked(object sender, MyoEventArgs e)
 {
     e.Myo.Unlock(UnlockType.Hold);
     _isLock = false;
     Console.WriteLine("Myo UnLocked");
 }
 private static void Myo_Locked(object sender, MyoEventArgs e)
 {
     Console.WriteLine("{0} arm Myo has locked!", e.Myo.Arm);
 }
示例#14
0
 private void Hub_MyoConnected(object sender, MyoEventArgs e)
 {
     e.Myo.EmgDataAcquired += Myo_EmgDataAcquired;
     e.Myo.Unlock(UnlockType.Timed);
 }
示例#15
0
 private void Hub_MyoDisconnected(object sender, MyoEventArgs e)
 {
     e.Myo.EmgDataAcquired -= Myo_EmgDataAcquired;
 }
示例#16
0
 private void Myo_Locked(object sender, MyoEventArgs e)
 {
 }
示例#17
0
 private void Myo_Connected(object sender, MyoEventArgs e)
 {
     _myos[e.Myo.Handle] = e.Myo;
     OnMyoConnected(e);
 }
示例#18
0
文件: Hub.cs 项目: rafme/MyoSharp
        /// <summary>
        /// Raises the <see cref="E:MyoDisconnected" /> event.
        /// </summary>
        /// <param name="e">The <see cref="MyoEventArgs"/> instance containing the event data.</param>
        protected virtual void OnMyoDisconnected(MyoEventArgs e)
        {
            Contract.Requires<ArgumentNullException>(e != null, "e");

            var handler = MyoDisconnected;
            if (handler != null)
            {
                handler.Invoke(this, e);
            }
        }
示例#19
0
 private void Myo_Connected(object sender, MyoEventArgs e)
 {
     OnMyoConnected(e);
 }
示例#20
0
文件: Hub.cs 项目: rafme/MyoSharp
        private void Myo_Disconnected(object sender, MyoEventArgs e)
        {
            Contract.Requires<ArgumentNullException>(sender != null, "sender");

            OnMyoDisconnected(e);
        }
 private void OnLocked(object sender, MyoEventArgs e)
 {
     e.Myo.Lock();
     _isLock = true;
     Console.WriteLine("Myo Locked");
 }
示例#22
0
 private static void Myo_Locked(object sender, MyoEventArgs e)
 {
     Console.SetCursorPosition(0, 14);
     ClearCurrentConsoleLine();
     Console.WriteLine("Myo del brazo {0} se ha bloqueado!", e.Myo.Arm);
 }
示例#23
0
        private void Myo_Connected(object sender, MyoEventArgs e)
        {
            Contract.Requires <ArgumentNullException>(sender != null, "sender");

            OnMyoConnected(e);
        }
 private void MyoDisconnected(object sender, MyoEventArgs e)
 {
     Console.WriteLine("Myo Disconnented!!");
     e.Myo.PoseChanged -= OnPose;
     e.Myo.OrientationDataAcquired -= OnOrientationData;
     e.Myo.Locked -= OnLocked;
     e.Myo.Unlocked -= OnUnlocked;
     //e.Myo.EmgDataAcquired -= OnEmgData;
     //e.Myo.SetEmgStreaming(false);
 }