有这样的代表:
public delegate void GraphInit(ref DataMedia media);
public delegate void GraphStop(ref DataMedia media);
我想这样使用:
void VideoRenderProcess(object sender, VideoRenderingArgs r_args)
{
DataMedia obj_mdata = sender as DataMedia;
switch (obj_mdata.state)
{
case GraphState.Running:
this.Dispatcher.Invoke(new GraphStop(ref obj_mdata));
break;
......
}
}
VideoRenderingArgs
自行设计的类在哪里:
public class VideoRenderingArgs
{
public string uri { get; set; }
}
// it's just one string, of course I'm planning to add many other details
// which relate to video, but it's other story
GraphStop()
方法是:
void GraphStop(ref DataMedia media)
{
if (media.mre_demux_conf != null) media.mre_demux_conf.WaitOne(2000);
lock (this)
{
if (media.i_main_control != null)
{
media.i_main_control.Stop();
media.state = GraphState.Stopped;
}
}
GraphClean();
}
我收到错误:
'obj_mdata' 是一个“变量”,但在使用
ref
和不使用时都像“方法”一样使用。
如何在 C# 中做我想做的事?