Exemple #1
0
        /// <summary>
        /// Raises the <see cref="ButtonPressed"/> or <see cref="ButtonReleased"/> event.
        /// </summary>
        /// <param name="sender">The <see cref="MAX31865"/> that raised the event.</param>
        /// <param name="buttonState">The state of the button.</param>
        protected virtual void OnButtonEvent(MAX31865 sender, ButtonState buttonState)
        {
            if (this.onButton == null)
            {
                this.onButton = new ButtonEventHandler(this.OnButtonEvent);
            }

            if (buttonState == ButtonState.Pressed)
            {
                // Program.CheckAndInvoke helps event callers get onto the Dispatcher thread.
                // If the event is null then it returns false.
                // If it is called while not on the Dispatcher thread, it returns false but also re-invokes this method on the Dispatcher.
                // If on the thread, it returns true so that the caller can execute the event.
                if (Program.CheckAndInvoke(ButtonPressed, this.onButton, sender, buttonState))
                {
                    this.ButtonPressed(sender, buttonState);
                }
            }
            else
            {
                if (Program.CheckAndInvoke(ButtonReleased, this.onButton, sender, buttonState))
                {
                    this.ButtonReleased(sender, buttonState);
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Raises the <see cref="ButtonPressed"/> or <see cref="ButtonReleased"/> event.
        /// </summary>
        /// <param name="sender">The <see cref="MAX31865"/> that raised the event.</param>
        /// <param name="buttonState">The state of the button.</param>
        protected virtual void OnButtonEvent(MAX31865 sender, ButtonState buttonState)
        {
            if (this.onButton == null)
            {
                this.onButton = new ButtonEventHandler(this.OnButtonEvent);
            }

            if (buttonState == ButtonState.Pressed)
            {
                // Program.CheckAndInvoke helps event callers get onto the Dispatcher thread.
                // If the event is null then it returns false.
                // If it is called while not on the Dispatcher thread, it returns false but also re-invokes this method on the Dispatcher.
                // If on the thread, it returns true so that the caller can execute the event.
                if (Program.CheckAndInvoke(ButtonPressed, this.onButton, sender, buttonState))
                {
                    this.ButtonPressed(sender, buttonState);
                }
            }
            else
            {
                if (Program.CheckAndInvoke(ButtonReleased, this.onButton, sender, buttonState))
                {
                    this.ButtonReleased(sender, buttonState);
                }
            }
        }
Exemple #3
0
 void MAX31865_Instance_DataReadyFarEvent(MAX31865 sender, double Data)
 {
     byte config = MAX31865_Instance.GetRegister(0x00);
     Debug.Print("Temp: " + Data + "f ");
 }
Exemple #4
0
 void MAX31865_Instance_FaultEvent(MAX31865 sender, byte FaultByte)
 {
     Debug.Print("Fault: " + FaultByte.ToString("X"));
     MAX31865_Instance.ClearFaults();
 }
Exemple #5
0
 public void WriteConfigBit(MAX31865.ConfigSettings Setting, MAX31865.ConfigValues Value)
 {
     byte OldValue = (byte)GetRegister(0x00);
     byte NewValue = (byte)((~(byte)Setting & OldValue) | (byte)Value);
     Debug.Print("Set Config Bit: Old:" + OldValue.ToString("X") + " New:" + NewValue.ToString("X"));
     SetRegister(0x00, (byte)NewValue);
 }