本文整理汇总了C#中ServiceClient.GetAllStations方法的典型用法代码示例。如果您正苦于以下问题:C# ServiceClient.GetAllStations方法的具体用法?C# ServiceClient.GetAllStations怎么用?C# ServiceClient.GetAllStations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ServiceClient
的用法示例。
在下文中一共展示了ServiceClient.GetAllStations方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Index
//
// GET: /Map/
public ActionResult Index(int stationID)
{
var mapRepository = new MapRepository();
ServiceClient myService = new ServiceClient();
myService.ClientCredentials.Windows.ClientCredential.UserName = "admin";
myService.ClientCredentials.Windows.ClientCredential.Password = "Green2o11";
var stations = myService.GetAllStations().Where(s=>s.StationID==stationID);
// var map = mapRepository.GetById(stationID);
GoogleMaps.Locations = stations.ToArray();
ViewBag.Map = (GoogleMaps.Webpage);
return View();
}
示例2: Update
public void Update(int milliseconds)
{
ThreadPool.QueueUserWorkItem(
(state) =>
{
// Thread.Sleep(50);
try
{
// var items = myService.GetRecords().Select(p => p.Name);
Instance.Dispatcher.BeginInvoke(
System.Windows.Threading.DispatcherPriority.Normal
, new DispatcherOperationCallback(delegate
{
try
{
using (
ServiceClient myService2 = new ServiceClient("BasicHttpBinding_IService",
Constants.ServerAddress))
{
myService2.ClientCredentials.Windows.ClientCredential.UserName = "admin";
myService2.ClientCredentials.Windows.ClientCredential.Password = "Green2o11";
var customer = myService2.GetCustomerByRFID(CurrentRFID);
var stations = myService2.GetAllStations();
// LocationOverview.ItemsSource = items;
try
{
var image = new BitmapImage();
int BytesToRead=100;
WebRequest request = WebRequest.Create(new Uri( customer.Picture, UriKind.Absolute));
request.Timeout = -1;
WebResponse response = request.GetResponse();
Stream responseStream = response.GetResponseStream();
BinaryReader reader = new BinaryReader(responseStream);
MemoryStream memoryStream = new MemoryStream();
byte[] bytebuffer = new byte[BytesToRead];
int bytesRead = reader.Read(bytebuffer, 0, BytesToRead);
while (bytesRead > 0)
{
memoryStream.Write(bytebuffer, 0, bytesRead);
bytesRead = reader.Read(bytebuffer, 0, BytesToRead);
}
image.BeginInit();
memoryStream.Seek(0, SeekOrigin.Begin);
image.StreamSource = memoryStream;
image.EndInit();
CustomerProfilePicture.Source = image;
}
catch (Exception)
{
//Default no pic pic
}
CarMake.Content = customer.CarMake;
CarModel.Content = customer.CarModel;
CarPlate.Content = customer.CarLicense;
CustomerName.Content = (customer).Name;
CustomerEmail.Content = customer.Email;
CustomerPhone.Content = customer.Phone;
CustomerAddress.Content = customer.Address;
try
{
var charge = customer.ChargeRemaining;
if (charge == null)
charge = "0";
CurrentCharge.Content = charge;
BatteryAnimation.PercentCharged = Convert.ToInt32(charge);
LastCharged.Content = customer.LastRechargeDate;
AccountBalance.Content = customer.AccountBalance;
}
catch(Exception ex)
{}
StationOverview.ItemsSource = stations;
GoogleMaps.Locations = stations.ToArray();
// .Content = (customer).Name;
NavigatePage();
//.........这里部分代码省略.........