示例#1
0
        private static void task7()
        {
            Customer [] customer = new Customer[5];
            customer[0] = new Customer(true, "Ivan");
            customer[1] = new Customer(true, "Pavel");
            customer[2] = new Customer(true, "Nickita");
            customer[3] = new Customer(true, "Uric");
            customer[4] = new Customer(true, "Zhekichan");

            Provider[] providers = new Provider[3];
            providers[0] = new Provider("first", 100);
            providers[1] = new Provider("second", 500);
            providers[2] = new Provider("third", 1000);

            Storage storage = new Storage(customer);

            ProviderAction providerAction = new ProviderAction(providers, storage);
            CustomerAction customerAction = new CustomerAction(customer, storage);
            Thread         myThread1      = new Thread(new ThreadStart(providerAction.start));
            Thread         myThread2      = new Thread(new ThreadStart(customerAction.start));

            myThread1.Start();
            myThread2.Start();
            myThread1.Join();
        }
示例#2
0
 public ProviderEventArgs(ProviderAction action, ERROR_CODES error,
                          string response, WebServer listener, ref HttpListenerContext context)
 {
     Action    = action;
     ErrorCode = error;
     Response  = response;
     Socket    = listener;
     Context   = context;
 }
示例#3
0
 public ProviderEventArgs(ProviderAction action, ERROR_CODES error, T userid,
                          Dictionary <string, string> parameters, string response, WebServer listener, ref HttpListenerContext context)
 {
     Action     = action;
     ErrorCode  = error;
     Response   = response;
     Parameters = parameters;
     Socket     = listener;
     Context    = context;
     UserId     = userid;
 }
示例#4
0
        public void MedicalProviderAction(ProviderAction action, MedicalProvider obj, NavigationService service)
        {
            SelectedProvider = obj;
            switch (action)
            {
                case ProviderAction.MakeCall:
                    PhoneCallTask pct = new PhoneCallTask() { PhoneNumber = obj.PhoneNumber.ToString(), DisplayName = obj.FirstName + " " + obj.LastName };
                    pct.Show();
                    break;
                case ProviderAction.SaveFavorite:
                    if (!Favorites.Any(p => p.Id == obj.Id))
                    {
                        Favorites.Add(obj);
                        SaveFavorites();
                    }
                    break;
                case ProviderAction.DeleteFavorite:
                    if (Favorites.Any(p => p.Id == obj.Id))
                    {
                        Favorites.Remove(obj);
                        SaveFavorites();
                    }
                    break;
                case ProviderAction.Directions:
                    var geoUrl = this.latLongUrl + obj.Id;
                    WebClient wc = new WebClient();
                    wc.OpenReadCompleted += (s, e) =>
                    {
                        var reader = new StreamReader(e.Result);
                        string jsonString = reader.ReadToEnd().ToString();
                        var latLong = JsonConvert.DeserializeObject<LatLong>(jsonString);

                        //Code for just a map
                        //BingMapsTask bingMapsTask = new BingMapsTask();
                        //bingMapsTask.Center = new GeoCoordinate(double.Parse(latLong.Latitude), double.Parse(latLong.Longtitude));
                        //bingMapsTask.ZoomLevel = 2;
                        //bingMapsTask.Show();

                        //Code for driving directions
                        BingMapsDirectionsTask bingMapsDirectionsTask = new BingMapsDirectionsTask();
                        GeoCoordinate endLocation = new GeoCoordinate(double.Parse(latLong.Latitude), double.Parse(latLong.Longtitude));

                        GeoCoordinate startLocation = new GeoCoordinate(33.369824, -111.811588);

                        LabeledMapLocation endLocationLML = new LabeledMapLocation("Dr. " + obj.FirstName + " " + obj.LastName, endLocation);
                        LabeledMapLocation startLocationLML = new LabeledMapLocation("Home", startLocation);

                        bingMapsDirectionsTask.End = endLocationLML;
                        bingMapsDirectionsTask.Start = startLocationLML;
                        bingMapsDirectionsTask.Show();

                    };
                    wc.OpenReadAsync(new Uri(geoUrl));
                    break;
            }
        }