コード例 #1
0
        private void SaveTheRoute_Click(object sender, RoutedEventArgs e)
        {
            var routeName = NewRouteNameBox.Text;

            if (string.IsNullOrEmpty(routeName))
            {
                return;
            }
            if (!_builded)
            {
                MessageBox.Show(
                    TranslationEngine.GetDynamicTranslationString("%ERR_BUILD_THE_ROUTE%", "Build the route first"),
                    "Routing error", MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }
            if (
                _globalSettings.Routes.Any(
                    x => string.Equals(x.Name, routeName, StringComparison.CurrentCultureIgnoreCase)))
            {
                routeName += "_" + DeviceSettings.RandomString(5);
            }
            var route = new BotRoute
            {
                Name      = routeName,
                InitialWp = _mapPoints.Select(x => x.Location).ToList(),
                Route     = new CustomRoute()
                {
                    RoutePoints = new List <GeoCoordinate>(_buildedRoute)
                }
            };

            _globalSettings.Routes.Add(route);
            _globalSettings.Save();
            NewRouteNameBox.Text = string.Empty;
        }
コード例 #2
0
 private void Window_Closing(object sender, CancelEventArgs e)
 {
     _windowClosing = true;
     GlobalCatchemSettings.Save();
     SettingsView.BotMapPage.WindowClosing = true;
     if (Bot == null || _loadingUi)
     {
         return;
     }
     Bot.GlobalSettings.StoreData(SubPath + "\\" + Bot.ProfileName);
     TelegramView.SaveSettings();
     TelegramView.TurnOff();
     foreach (var b in BotsCollection)
     {
         b.Stop();
     }
     MapzenAPI.SaveKnownCoords();
 }