예제 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            LocationWrapper lw = new LocationWrapper(SelectedLocation);

            if (SelectedLocation == null)
            {
                SelectedLocation = lw.location;
            }

            double d;

            SelectedLocation.CityName       = textBox1.Text;
            SelectedLocation.CountryISOCode = (comboBox1.SelectedItem as TCountry).ISOCode;
            ToDouble(textBox2.Text, out d, 'N', 'S');
            SelectedLocation.Latitude = d;
            ToDouble(textBox3.Text, out d, 'E', 'W');
            SelectedLocation.Longitude = d;
            TTimeZone tz = comboBox2.SelectedItem as TTimeZone;

            SelectedLocation.TimeZone = tz;

            if (OnEditLocationDone != null)
            {
                OnEditLocationDone(lw, e);
            }

            Controller.RemoveFromContainer();
        }
예제 #2
0
        public LocationSelectorPage(LocationWrapper locationWrapper, Action callOnFinished, List <int> idsToSkip = null)
        {
            this.BackgroundColor     = PageColors.secondaryColor;
            this.Content             = mainScrollLayout;
            mainScrollLayout.Content = mainLayout;

            this.Title = "Choose a location";



            foreach (StorageLocation location in DatabaseHandler.GetDatabase().GetLocations().ToList())
            {
                if (idsToSkip != null && idsToSkip.Contains(location.GetId()))
                {
                }
                else
                {
                    Action onTap = () =>
                    {
                        locationWrapper.Location = location;
                        Navigation.PopAsync();
                        callOnFinished.Invoke();
                    };
                    mainLayout.Children.Add(new LocationsPanelView(location, LocationsView.LocationImageWidth, LocationsView.LocationImageWidth, onTap));
                }
            }
        }
예제 #3
0
        public List <StoreDTO> SearchStores(int?maxResults = null, LocationWrapper locationWrapper = null)
        {
            try
            {
                List <Store> stores = null;

                if (locationWrapper != null)
                {
                    stores = _storeRepository.Get(_context,
                                                  e =>
                                                  e.Latitude < locationWrapper.FromLatitude &&
                                                  e.Latitude > locationWrapper.ToLatitude &&
                                                  e.Longitude < locationWrapper.FromLongitude &&
                                                  e.Longitude > locationWrapper.ToLongitude
                                                  ).OrderBy(e => e.Top).ToList();
                }
                else
                {
                    stores = _storeRepository.Get(_context).OrderBy(e => e.Top).ToList();
                }

                if (maxResults != null)
                {
                    stores = stores.Take(maxResults.Value).ToList();
                }

                return(_Mapper.Map <List <StoreDTO> >(stores));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #4
0
파일: HomeForm.cs 프로젝트: aolien/noIdeas
        public HomeForm(string username)
        {
            InitializeComponent();
            this.Text = username;

            // Firts we need to get GPS coordinates

            // Prepare the location API.
            this.locationWrapper = LocationWrapper.GetInstance();
            this.locationWrapper.ApplicationGuid = Program.ApplicationId;

            // Allow 5 seconds to generate each location fix.
            this.locationWrapper.AllowedTime = TimeSpan.FromSeconds(5);

            // Location fixes will be at least 1 second apart.
            this.locationWrapper.Interval = TimeSpan.FromSeconds(1);

            this.locationWrapper.LocationUpdated += new LocationUpdatedEventHandler(this.OnLocationUpdated);
            // Start it
            this.locationWrapper.StartUpdating();

            ThreadStart start = new ThreadStart(this.UpdateGPSCoordinates);
            Thread gpsThread = new Thread(start);
            gpsThread.Start();

            Cursor.Current = Cursors.Default;
        }
 public LocationDetails(Object selectedItem, IDataRepository productService)
 {
     dataRepository = productService;
     if (selectedItem != null)
     {
         this.Edit = new Binding(EditLocation);
         LocationListModel item     = (LocationListModel)selectedItem;
         int             locationID = item.Id;
         LocationWrapper location   = dataRepository.GetLocation(locationID);
         currentLocation = new LocationListDetailModel(location.LocationID, location.Name, location.CostRate, location.Availability, location.ModifiedDate);
     }
 }
예제 #6
0
 public ActionResult <List <StoreViewModel> > Search([FromQuery] LocationWrapper locationWrapper, int?maxResults)
 {
     try
     {
         List <StoreDTO>       stores       = _storeService.SearchStores(maxResults, locationWrapper);
         List <StoreViewModel> mappedStores = _Mapper.Map <List <StoreViewModel> >(stores);
         return(Ok(mappedStores));
     }
     catch (Exception ex)
     {
         return(BadRequest(new { message = "Unexpected error" }));
     }
 }
예제 #7
0
            public MyCameraHandler(MainActivity activity)
            {
                Activity = activity;

                _lastKnownLocation = new LocationWrapper(null);
                _locationProvider  = new MyLocationListener(activity);
                _locationProvider.OnLocationUpdated += HandleLocationUpdated;

                _uploader = new PhotoUploader();
                _uploader.OnStateChanged += SetNetworkStatus;

                _handlerThread = new HandlerThread("MyCameraHandler");
                _handlerThread.Start();
            }
예제 #8
0
 public static void Test(out LocationWrapper member)
 {
     member.location.x = 0;
     member.location.y = member.location.x;
 }
예제 #9
0
파일: test-923.cs 프로젝트: Profit0004/mono
	public static void Test (out LocationWrapper member)
	{
		member.location.x = 0;
		member.location.y = member.location.x;
	}
예제 #10
0
 private void HandleLocationUpdated(Location loc)
 {
     _lastKnownLocation = new LocationWrapper(loc);
     SetLocationText(loc.ToString());
 }
예제 #11
0
        //makes the menu page to open
        private PopupPageMenu MakeMenuPage()
        {
            PopupPageMenu menu = new PopupPageMenu();


            //move location menu button
            Grid moveLocationGrid = menu.AddLabelAndImage("Move Location", "move_to_location");
            TapGestureRecognizer moveLocationGesture = new TapGestureRecognizer();

            LocationWrapper locationWrapper = new LocationWrapper();

            //to call when the location is selected
            Action callOnMoveSelected = () =>
            {
                if (locationWrapper.Location != null)
                {
                    MoveHighlightedContainers(locationWrapper.Location);
                    PopupNavigation.Instance.PushAsync(new PopupTextNotification("Containers moved"));
                    location = DatabaseHandler.GetDatabase().GetLocation(location.GetId());
                    MasterNavigationPage.current.Refresh();
                }
            };


            moveLocationGesture.Tapped += (sen, e) =>
            {
                PopupNavigation.Instance.PopAsync();
                if (DatabaseHandler.GetDatabase().GetLocations().Count <= 1) //if there arent enough locations to move, display an error
                {
                    PopupNavigation.Instance.PushAsync(new PopupErrorNotification("You need more locations to do that"));
                }
                else
                {
                    Navigation.PushAsync(new LocationSelectorPage(locationWrapper, callOnMoveSelected, new List <int>()
                    {
                        location.GetId()
                    }));
                }
            };
            moveLocationGrid.GestureRecognizers.Add(moveLocationGesture);


            //delete item menu button
            Grid deleteContainerGrid = menu.AddLabelAndImage("Delete Containers", "trash");
            TapGestureRecognizer deleteContainerGesture = new TapGestureRecognizer();

            deleteContainerGesture.Tapped += (sen, e) =>
            {
                if (CanDelete()) //if can delete - delete, else give error messxage
                {
                    Delete();
                    PopupNavigation.Instance.PopAsync();
                    PopupNavigation.Instance.PushAsync(new PopupTextNotification("Containers's deleted"));
                }
                else
                {
                    PopupNavigation.Instance.PushAsync(new PopupErrorNotification("Unable to delete"));
                }
            };
            deleteContainerGrid.GestureRecognizers.Add(deleteContainerGesture);


            return(menu);
        }