private static MapViewModel _createInstance()
        {
            CredentialsProvider credentialsProvider = new ApplicationIdCredentialsProvider(Resources.BingApplicationId);
            MapViewModel        vm = new MapViewModel(credentialsProvider, LinienMapperFactory.Instance);

            return(vm);
        }
Exemplo n.º 2
0
 public BAMap()
 {
     CredentialsProvider =
         new ApplicationIdCredentialsProvider("At_JDYOOWWeOlg8s03wdUsbgMwFg4Xh7VnYEpE2VyfGbeuP27MO83TVtvhUX-WDB");
     SizeChanged   += BAMap_SizeChanged;
     ViewChangeEnd += BAMap_ViewChangeEnd;
 }
Exemplo n.º 3
0
 public MainWindow()
 {
     this.DataContext = this;
     Provider         = new ApplicationIdCredentialsProvider(Key);
     InitializeComponent();
     GetBusses();
 }
Exemplo n.º 4
0
 public MapViewModel(ILocationManager locationManager, ApplicationIdCredentialsProvider credentials)
 {
     _locationManager = locationManager;
     _credentials     = credentials;
     _locationManager.OnNewPositionReceived += new EventHandler <NewLocationEventArgs>(_locationManager_OnNewPositionReceived);
     _userPositions = new ObservableCollection <LocationDto>();
     _mapCenter     = new LocationDto();
 }
Exemplo n.º 5
0
        public MainWindow()
        {
            InitializeComponent();

            ApplicationIdCredentialsProvider provider = new ApplicationIdCredentialsProvider(appID);

            MainMap.CredentialsProvider = provider;
        }
Exemplo n.º 6
0
        public MapView()
        {
            InitializeComponent();
            ApplicationIdCredentialsProvider applicationIdCredentialsProvider = new ApplicationIdCredentialsProvider(GetBingKey());

            myBingMap.CredentialsProvider = applicationIdCredentialsProvider;
            this.DataContext = new MapViewModel(new MapStyle(this.myBingMap, (IEventAggregator)((ShellViewModel)IoC.Get <IShell>())._events), (IEventAggregator)((ShellViewModel)IoC.Get <IShell>())._events);
        }
Exemplo n.º 7
0
        public MainWindow()
        {
            InitializeComponent();
            this.DataContext = this;

            var appId    = ConfigurationManager.AppSettings["BingToken"];
            var serverIp = IPAddress.Parse(ConfigurationManager.AppSettings["ServerIp"]);

            Provider = new ApplicationIdCredentialsProvider(appId);
        }
Exemplo n.º 8
0
 public MainWindow()
 {
     this.DataContext = this;
     Provider         = new ApplicationIdCredentialsProvider(Key);
     InitializeComponent();
     GetBusses();
     Timer          = new Timer();
     Timer.Interval = 1000;
     Timer.Elapsed += Timer_Elapsed;
     Timer.Start();
 }
Exemplo n.º 9
0
        public MainWindow()
        {
            InitializeComponent();
            // var appId = "PGgXDxXtbqJFb22FYOW4~V9ZWj-mMArtwhcHO7OXOyA~Amvufht9v-dLEV-Fp360l5Jk0Lwhvc8UUO9DNGeO0BMQj3ziwsNsDQADV1M-iewb";

            var appId    = ConfigurationManager.AppSettings["BingToken"];
            var serverId = IPAddress.Parse(ConfigurationManager.AppSettings["ServerIp"]);

            this.DataContext = this;
            Provider         = new ApplicationIdCredentialsProvider(appId);
        }
Exemplo n.º 10
0
        private void Timer_Tick(object sender, EventArgs e)
        {
            Provider    = new ApplicationIdCredentialsProvider(ConfigurationManager.AppSettings["ApiKey"]);
            _busService = new BakuBusService();

            if (BusNo == null)
            {
                BusNo = "General list";
            }

            Buses = new ObservableCollection <Bus>(_busService.GetAllBusesByRouteCode(BusNo));
        }
Exemplo n.º 11
0
        private void InitMap()
        {
#if DEBUG
            const string ApplicationId = "AowW0iJ0e0NvTAK6zwfWndOq7iRI4pOPq_J0900nALiBApXxD3foFjYhVnFAqsoZ";
#else
            const string ApplicationId = "qOVqChND2iM7kDwLF8Ef~04jjBqlip6uMVpV-ke9waA~Aknrqgl_hcqEE8DRmjSBmYBeaOlq0sXZBaryxnmTEtcPRVe7HjUojZe72O2bSE-W";
#endif

            ApplicationIdCredentialsProvider credentials = new ApplicationIdCredentialsProvider(ApplicationId);
            BingMap.CredentialsProvider = credentials;

            GPS = true;
        }
Exemplo n.º 12
0
        protected override void Configure()
        {
            var db      = new LocationContext(ConnectionString);
            var context = CreateDataBaseIfNeeded(db);

            var locationRepository = new LocationRepository(context);
            var locationManager    = new LocationManager(locationRepository);
            var bingMapProvider    = new ApplicationIdCredentialsProvider("AuxNBnpoOmnhUmUoL2a8xcc5z6B1eK_58NBtUEUaIuHkuKpHQDmVRxaB7lw_uuye");

            Container.Current.RegisterInstance(bingMapProvider);
            Container.Current.RegisterInstance <ILocationContext>(context);
            Container.Current.RegisterInstance <ILocationRepository>(locationRepository);
            Container.Current.RegisterInstance <ILocationManager>(locationManager);
        }
        public StartViewModel()
        {
            string APIKey = ConfigurationManager.AppSettings["BingAPIKEY"];

            Provider     = new ApplicationIdCredentialsProvider(APIKey);
            BusServices  = new BusServices();
            AllBusesData = BusServices.GetBuses();
            Buses        = AllBusesData;

            BusNumbers = BusServices.GetBusNumbers();
            BusNumber  = BusNumbers[0];

            SelectionChangedCommand = new RelayCommand(OnSelectionChanged);
        }
Exemplo n.º 14
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            if ((e.InitParams != null) && (e.InitParams.ContainsKey("BaseServiceUrl")))
            {
                Resources.Add("BaseServiceUrl", e.InitParams["BaseServiceUrl"]);
            }

            ApplicationIdCredentialsProvider credentialsProvider = new ApplicationIdCredentialsProvider();

            if ((e.InitParams != null) && (e.InitParams.ContainsKey("BingMapsKey")))
            {
                credentialsProvider.ApplicationId = e.InitParams["BingMapsKey"];
            }

            this.Credentials = credentialsProvider;
            this.RootVisual  = new MasterLayoutControl();

            //Set default system settings if no settings exist.
            ProxyClient.SetDefaultSystemSettings(false);
        }
Exemplo n.º 15
0
        public MapViewModel(ProjectModel model)
        {
            BingMapsCredentialsProvider bingMapsCredentials = new BingMapsCredentialsProvider();

            this.bingMapsCredentials = new ApplicationIdCredentialsProvider(bingMapsCredentials.Key);

            this._projectId                = model.ProjectId;
            this._currentProject           = model;
            this._imageLocations           = new ImageAtLocationCollection();
            this._unassignedImageLocations = new ImageAtLocationCollection();

            // Set this to capture the change events
            this._filteredUnassignedImageLocations.CollectionChanged += _unassignedImageLocations_CollectionChanged;

            App.MapVM = this; // Need this as this is not set until after the constructor is complete

            // Create first load of content
            Tuple <int, int, int> data = AssignmentIndexer.LoadImagesFromDatabase(this._projectId);
            int numAvailableImages     = data.Item1 + data.Item2;

            StatusText += string.Format("{0} Images loaded from database, where {1} are missing GPS information.\r\n",
                                        numAvailableImages, data.Item2);

            // Print error text that some images could not be found or is erased
            if (data.Item3 > 0)
            {
                StatusText += string.Format("{0} Images could no longer be found. They are either moved or erased.\r\n", data.Item3);
            }

            this.ApplyImageFilters();

            if (numAvailableImages == 0)
            {
                //this.StartIndexBackgroundworker(model);
                //this.StartIndexingAsync(model);
                Task.Delay(800).ContinueWith(
                    t => this.StartIndexBackgroundworker(model)
                    );
            }
        }
Exemplo n.º 16
0
        /// <summary>
        /// This is the constructor for the MapRouteViewModel
        /// </summary>
        /// <param name="data">A DataProvider object to read the data from</param>
        public MapRouteViewModel(DataProvider data)
        {
            _data = data;

            _mapPolylines = new List <MapPolyline>();

            maker = new RouteMaker();

            MapZoomLevel = 12.6;

            if (_data.Route.Count > 0)
            {
                MapCenter = _data.Route.First();
            }
            else
            {
                MapCenter = new Location(48.236096, 14.188624);
            }

            //  set the api key read from the key file
            APIKey = new ApplicationIdCredentialsProvider(data.APIKey);
        }
Exemplo n.º 17
0
        /// <summary>
        /// This is the constructor for the MapTimedViewModel
        /// </summary>
        /// <param name="data">A DataProvider object to read the data from</param>
        public MapTimedViewModel(DataProvider data)
        {
            _data = data;

            maker         = new RouteMaker();
            _mapPolylines = new List <MapPolyline>();

            //set the api key read from the key file
            APIKey = new ApplicationIdCredentialsProvider(data.APIKey);

            MapZoomLevel = 12.6;

            if (_data.Route.Count > 0)
            {
                MapCenter = _data.Route.First();
            }
            else
            {
                MapCenter = new Location(48.236096, 14.188624);
            }

            slMaximum = _data.Route.Count() - 1;
            if (slMaximum < 1000)
            {
                slTickFrequency = 2;
            }
            if (slMaximum > 1000 && slMaximum < 10000)
            {
                slTickFrequency = 10;
            }
            if (slMaximum > 10000 && slMaximum < 1000000)
            {
                slTickFrequency = 500;
            }
            if (slMaximum > 1000000)
            {
                slTickFrequency = 2000;
            }
        }
Exemplo n.º 18
0
        public MainViewModel()
        {
            Provider    = new ApplicationIdCredentialsProvider(ConfigurationManager.AppSettings["ApiKey"]);
            _busService = new BakuBusService();
            Buses       = new ObservableCollection <Bus>(_busService.GetAllBuses());

            SearchCommand = new RelayCommand(SearchCommandExecute);

            List <string> buses = new List <string>();

            buses.Add("General list");
            foreach (var item in Buses)
            {
                buses.Add(item.RouteCode);
            }
            BusesRouteCodes = buses.Distinct().ToList();


            var timer = new DispatcherTimer();

            timer.Interval = TimeSpan.FromSeconds(10);
            timer.Tick    += Timer_Tick;
            timer.Start();
        }
 private static MapViewModel _createInstance()
 {
     CredentialsProvider credentialsProvider = new ApplicationIdCredentialsProvider(Resources.BingApplicationId);
     MapViewModel vm = new MapViewModel(credentialsProvider, LinienMapperFactory.Instance);
     return vm;
 }
Exemplo n.º 20
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            if ((e.InitParams != null) && (e.InitParams.ContainsKey("BaseServiceUrl")))
                Resources.Add("BaseServiceUrl", e.InitParams["BaseServiceUrl"]);

            ApplicationIdCredentialsProvider credentialsProvider = new ApplicationIdCredentialsProvider();
            if ((e.InitParams != null) && (e.InitParams.ContainsKey("BingMapsKey")))
                credentialsProvider.ApplicationId = e.InitParams["BingMapsKey"];

            this.Credentials = credentialsProvider;
            this.RootVisual = new MasterLayoutControl();

            //Set default system settings if no settings exist.
            ProxyClient.SetDefaultSystemSettings(false);
        }
        public MainViewModel()
        {
            Provider = new ApplicationIdCredentialsProvider(APIKey);


            responseMessage = Client.GetAsync($@"{apiLink}").Result;
            var str = responseMessage.Content.ReadAsStringAsync().Result;

            Data = JsonConvert.DeserializeObject(str);


            GetBusList = new List <Bus>();
            SetBusList = new List <Bus>();

            foreach (var item in Data.BUS)
            {
                dynamic busatribute = item["@attributes"];



                GetBusList.Add(new Bus
                {
                    BUS_ID             = busatribute["BUS_ID"],
                    PLATE              = busatribute["PLATE"],
                    CURRENT_STOP       = busatribute["CURRENT_STOP"],
                    PREV_STOP          = busatribute["PREV_STOP"],
                    SPEED              = busatribute["SPEED"],
                    BUS_MODEL          = busatribute["BUS_MODEL"],
                    LATITUDE           = busatribute["LATITUDE"],
                    LONGITUDE          = busatribute["LONGITUDE"],
                    ROUTE_NAME         = busatribute["ROUTE_NAME"],
                    LAST_UPDATE_TIME   = busatribute["LAST_UPDATE_TIME"],
                    DISPLAY_ROUTE_CODE = busatribute["DISPLAY_ROUTE_CODE"],
                    SVCOUNT            = busatribute["SVCOUNT"],
                    ImagePath          = "../Images/Bus vehicle 1.jpg",
                });


                var xml = new XmlSerializer(typeof(List <Bus>));
                using (var fs = new FileStream("../file.xml", FileMode.OpenOrCreate))
                {
                    xml.Serialize(fs, GetBusList);
                }
            }



            FindCommand = new RelayCommand((e) =>
            {
                if (MainWindows.BusNumberCombobox.SelectedIndex != -1)
                {
                    int index = 0;



                    index = MainWindows.BusNumberCombobox.SelectedIndex;

                    var f = GetBusList[index].BusInfo;



                    if (f == String.Empty)
                    {
                        SetBusList = GetBusList;
                    }

                    else
                    {
                        Binding bindings             = new Binding();
                        bindings.Path                = new PropertyPath("SetBusList");
                        bindings.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
                        MainWindows.MapItem.SetBinding(MapItemsControl.ItemsSourceProperty, bindings);



                        SetBusList = new List <Bus>(GetBusList.Where(x => x.BusInfo == f));

                        SetBusList.ForEach(y => MessageBox.Show(y.BusInfo));
                    }
                }
            });
        }