/// <summary> /// Declare a function to perform the echo for a button event /// </summary> /// <param name="obj"></param> private void FuncEchoButton(MsgFunctionTrigger obj) { // Encapsulate in a try-catch to catch any exception try { // Validate the control event type if (obj.ControlEvent.Type != ControlEventType.ButtonPressed && obj.ControlEvent.Type != ControlEventType.ButtonReleased) { return; } // Validate any parameters if (!obj.ParametersList.ContainsKey("Input Number")) { return; } // Get the parameter value int inputNumber = obj.ParametersList["Input Number"].ToInt(); // Print the button event to the console Console.WriteLine("Button " + inputNumber + " " + (obj.ControlEvent.Type == ControlEventType.ButtonPressed ? "pressed" : "released")); } catch (Exception ex) { // When an exception is thrown, print log to the ShowCockpit console Log(LogLevel.Error, "Error executing \"" + obj.FunctionID + "\": " + ex.Message); } }
/// <summary> /// Declare a function to perform the echo for a fader value /// </summary> /// <param name="obj"></param> private void FuncEchoFader(MsgFunctionTrigger obj) { // Encapsulate in a try-catch to catch any exception try { // Validate the control event type if (obj.ControlEvent.Type != ControlEventType.FaderMoved) { return; } // Validate any parameters if (!obj.ParametersList.ContainsKey("Input Number")) { return; } // Get the parameter value int inputNumber = obj.ParametersList["Input Number"].ToInt(); // Print the fader value to the console Console.WriteLine("Fader " + inputNumber + " value: " + obj.ControlEvent.ValueDouble.ToString("F2")); } catch (Exception ex) { // When an exception is thrown, print log to the ShowCockpit console Log(LogLevel.Error, "Error executing \"" + obj.FunctionID + "\": " + ex.Message); } }