当前位置: 首页>>代码示例>>C#>>正文


C# ServiceClient.GetAllStations方法代码示例

本文整理汇总了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();
    }
开发者ID:afrog33k,项目名称:eAd,代码行数:16,代码来源:MapController.cs

示例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();
//.........这里部分代码省略.........
开发者ID:afrog33k,项目名称:eAd,代码行数:101,代码来源:CustomerPage.xaml.cs


注:本文中的ServiceClient.GetAllStations方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。