public StartViewModel(OrderModel orderModel) { service = new PointOfSaleService(); Model = orderModel; DoneCommand = new DelegateCommand(Done, () => !String.IsNullOrWhiteSpace(Name)); var provider = new LatLongLocationProvider(10000); try { var report = (LatLongLocationReport)provider.GetReport(); service.ReportLocation(report.Latitude, report.Longitude); } catch { service.LocationMalfunction(); } }
public static GeoLocation GetLocation() { var _applicationSettings = CompositionManager.Get<IApplicationSettingsProvider>(); if (_applicationSettings.UseLocation) { if (Loc == null) { var l = new GeoLocation(); //Try grabbing the Win7 location try { if (_loadproviderthrowsexception) return null; if (_provider == null) _provider = new LatLongLocationProvider(DefaultReportInterval); var position = _provider.GetReport() as LatLongLocationReport; if (position == null) return null; l.Latitude = position.Latitude; l.Longitude = position.Longitude; return l; } catch (Exception ex) { CompositionManager.Get<IExceptionReporter>().ReportHandledException(ex); _loadproviderthrowsexception = true; return null; } } } return null; }