Ejemplo n.º 1
0
        public AndroidApplicationContext(BaseScreen baseActivity, Settings settings, Action loadComplete)
        {
            ApplicationBackground += () => { };
            ApplicationRestore    += () => { };

            GlobalVariables = new Dictionary <string, object>();

            _baseActivity = baseActivity;
            _settings     = settings;
            _loadComplete = loadComplete;

            LocationProvider          = new GpsProvider(_baseActivity);
            LocationTracker           = new GpsTracker(_baseActivity);
            GalleryProvider           = new GalleryProvider(_baseActivity, this);
            CameraProvider            = new CameraProvider(_baseActivity, this);
            DialogProvider            = new DialogProvider(_baseActivity, this);
            DisplayProvider           = new DisplayProvider();
            ClipboardProvider         = new ClipboardProvider(_baseActivity);
            EmailProvider             = new EmailProvider(_settings, _baseActivity);
            JokeProviderInternal      = new JokeProvider(_baseActivity);
            LocalNotificationProvider = new LocalNotificationProvider(_baseActivity);
            WebProvider = new WebProvider(_baseActivity);

            var builder = new SolutionBuilder(this);

            builder.Build();

            _commonData = ValueStackContext.Current.CreateCommonData("Android");
        }
Ejemplo n.º 2
0
 private void SatellitesView_Closed(object sender, EventArgs e)
 {
     if (gps != null)
     {
         gps.Satellite -= GpsSatellite;
         gps            = null;
     }
 }
Ejemplo n.º 3
0
        /// <summary>CTor</summary>
        /// <param name="gps">GPS provider</param>
        public SatellitesView(GpsProvider gps)
        {
            if (gps == null)
            {
                throw new ArgumentNullException("gps");
            }

            this.gps = gps;
            this.gps.Start();
            InitializeComponent();
            gps.Satellite += GpsSatellite;
        }
Ejemplo n.º 4
0
        public void ReadExifGpsMetadata()
        {
            using (WpfFileManager wpfFileManager = new WpfFileManager(this.samplePhotosFolder + TestPhotos.GeotaggedExif1))
            {
                GpsProvider gpsProvider = new GpsProvider(wpfFileManager.BitmapMetadata);

                // Expected 37° 48.41667 N 122° 25.38333 W
                Assert.AreEqual <GpsCoordinate>(gpsProvider.Latitude, new GpsCoordinate(GpsCoordinate.LatitudeRef.North, 37, 48.41667), "Latitude");
                Assert.AreEqual <GpsCoordinate>(gpsProvider.Longitude, new GpsCoordinate(GpsCoordinate.LongitudeRef.East, 122, 25.38333), "Longitude");
                Assert.AreEqual <string>(gpsProvider.DateTimeStamp.ToString("u"), "2009-10-10 21:46:24Z", "Satalite Time");
                Assert.AreEqual <double>(gpsProvider.Altitude, -17.464, "Altitude");
                Assert.AreEqual <GpsPosition.Dimensions>(gpsProvider.MeasureMode, GpsPosition.Dimensions.ThreeDimensional, "Measuremode");
                Assert.AreEqual <string>(gpsProvider.VersionID, "2200", "Gps VersionID");
            }
        }
Ejemplo n.º 5
0
        public ApplicationContext(BaseScreen baseActivity, Settings settings, System.Action loadComplete)
        {
            GlobalVariables = new Dictionary <string, object>();

            _baseActivity = baseActivity;
            _settings     = settings;
            _loadComplete = loadComplete;

            LocationProvider = new GpsProvider(baseActivity);

            LocationTracker = new GPSTracker(baseActivity);

            GalleryProvider = new GalleryProvider(baseActivity);

            CameraProvider = new CameraProvider(baseActivity, this);

            DialogProvider = new DialogProvider(baseActivity, this);

            ClipboardProvider = new ClipboardProvider(baseActivity, this);

            Application.ApplicationContext.InitContext(this);
        }
Ejemplo n.º 6
0
        private void GpsSatellite(GpsProvider sender, GpsSatelliteEventArgs e)
        {
            //Don't want the form to lock up if nothing's happening.
            System.Threading.Thread.Sleep(200);
            if (this.IsDisposed)
            {
                return;
            }
            if (InvokeRequired)
            {
                if ((DateTime.Now - lastGpsSatellite).TotalMilliseconds < 200)
                {
                    return;
                }

                BeginInvoke(new GpsSatelliteEventHandler(GpsSatellite), sender, e);
                return;
            }

            lastGpsSatellite = DateTime.Now;

            List <GpsSatellite> satl = new List <GpsSatellite>();

            foreach (GpsSatellite sat in e.Satellites)
            {
                if (sat.ID != 0)
                {
                    satl.Add(sat);
                }
            }

            if ((lblId == null) || (lblId.Length != satl.Count))
            {
                CreateLabels(satl.Count);
            }

            int i = 0;

            lvwSatellites.Items.Clear();
            foreach (var sat in satl)
            {
                lblId[i].Text       = sat.ID.ToString();
                lblSnr[i].Tag       = sat.SignalToNoiseRatio;
                lblSnr[i].Text      = sat.SignalToNoiseRatio.ToString();
                lblSnr[i].BackColor = GetColorFromSnr(sat.SignalToNoiseRatio, sat.Active);
                lblSnr[i].ForeColor = Color.FromArgb((byte)~lblSnr[i].BackColor.R, (byte)~lblSnr[i].BackColor.G, (byte)~lblSnr[i].BackColor.B);

                ListViewItem itm = new ListViewItem(new[] {
                    sat.ID.ToString(),
                    sat.SignalToNoiseRatio.ToString(),
                    sat.Active.ToString(),
                    sat.Azimuth.ToString(),
                    sat.Elevation.ToString()
                });
                lvwSatellites.Items.Add(itm);

                ++i;
            }

            PosLabels();
            satellites = satl;
            panPosition.Invalidate();
        }