Exemplo n.º 1
0
        private async void ImportStepEnd()
        {
            StopImport();

            _tripNumberUser++;
            _distanceCurrent = Distance;

            foreach (String _country in _tripImport.GetCountriesList())
            {
                _tripImport.Summary.AddCountry(_country);
            }

            if (_app.AppSettings.LearnInProgress("TOPIC_SAMPLE_A"))
            {
                _app.AppSettings.LearnDone("TOPIC_SAMPLE_A");
                foreach (TripDescUserControl _tripdesc in _listTripDesc)
                {
                    if (_tripdesc.DefBlockTrip.SampleId == 1)
                    {
                        await DeleteTrip(_tripdesc, false);

                        break;
                    }
                }
            }

            if (_app.AppSettings.LearnInProgress("TOPIC_SAMPLE_B"))
            {
                _app.AppSettings.LearnDone("TOPIC_SAMPLE_B");
                Toast.DisplayTwoLines(_res.GetString("FirstImport"), _res.GetString("SampleRemoved"), "Icons/toastImageAndText.png");
                foreach (TripDescUserControl _tripdesc in _listTripDesc)
                {
                    if (_tripdesc.DefBlockTrip.SampleId == 2)
                    {
                        await DeleteTrip(_tripdesc, true);

                        break;
                    }
                }
            }
            _app.AppSettings.LearnDone("TOPIC_SWIPE_ADD");

            _listSummary.Add(_tripImport.Summary);

            // save trip and summary
            await SaveSummary();

            // displayed trip description block
            TripDescUserControl blk = new TripDescUserControl(this, _app.AppSettings.GetConfig("CONFIG_MILES"), _app.AppSettings.ThemeColors);

            blk.DefBlockTrip = _tripImport.Summary;
            _listTripDesc.Insert(0, blk);

            txtDistance.Text = Gps.GetDistanceFormat(Distance, _app.AppSettings.GetConfig("CONFIG_MILES"));
            rewards();
        }
Exemplo n.º 2
0
        private void ConfigSwitchChanged_callback(object sender, RoutedEventArgs args)
        {
            ToggleSwitch _input = sender as ToggleSwitch;

            if (_input.Name.Equals("CONFIG_MILES"))
            {
                foreach (TripDescUserControl _userControl in _listTripDesc)
                {
                    _userControl.UpdateDistance(_input.IsOn);
                }

                txtDistance.Text = Gps.GetDistanceFormat(Distance, _input.IsOn);
            }
        }
Exemplo n.º 3
0
        private void rewards()
        {
            loadCountries();

            if (_listSummary.Count > 0)
            {
                TileHomePage.UpdateDisplay(
                    _res.GetString("AppName"),
                    "ms-appx:///Square310x310Logo.scale-100.png",
                    _listSummary.Last <TripSummary>().Sample,
                    _listSummary.Last <TripSummary>().PathThumb,
                    _listSummary.Last <TripSummary>().PicturesThumb,
                    _listCountries);
            }
            else
            {
                TileHomePage.UpdateDisplay(
                    _res.GetString("AppName"),
                    "ms-appx:///Square310x310Logo.scale-100.png",
                    false, null, null, null);
            }

            if (_listCountries.Count == 0)
            {
                txtCountriesNumber.Visibility = Visibility.Collapsed;
            }
            else
            {
                txtCountriesNumber.Visibility = Visibility.Visible;
                txtCountriesNumber.Text       = _listCountries.Count + " " + _res.GetString("CountriesVisited");
            }

            if (Distance == 0)
            {
                txtDistance.Visibility = Visibility.Collapsed;
            }
            else
            {
                txtDistance.Text       = Gps.GetDistanceFormat(Distance, _app.AppSettings.GetConfig("CONFIG_MILES"));
                txtDistance.Visibility = Visibility.Visible;
            }
        }
Exemplo n.º 4
0
        public MarkerPosition(FrameworkElement view, MapUIElementCollection _element, object _tag, object Icon, GpsLocation pos, Boolean _visible, int _size)
        {
            _location   = pos;
            _viewParent = view;

            _image = new Image();
            _icon  = Icon;

            if (Icon is EIcon)
            {
                _albumIcon    = (EIcon)Icon;
                _image.Source = ImageFromRelativePath(view, GetIconInactive(_albumIcon));
            }
            else if (Icon is BitmapImage)
            {
                _image.Source = Icon as BitmapImage;
            }
            else if (Icon is String)
            {
                _image.Source = ImageFromRelativePath(view, Icon as String);
            }

            _elementUI = _element;

            try
            {
                _image.Width   = _size;
                _image.Height  = _size;
                _image.Tag     = _tag;
                _image.Tapped += image_Tapped;

                MapLayer.SetPosition(_image, Gps.ConvertGpsToLoc(_location));

                if (Icon is BitmapImage)
                {
                    MapLayer.SetPositionAnchor(_image, GetOffsetImage(2));
                }
                else
                {
                    MapLayer.SetPositionAnchor(_image, GetOffsetImage(1));
                }

                _elementUI.Add(_image);

#if DEBUG
                if (_tag != null)
                {
                    _legend = new TextBlock();

                    if (_tag is Country)
                    {
                        _legend.Text = (_tag as Country).Name.ToString();
                    }
                    else
                    {
                        _legend.Text = _tag.ToString();
                    }

                    _legend.Foreground = new SolidColorBrush(Windows.UI.Colors.White);

                    MapLayer.SetPosition(_legend, Gps.ConvertGpsToLoc(_location));
                    MapLayer.SetPositionAnchor(_legend, GetOffsetLegend());
                    _elementUI.Add(_legend);
                }
#else
                _legend = null;
#endif

                if (!_visible)
                {
                    Hide();
                }
                else
                {
                    Show();
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message);
            }
        }
Exemplo n.º 5
0
 public void UpdateDistance(Boolean _unitMiles)
 {
     Distance.Text = Gps.GetDistanceFormat(DefBlockTrip.Distance, _unitMiles);
 }