コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: wojka/PER-App
        private void DeletepositionBT_Click(object sender, RoutedEventArgs e)
        {
            if (choosendupa == null)
            {
                return;
            }

            /*  foreach (Pushpin child in this.PERMap.Children)
             * {
             *   if ((string)child.Content == choosendupa.name)
             *   {
             *       this.PERMap.Children.Remove(child);
             *       break;
             *   }
             * }
             */

            dupalist.Remove(choosendupa);
            choosendupa = null;
            RaisePropertyChanged("dupalist");
            //duuuppaa.UpdateLayout();
            duuuppaa.Items.Refresh();

            RaisePropertyChanged("PERMap");
            //TypeDescriptor.Refresh(PERMap);
        }
コード例 #2
0
ファイル: MainWindow.xaml.cs プロジェクト: wojka/PER-App
        public MainWindow()
        {
            InitializeComponent();

            DataContext = this;

            LoraSerialPort             = new SerialPort();
            LoraSerialPort.PortName    = "COM20";
            LoraSerialPort.BaudRate    = 115200;
            LoraSerialPort.ReadTimeout = 200;
            LoraSerialPort.Open();

            readThreadLora = new Thread(ReadFromLora);
            readThreadLora.IsBackground = true;
            readThreadLora.Start();


            dupalist    = new List <PERLocation>();
            choosendupa = null;
            //choosendupa = new PERLocation();

            ComboBox locationsList = new ComboBox();


            foreach (string file in Directory.EnumerateFiles(directoryPath, "*.txt"))
            {
                string [] data = File.ReadAllLines(file);

                Pushpin PERpushpin = new Pushpin();

                string[] cordinates      = data[0].Split(' ');
                double[] cordinatesDoube = new double[2];

                cordinatesDoube[0] = Convert.ToDouble(cordinates[0]);
                cordinatesDoube[1] = Convert.ToDouble(cordinates[1]);

                Location PERlocation = new Location(cordinatesDoube[0], cordinatesDoube[1]);

                PERpushpin.SetValue(MapLayer.PositionProperty, PERlocation);

                string fileName = file.Remove(0, file.LastIndexOf(@"\") + 1);
                fileName = fileName.Remove(fileName.LastIndexOf("."));

                //locationsList.Items.Add(fileName);

                // PERpushpin.Content = fileName;
                //this.PERMap.Children.Add(PERpushpin);


                dupalist.Add(new PERLocation(fileName, new Location(cordinatesDoube[0], cordinatesDoube[1])));
            }

            // RaisePropertyChanged("dupalist");

            //duuuppaa.UpdateLayout();
            //pinLSTB.UpdateLayout();
        }