我有一个使用vfw32捕获API的“相机”类。根据APi,我可以通过调用C#
public List<object> getLineChartData(string mobileId_one, string
mobileId_two, string year)
{
//Set up lists
List<object> iData = new List<object>();
List<string> labels = new List<string>();
//Query to database
string query1 = "Select TOP 10 * from AutoregulationScores WHERE
UserID='"+ Session["UID"] +"' ORDER BY ScoreID DESC";
//Call common function get data method
DataTable dtLabels = commonFuntionGetData(query1);
//Get session IDs for x axis labels
foreach (DataRow drow in dtLabels.Rows)
{
labels.Add(drow["SessionID"].ToString());
}
//Add to object list
iData.Add(labels);
//Call common function get data method
DataTable dtDataItemsSets_1 = commonFuntionGetData(query1);
List<int> lst_dataItem_1 = new List<int>();
foreach (DataRow dr in dtDataItemsSets_1.Rows)
{
//Add autoregulation scores to list
lst_dataItem_1.Add(Convert.ToInt32(dr["AutoregulationScore"].ToString())
);
}
//Add to object list
iData.Add(lst_dataItem_1);
return iData;
}
public DataTable commonFuntionGetData(string strQuery)
{
SqlConnection con = new SqlConnection(conString);
SqlDataAdapter dap = new SqlDataAdapter(strQuery, con);
DataSet ds = new DataSet();
dap.Fill(ds);
return ds.Tables[0];
}
HTML + JavaScript
<div> <canvas id="myChart"> </canvas></div>
<script>
var aData = reponse.d;
var aLabels = aData[0];
var aDatasets1 = aData[1];
var data = {
labels: aLabels,
datasets: [{
label: "My First dataset",
fillColor: "rgba(220,220,220,0.2)",
strokeColor: "rgba(220,220,220,1)",
pointColor: "rgba(220,220,220,1)",
pointStrokeColor: "#fff",
pointHighlightFill: "#fff",
pointHighlightStroke: "rgba(220,220,220,1)",
data: aDatasets1
}]
};
var ctx = $("#myChart").get(0).getContext('2d');
ctx.canvas.height = 300; // setting height of canvas
ctx.canvas.width = 500; // setting width of canvas
var lineChart = new Chart(ctx).Line(data, {
bezierCurve: false});
function OnErrorCall_(repo) {
alert("Woops something went wrong, pls try later !");
};
</script>
来设置捕获过程的回调函数。我将capSetCallbackOnFrame
回调定义为lambda:
OnCapture
除了LPVIDEOHDR的dwUser之外,user_data的回调声明中没有其他位置,但是我不知道如何在调用之前进行修改。
如何在此回调中使用类的成员而不将其声明为静态(而回调本身没有静态)?