예제 #1
0
 protected void openFromFile()
 {
     if (openFileDialog1.ShowDialog() == DialogResult.OK)
     {
         XmlTextReader reader = new XmlTextReader(openFileDialog1.OpenFile());
         KMLDistance myKmlDistance = new KMLDistance(reader);
         fillDistancesToTreeview(myKmlDistance);
     }
 }
 protected void clipboardTextReceived(Clipboard clipboard, string text)
 {
     try{
         XmlTextReader reader = new XmlTextReader(new StringReader(text));
         KMLDistance myKmlDistance = new KMLDistance(reader);
         fillDistancesToTreeview(myKmlDistance);
     }catch{
     }
 }
예제 #3
0
 protected void insertFromClipboard()
 {
     try{
         String text = Clipboard.GetText();
         XmlTextReader reader = new XmlTextReader(new StringReader(text));
         KMLDistance myKmlDistance = new KMLDistance(reader);
         fillDistancesToTreeview(myKmlDistance);
     }catch{
     }
 }
예제 #4
0
 private void fillDistancesToTreeview(KMLDistance myKmlDistance)
 {
     distancesGridView.Rows.Clear();
     String[] row = new String[2];
     for (int i=0; i< myKmlDistance.Count; i++) {
         row[0] = myKmlDistance[i].Name;
         row[1] = Math.Round(myKmlDistance[i].Distance,3)+" km";
        			distancesGridView.Rows.Add(row);
     }
 }
 protected virtual void openActivated(object sender, System.EventArgs e)
 {
     FileChooserDialog fcd = new Gtk.FileChooserDialog("Bitte wählen sie eine KML Datei aus",
                                   this,
                                   FileChooserAction.Open,
                                   "Abbrechen",ResponseType.Cancel,
                                   "Öffnen",ResponseType.Accept);
     fcd.Filter = new FileFilter();
     fcd.Filter.AddPattern("*.kml");
     if (fcd.Run() == (int)ResponseType.Accept)
     {
         KMLDistance myKmlDistance = new KMLDistance(fcd.Filename);
         fillDistancesToTreeview(myKmlDistance);
     }
     //Don't forget to call Destroy() or the FileChooserDialog window won't get closed.
     fcd.Destroy();
 }
 private void fillDistancesToTreeview(KMLDistance myKmlDistance)
 {
     distanceListStore.Clear();
     for (int i=0; i< myKmlDistance.Count; i++) {
         distanceListStore.AppendValues(myKmlDistance[i].Name, Math.Round(myKmlDistance[i].Distance,3)+" km");
     }
 }