本文整理汇总了C#中OpenSource.UPnP.UPnPService类的典型用法代码示例。如果您正苦于以下问题:C# UPnPService类的具体用法?C# UPnPService怎么用?C# UPnPService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UPnPService类属于OpenSource.UPnP命名空间,在下文中一共展示了UPnPService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CpAVTransport
public CpAVTransport(UPnPService s)
{
_S = s;
_S.OnSubscribe += new UPnPService.UPnPEventSubscribeHandler(_subscribe_sink);
if (HasStateVariable_TransportStatus) _S.GetStateVariableObject("TransportStatus").OnModified += new UPnPStateVariable.ModifiedHandler(TransportStatus_ModifiedSink);
if (HasStateVariable_TransportState) _S.GetStateVariableObject("TransportState").OnModified += new UPnPStateVariable.ModifiedHandler(TransportState_ModifiedSink);
}
示例2: CpConnectionManager
public CpConnectionManager(UPnPService s)
{
_S = s;
_S.OnSubscribe += new UPnPService.UPnPEventSubscribeHandler(_subscribe_sink);
if(HasStateVariable_SourceProtocolInfo) _S.GetStateVariableObject("SourceProtocolInfo").OnModified += new UPnPStateVariable.ModifiedHandler(SourceProtocolInfo_ModifiedSink);
if(HasStateVariable_SinkProtocolInfo) _S.GetStateVariableObject("SinkProtocolInfo").OnModified += new UPnPStateVariable.ModifiedHandler(SinkProtocolInfo_ModifiedSink);
if(HasStateVariable_CurrentConnectionIDs) _S.GetStateVariableObject("CurrentConnectionIDs").OnModified += new UPnPStateVariable.ModifiedHandler(CurrentConnectionIDs_ModifiedSink);
}
示例3: CpContentDirectory
public CpContentDirectory(UPnPService s)
{
_S = s;
_S.OnSubscribe += new UPnPService.UPnPEventSubscribeHandler(_subscribe_sink);
if (HasStateVariable_TransferIDs) _S.GetStateVariableObject("TransferIDs").OnModified += new UPnPStateVariable.ModifiedHandler(TransferIDs_ModifiedSink);
if (HasStateVariable_ContainerUpdateIDs) _S.GetStateVariableObject("ContainerUpdateIDs").OnModified += new UPnPStateVariable.ModifiedHandler(ContainerUpdateIDs_ModifiedSink);
if (HasStateVariable_SystemUpdateID) _S.GetStateVariableObject("SystemUpdateID").OnModified += new UPnPStateVariable.ModifiedHandler(SystemUpdateID_ModifiedSink);
}
示例4: UPnPServiceWatcher
public UPnPServiceWatcher(UPnPService S, SniffHandler cb, SniffPacketHandler pcb)
{
OnSniff += cb;
OnSniffPacket += pcb;
_S = S;
_S.OnSniff += new UPnPService.SniffHandler(SniffSink);
_S.OnSniffPacket += new UPnPService.SniffPacketHandler(SniffPacketSink);
}
示例5: ActionEditForm
public ActionEditForm(UPnPService parentService)
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
action = new UPnPAction();
action.ParentService = parentService;
}
示例6: UPnPServiceProxy
public UPnPServiceProxy(Type serviceType, Type contractType)
{
var service = Activator.CreateInstance(serviceType);
_upnp = new UPnPService(1, contractType.GUID.ToString(), contractType.FullName, true, service);
var methods = (from meth in contractType.GetMethods()
where meth.GetCustomAttributes(false).Where( atr => atr.GetType() == typeof(OperationContractAttribute)).Count()>0
select meth).ToArray();
foreach (var meth in methods)
{
_upnp.AddMethod(meth.Name);
}
}
示例7: ValidationForm
public ValidationForm(UPnPService S)
{
service = S;
//
// Required for Windows Form Designer support
//
InitializeComponent();
foreach(UPnPAction A in S.Actions)
{
ServiceBox.Items.Add(A,CheckState.Unchecked);
}
//
// TODO: Add any constructor code after InitializeComponent call
//
}
示例8: MethodInvoke
public MethodInvoke(UPnPAction action, UPnPService service)
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
this.action = action;
this.service = service;
this.Text += " - " + action.Name;
actionLabel.Text = action.Name;
serviceLabel.Text = service.ServiceID;
deviceLabel.Text = service.ParentDevice.FriendlyName;
if (action.ArgumentList.Length>0)
{
argControlList = new UPnpArgumentControl[action.ArgumentList.Length];
for (int z=0;z<action.ArgumentList.Length;++z)
{
// if (action.ArgumentList[z].IsReturnValue == true) {returnArgPresent = true;}
argControlList[z] = new UPnpArgumentControl(action.ArgumentList[z]);
argControlList[z].Dock = System.Windows.Forms.DockStyle.Top;
/*
if (action.ArgumentList[z].RelatedStateVar.ValueType == "string")
{
argControlList[z].Height = 60;
}
*/
argPanel.Controls.Add(argControlList[z]);
argPanel.Controls.SetChildIndex(argControlList[z],0);
Splitter splitter = new Splitter();
splitter.Height = 4;
splitter.MinExtra = 0;
splitter.MinSize = 32;
splitter.BackColor = Color.Gray;
splitter.Dock = System.Windows.Forms.DockStyle.Top;
argPanel.Controls.Add(splitter);
argPanel.Controls.SetChildIndex(splitter,0);
}
}
service.OnInvokeError += new UPnPService.UPnPServiceInvokeErrorHandler(HandleInvokeError);
service.OnInvokeResponse += new UPnPService.UPnPServiceInvokeHandler(HandleInvoke);
}
示例9: Main
static void Main(string[] args)
{
var device = UPnPDevice.CreateRootDevice(int.MaxValue, 1.0, "\\");
device.FriendlyName = Environment.MachineName + ":" + "Network Light";
device.DeviceURN = "NetworkLight";
device.HasPresentation = false;
var switchPower = new UPnPService(1.0, typeof(SwitchPower).GUID.ToString(), typeof(SwitchPower).FullName, true, new SwitchPower());
switchPower.AddMethod("SetTarget");
switchPower.AddMethod("GetTarget");
switchPower.AddMethod("GetStatus");
device.AddService(switchPower);
device.StartDevice();
Console.ReadLine();
device.StopDevice();
}
示例10: CpRenderingControl
public CpRenderingControl(UPnPService s)
{
_S = s;
_S.OnSubscribe += new UPnPService.UPnPEventSubscribeHandler(_subscribe_sink);
if(HasStateVariable_LastChange) _S.GetStateVariableObject("LastChange").OnModified += new UPnPStateVariable.ModifiedHandler(LastChange_ModifiedSink);
}
示例11: Sink_SelectPreset
private void Sink_SelectPreset(UPnPService sender, string MethodName, UPnPArgument[] Args, object RetVal, int Handle)
{
for(int i=0;i<Args.Length;++i)
{
switch(Args[i].Name)
{
case "PresetName":
switch((string)Args[i].DataValue)
{
case "FactoryDefaults":
Args[i].DataValue = Enum_A_ARG_TYPE_PresetName.FACTORYDEFAULTS;
break;
case "InstallationDefaults":
Args[i].DataValue = Enum_A_ARG_TYPE_PresetName.INSTALLATIONDEFAULTS;
break;
case "Vendor defined":
Args[i].DataValue = Enum_A_ARG_TYPE_PresetName.VENDOR_DEFINED;
break;
default:
SetUnspecifiedValue("Enum_A_ARG_TYPE_PresetName", (string)Args[i].DataValue);
Args[i].DataValue = Enum_A_ARG_TYPE_PresetName._UNSPECIFIED_;
break;
}
break;
}
}
if(OnResult_SelectPreset != null)
{
OnResult_SelectPreset((System.UInt32 )Args[0].DataValue, (Enum_A_ARG_TYPE_PresetName )Args[1].DataValue, null, Handle);
}
WeakReference[] w = (WeakReference[])WeakList_SelectPreset.ToArray(typeof(WeakReference));
foreach(WeakReference wr in w)
{
if(wr.IsAlive==true)
{
((Delegate_OnResult_SelectPreset)wr.Target)((System.UInt32 )Args[0].DataValue, (Enum_A_ARG_TYPE_PresetName )Args[1].DataValue, null, Handle);
}
else
{
WeakList_SelectPreset.Remove(wr);
}
}
}
示例12: Error_Sink_SetSharpness
private void Error_Sink_SetSharpness(UPnPService sender, string MethodName, UPnPArgument[] Args, UPnPInvokeException e, int Handle)
{
if(OnResult_SetSharpness != null)
{
OnResult_SetSharpness((System.UInt32 )Args[0].DataValue, (System.UInt16 )Args[1].DataValue, e, Handle);
}
WeakReference[] w = (WeakReference[])WeakList_SetSharpness.ToArray(typeof(WeakReference));
foreach(WeakReference wr in w)
{
if(wr.IsAlive==true)
{
((Delegate_OnResult_SetSharpness)wr.Target)((System.UInt32 )Args[0].DataValue, (System.UInt16 )Args[1].DataValue, e, Handle);
}
else
{
WeakList_SetSharpness.Remove(wr);
}
}
}
示例13: Error_Sink_SetMute
private void Error_Sink_SetMute(UPnPService sender, string MethodName, UPnPArgument[] Args, UPnPInvokeException e, int Handle)
{
for(int i=0;i<Args.Length;++i)
{
switch(Args[i].Name)
{
case "Channel":
switch((string)Args[i].DataValue)
{
case "Master":
Args[i].DataValue = Enum_A_ARG_TYPE_Channel.MASTER;
break;
case "LF":
Args[i].DataValue = Enum_A_ARG_TYPE_Channel.LF;
break;
case "RF":
Args[i].DataValue = Enum_A_ARG_TYPE_Channel.RF;
break;
case "CF":
Args[i].DataValue = Enum_A_ARG_TYPE_Channel.CF;
break;
case "LFE":
Args[i].DataValue = Enum_A_ARG_TYPE_Channel.LFE;
break;
case "LS":
Args[i].DataValue = Enum_A_ARG_TYPE_Channel.LS;
break;
case "RS":
Args[i].DataValue = Enum_A_ARG_TYPE_Channel.RS;
break;
case "LFC":
Args[i].DataValue = Enum_A_ARG_TYPE_Channel.LFC;
break;
case "RFC":
Args[i].DataValue = Enum_A_ARG_TYPE_Channel.RFC;
break;
case "SD":
Args[i].DataValue = Enum_A_ARG_TYPE_Channel.SD;
break;
case "SL":
Args[i].DataValue = Enum_A_ARG_TYPE_Channel.SL;
break;
case "SR ":
Args[i].DataValue = Enum_A_ARG_TYPE_Channel.SR_;
break;
case "T":
Args[i].DataValue = Enum_A_ARG_TYPE_Channel.T;
break;
case "B":
Args[i].DataValue = Enum_A_ARG_TYPE_Channel.B;
break;
case "Vendor defined":
Args[i].DataValue = Enum_A_ARG_TYPE_Channel.VENDOR_DEFINED;
break;
}
break;
}
}
if(OnResult_SetMute != null)
{
OnResult_SetMute((System.UInt32 )Args[0].DataValue, (Enum_A_ARG_TYPE_Channel )Args[1].DataValue, (System.Boolean )Args[2].DataValue, e, Handle);
}
WeakReference[] w = (WeakReference[])WeakList_SetMute.ToArray(typeof(WeakReference));
foreach(WeakReference wr in w)
{
if(wr.IsAlive==true)
{
((Delegate_OnResult_SetMute)wr.Target)((System.UInt32 )Args[0].DataValue, (Enum_A_ARG_TYPE_Channel )Args[1].DataValue, (System.Boolean )Args[2].DataValue, e, Handle);
}
else
{
WeakList_SetMute.Remove(wr);
}
}
}
示例14: HandleInvoke
protected void HandleInvoke(UPnPService sender, string MethodName, UPnPArgument[] Args, object ReturnValue, object Handle)
{
this.Invoke(new UPnPService.UPnPServiceInvokeHandler(HandleInvokeEx),new object[5]{sender,MethodName,Args,ReturnValue, Handle});
}
示例15: deviceTree_MouseDown
private void deviceTree_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
TreeNode node = deviceTree.GetNodeAt(e.X,e.Y);
if (node == null) return;
deviceTree.SelectedNode = node;
object infoObject = node.Tag;
if (infoObject == null)
{
service = null;
okButton.Enabled = false;
return;
}
if (infoObject.GetType() == typeof(UPnPService))
{
service = (UPnPService)infoObject;
okButton.Enabled = true;
}
else
{
service = null;
okButton.Enabled = false;
}
}