private void Connect(string endPointConfigurationName) { _callBack = new Callback(); _channel = new DuplexChannelFactory <ISchedulingHost>(_callBack, endPointConfigurationName); _schedulingCommunicationChannel = _channel.CreateChannel(); _schedulingCommunicationChannel.Subscribe(); _callBack.NewInstanceEvent += new EventHandler(_callBack_NewInstanceEvent); BindingData.Connected = true; }
public frmUnPlanned(ISchedulingHost schedulingHost) { HttpWebRequest request = (HttpWebRequest)WebRequest.Create(@"http://localhost:9000/Profiles"); request.Method = "GET"; request.Accept = "application/json"; request.ContentType = "application/json"; request.Timeout = 999999; request.MaximumResponseHeadersLength = 9999999; ServiceProfile[] profiles = null; try { WebResponse response = request.GetResponse(); using (StreamReader reader = new StreamReader(response.GetResponseStream())) { JsonTextReader jreader = new JsonTextReader(reader); JsonSerializer s = new JsonSerializer(); profiles = s.Deserialize <ServiceProfile[]>(jreader); } } catch (WebException exception) { using (StreamReader reader = new StreamReader(exception.Response.GetResponseStream())) { MessageBox.Show(reader.ReadToEnd()); } } frmUnPlanned.BindingData = new UnPlannedBindingData(profiles); //frmUnPlanned.BindingData = new UnPlannedBindingData(_schedulingHost.GetSchedulingProfiles()); this.DataContext = frmUnPlanned.BindingData; }