/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void iTreeViewHarmony_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) { //Upon function node double click we execute it, so that user can test var tag = e.Node.Tag as HarmonyHub.Function; if (tag != null && e.Node.Parent.Parent.Tag is HarmonyHub.Device) { HarmonyHub.Function f = tag; HarmonyHub.Device d = (HarmonyHub.Device)e.Node.Parent.Parent.Tag; Trace.WriteLine($"Harmony: Sending {f.Label} to {d.Label}..."); await Program.HarmonyClient.TrySendKeyPressAsync(d.Id, f.Action.Command); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void iTreeViewHarmony_AfterSelect(object sender, TreeViewEventArgs e) { //Enable ok button if a function is selected iButtonOk.Enabled = e.Node.Tag is HarmonyHub.Function; // Get selected device ID and function name HarmonyHub.Function f = e.Node.Tag as HarmonyHub.Function; if (f != null && e.Node.Parent.Parent.Tag is HarmonyHub.Device) { HarmonyHub.Device d = (HarmonyHub.Device)e.Node.Parent.Parent.Tag; DeviceId = d.Id; Command = f.Action.Command; } else { DeviceId = ""; Command = ""; } }