private void ItemView_Click(object sender, RoutedEventArgs e)
        {
            var data = GeolocationData.FromString(((ScenarioModel)DataContext).ScenarioValue);

            if (data.IsEmpty)
            {
                MessageView.ShowMessage(
                    "Данные о геокоординатах пусты...",
                    "Невозможно открыть геокоординаты",
                    Icons.Icon.MapGps);
            }
            else
            {
                // Open through yandex maps
                var browserUrl = @"https://yandex.ru/maps/?mode=whatshere&whatshere%5Bpoint%5D={0}%2C{1}&whatshere%5Bzoom%5D=13";
                var lat        = data.Latitude.ToString().Replace(",", ".");
                var lng        = data.Longtitude.ToString().Replace(",", ".");

                var url = string.Format(browserUrl, lng, lat);

                try
                {
                    Process.Start(url);
                }
                catch
                {
                    Process.Start("IEXPLORE.EXE", url); //crutch
                }
            }
        }
Пример #2
0
        public void RefreshItems(StatisticsItem[] items, DateTime since, DateTime to)
        {
            var scenarios = items.Select(x =>
                                         new LocationsView.ScenarioInfo()
            {
                Id   = x.Target.ID,
                Name = x.Target.Name
            })
                            .Distinct()
                            .ToArray();

            var history = scenarios
                          .Select(x => new LocationsView.GeolocationScenarioHistoryView()
            {
                ScenarioInfo = x,
                Datas        = items
                               .Where(z => z.Target.ID == x.Id)
                               .Select(z => GeolocationData.FromString(z.Value))
                               .Where(z =>
                                      !double.IsNaN(z.Latitude) &&
                                      !double.IsNaN(z.Longtitude) &&
                                      !double.IsInfinity(z.Latitude) &&
                                      !double.IsInfinity(z.Longtitude))
                               .ToArray()
            }).ToArray();

            locationsView.RefreshWith(history);
        }
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     if (value != null)
     {
         return(GeolocationData.FromString(value.ToString()).DateTime.ToString());
     }
     return(string.Empty);
 }
Пример #4
0
        private void ItemView_Click(object sender, EventArgs e)
        {
            var model = (SwitchScenarioModel)BindingContext;
            var data  = GeolocationData.FromString(model.ScenarioValue);
            var label = data.DateTime.ToString() + "\r\n" + model.ScenarioName;

            Singleton.Resolve <IGeolocationView>()?
            .View(new Lazurite.Shared.Geolocation(data.Latitude, data.Longtitude, false), label);
        }
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     try
     {
         if (value != null)
         {
             var dateTime = GeolocationData.FromString(value.ToString()).DateTime;
             return(dateTime.ToShortDateString() + " " + dateTime.ToString("HH:mm"));
         }
         return(string.Empty);
     }
     catch
     {
         return(string.Empty);
     }
 }
        private void ItemView_Click(object sender, EventArgs e)
        {
            var model = (SwitchScenarioModel)BindingContext;
            var data  = GeolocationData.FromString(model.ScenarioValue);

            if (data.IsEmpty)
            {
                Controls.MessageView.Show("Данные о геокоординатах пусты...", LazuriteUI.Icons.Icon.MapGps, DialogView.GetDialogHost(this));
            }
            else
            {
                var label = data.DateTime.ToString() + "\r\n" + model.ScenarioName;
                Singleton.Resolve <IGeolocationView>()?
                .View(new Lazurite.Shared.Geolocation(data.Latitude, data.Longtitude, false), label);
            }
        }
Пример #7
0
        private void ItemView_Click(object sender, RoutedEventArgs e)
        {
            //open through yandex maps
            var browserUrl = @"https://yandex.ru/maps/?mode=whatshere&whatshere%5Bpoint%5D={0}%2C{1}&whatshere%5Bzoom%5D=13";
            var data       = GeolocationData.FromString(((ScenarioModel)DataContext).ScenarioValue);
            var lat        = data.Latitude.ToString().Replace(",", ".");
            var lng        = data.Longtitude.ToString().Replace(",", ".");

            var url = string.Format(browserUrl, lng, lat);

            try
            {
                Process.Start(url);
            }
            catch
            {
                Process.Start("IEXPLORE.EXE", url); //crutch
            }
        }
        public void RefreshItems(ScenarioStatistic[] scenarioStatistics, DateTime since, DateTime to)
        {
            var history =
                scenarioStatistics
                .Select(x => new LocationsView.GeolocationScenarioHistoryView()
            {
                ScenarioInfo = new LocationsView.ScenarioInfo()
                {
                    Id   = x.ScenarioInfo.ID,
                    Name = x.ScenarioInfo.Name
                },
                Datas =
                    x.Statistic
                    .Select(z => GeolocationData.FromString(z.Value))
                    .Where(z =>
                           !double.IsNaN(z.Latitude) &&
                           !double.IsNaN(z.Longtitude) &&
                           !double.IsInfinity(z.Latitude) &&
                           !double.IsInfinity(z.Longtitude))
                    .ToArray()
            }).ToArray();

            locationsView.RefreshWith(history);
        }