17154d6d0f47c78db902de3ae36a761bd6b22ddc
[deb_libcec.git] / src / cec-config-gui / actions / SendActivateSource.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Text;
4 using CecSharp;
5
6 namespace CecConfigGui.actions
7 {
8 class SendActivateSource : UpdateProcess
9 {
10 public SendActivateSource(ref LibCecSharp lib, CecLogicalAddress address)
11 {
12 Lib = lib;
13 Address = address;
14 }
15
16 public override void Process()
17 {
18 SendEvent(UpdateEventType.StatusText, "Sending the 'activate source' command to " + Lib.ToString(Address) + "...");
19 SendEvent(UpdateEventType.ProgressBar, 50);
20
21 bool bResult = Lib.SetStreamPath(Address);
22 SendEvent(UpdateEventType.StatusText, bResult ? "Command sent successfully." : "The 'active source' command was not acked.");
23 SendEvent(UpdateEventType.ProgressBar, 100);
24 }
25
26 private LibCecSharp Lib;
27 private CecLogicalAddress Address;
28 }
29 }