コード例 #1
0
ファイル: FormSelectHarmonyCommand.cs プロジェクト: Slion/CIC
        /// <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);
            }
        }
コード例 #2
0
ファイル: FormSelectHarmonyCommand.cs プロジェクト: Slion/CIC
        /// <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  = "";
            }
        }