Hi,
i am trying to bind the data into data grid from WCF callback services.but i am unable to read data into client side.but i am getting data into WCF call back service implement method.
i have created wcf services like below
[ServiceContract(CallbackContract = typeof(ICalcServiceCallback))]
public interface ICalcService
{
[OperationContract(IsOneWay = true)]
void Calculatedatafrompath(string path, double[] returnPeriods);
}
i have created call back interface like below
public interface ICalcServiceCallback
{
[OperationContract(IsOneWay = true)]
void SendResult(CalcUpdate CalcUpdate);
}
i have implemented ICalcService method like below
public class CalcService:ICalcService
{
public void Calculatedatafrompath(string path, double[] returnPeriods)
{
}<pre>
in wpf application i have created one Wpf window in that window.xaml.cs i have written code below
<pre> public partial class Data : Page
{
private static PMLCalcService.PMLCalcServiceClient Calc;
private static PMLCalcService.IPMLCalcServiceCallback Pml_callback;
DuplexServiceCallBackHandler dd = new DuplexServiceCallBackHandler();
public Data()
{
InitializeComponent();
}
private void PropertiesTabCtrl_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
try
{
if (PropertiesTabCtrl.SelectedItem == tabname)
{
InstanceContext context = new InstanceContext(new DuplexServiceCallBackHandler());
Calc = new CalcService.CalcServiceClient(context, "WSDualHttpBinding_ICalcService");
Calc.Calculatedatafrompath(path, returnPeriods);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
public class DuplexServiceCallBackHandler:PMLCalcService.IPMLCalcServiceCallback
{
void ICalcServiceCallback.SendResult(CalcUpdate CalcUpdate)
{
datainfo = CalcUpdate.data;
if (datainfo != null)
GridData(datainfo );
}
public DataTable GridData(double[] datainfo )
{
double[] d= datainfo;
dt.Columns.Add("ReturnPeriod", typeof(double));
dt.Columns.Add("PML", typeof(double));
for (int d = 0; d < returnPeriods.Count(); d++)
{
DataRow dr = dt_PML.NewRow();
dr[0] = returnPeriods[d];
dr[1] = pmls[d];
dt.Rows.Add(dr);
}
return dt;
}
}
i have implemented DuplexServiceCallBackHandler class in same xaml.cs,here i am getting data in GridData method, but i am unable to read data in
PropertiesTabCtrl_SelectionChanged event.
any one could you please share your solutions to me.
What I have tried:
from past two days i am trying to bind data into wpf data grid,i am getting data into Wcfcallbackservice but i am unable to read data in client side.
past two days i am google it and i tried so many solutions.but it's not worked.