示例#1
0
        private void listViewTrackers_Checked (object sender, RoutedEventArgs e) {
            if (listViewTrackers.ItemsCheckedCount == 0) {
                MapCommand mapCommand = new MapCommand();
                mapCommand.Name = "ClearTracker";
                map.processCommand(webBrowserMap, mapCommand);


                foreach (TrackerData trackerData in trackerDatas) {
                    TrackerData trackerDataItem = trackerData;
                    trackerDatas.TryDequeue(out trackerDataItem);
                }
            }
        }
示例#2
0
        private void MetroWindow_SizeChanged (object sender, SizeChangedEventArgs e) {
            if (this.WindowState == WindowState.Minimized) {
                //MessageBox.Show("Form is mininized");
                // handle it
            }
            if (this.WindowState == WindowState.Normal) {
                //MessageBox.Show("Form is restored");
                // handle it
                MapCommand mapCommand = new MapCommand();
                mapCommand.Name = "CenterMap";
                map.processCommand(webBrowserMap, mapCommand);
            }

            if (this.WindowState == WindowState.Maximized) {
                //MessageBox.Show("Form is maximized");
                // handle it
                MapCommand mapCommand = new MapCommand();
                mapCommand.Name = "CenterMap";
                map.processCommand(webBrowserMap, mapCommand);
            }
        }
示例#3
0
        private void listViewTrackersData_SelectionChanged (object sender, SelectionChangedEventArgs e) {
            ListView listViewTrackersData = (ListView)sender;
            TrackerData trackerData = (TrackerData)listViewTrackersData.SelectedItem;

            try {

                if (trackerData == null)
                    return;
                if (trackerData.IsDataEmpty)
                    return;

                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.Append("[{\"Latitude\":\"");
                stringBuilder.Append(trackerData.Coordinate.latitude.ToString());
                stringBuilder.Append("\",\"Longitude\":\"");
                stringBuilder.Append(trackerData.Coordinate.longitude.ToString());
                stringBuilder.Append("\"}]");
                //stringBuilder.Append("[{\"TrackerId\":\"");
                //stringBuilder.Append(trackerData.Tracker.Id.ToString());
                //stringBuilder.Append("\"}]");

                if (webBrowserMap.IsLoaded) {
                    MapCommand mapCommand = new MapCommand();
                    mapCommand.Name = "SetFocus";
                    mapCommand.Value = stringBuilder.ToString();

                    map.processCommand(webBrowserMap, mapCommand);
                }
            } catch {
            }
        }
示例#4
0
        private void StyleRibbonMenuButtonUser_Click (object sender, RoutedEventArgs e) {
            RibbonMenuItem ribbonMenuItemSender = (RibbonMenuItem)sender;

            userClicked = (UserItem)ribbonMenuItemSender.DataContext;

            comboBoxCollection.Items.Clear();

            listViewTrackersData.ItemsSource = null;
            listViewTrackers.ItemsItemSource = null;


            MapCommand mapCommand = new MapCommand();
            mapCommand.Name = "ClearTracker";
            map.processCommand(webBrowserMap, mapCommand);


            foreach (Collection collection in userClicked.getUser().Collections) {
                comboBoxCollection.Items.Add(collection);
            }
            comboBoxCollection.DisplayMemberPath = "Name";

            ribbonMenuButtonUser.Label = userClicked.Username;
            comboBoxCollection.SelectedIndex = 0;
        }
示例#5
0
        private void asyncPoiUpdate (object obj) {
            Task.Run(() => {

                User selectedUser = (User)obj;

                Dispatcher.BeginInvoke(new Action(() => {
                    while (!webBrowserMap.IsLoaded) {
                        ;
                    }

                    MapCommand mapCommand = new MapCommand();
                    mapCommand.Name = "ClearPoi";
                    mapCommand.Value = "";
                    map.processCommand(webBrowserMap, mapCommand);
                }));

                if (selectedUser.Pois == null)
                    return;

                foreach (Poi poi in selectedUser.Pois) {
                    Dispatcher.BeginInvoke(new Action(() => {
                        while (!webBrowserMap.IsLoaded) {
                            ;
                        }

                        map.loadPoi(webBrowserMap, poi);
                    }));
                }
            });
        }
示例#6
0
        private void asyncGeofenceUpdate (object obj) {
            Task.Run(() => {
                Dispatcher.BeginInvoke(new Action(() => {


                    MapCommand mapCommand = new MapCommand();
                    mapCommand.Name = "ClearGeofence";
                    mapCommand.Value = "";

                    map.processCommand(webBrowserMap, mapCommand);
                }));

                if (company.Geofences == null)
                    return;

                foreach (Geofence geofence in company.Geofences) {
                    Dispatcher.BeginInvoke(new Action(() => {
                        while (!webBrowserMap.IsLoaded) {
                            ;
                        }

                        map.loadGeofence(webBrowserMap, geofence);
                    }));
                }
            });
        }
示例#7
0
文件: Map.cs 项目: rhalf/AtsTqatPro
        public void processCommand(WebBrowser webBrowser, MapCommand mapCommand) {
            if (webBrowser != null) {

                htmlDocument = (mshtml.IHTMLDocument3)webBrowser.Document;

                mshtml.IHTMLElementCollection collection = htmlDocument.getElementsByName("formCommand");

                if (collection.item(name: "formCommand") == null)
                    return;

                foreach (mshtml.HTMLInputElement element in collection.item(name: "formCommand")) {

                    if (element.id == "commandId") {
                        element.value = mapCommand.Id.ToString();
                    }
                    if (element.id == "commandName") {
                        element.value = mapCommand.Name;
                    }
                    if (element.id == "commandValue") {
                        element.value = mapCommand.Value;
                    }
                    if (element.id == "commandSubmit") {
                        mshtml.HTMLInputElement btnSubmit = element;
                        btnSubmit.click();
                    }

                }

            }
        }