C# Bingmaps projem masaüstü plaformu üzerinde çalışıyor, bingmaps projemde datagridden gelen veriyi MyWebBrowser nesnesi üzerinde göstermek istiyorum gösteriyorumda,ancak 1 adet gösteriyor, datagrid gelen koordinat sayısı 10 adet ama MyWebBrowser üzerinde 1 adet gösteriyor. hatam tam olarak nedir bilmiyorum.Projemin datada map tablosundan çekildiği X,Y,GüvenDurumu,Bina İsmi Olarak Toplamda 4 Kolonu var, aşağıda şimdi kodları veriyorum.Sağlıklı olması açısından tüm detayları verdim umarım yardımcı olabilecek biri vardır.



Bingmaps HTML olarak bir klasörden API ve gerekli key'i çekiyor, onlarıda yazacağım.

HTML Kodlarım:











<script></script>

<script>
var map, searchManager;

function GetMap() {
map = new Microsoft.Maps.Map('#App', {
credentials: 'ArJcBmoonr3-Jf1b4_Eb_ipGqipfd5ve2I_TRCO_jOrZoYecGoiVNxXhZLqLAFe6'
});

//
// 'AqZuTv28mKfvtHsdPfCzdZ5pPTxxVxnyxk5zpQEENXOVwz9Q7M1pRbtJdMDSluhT' Eski



map.setView({
center: new Microsoft.Maps.Location(40.988055, 28.898625),
});

//As the map view changes, update the WinForm app of the center and zoom level of the map.
Microsoft.Maps.Events.addHandler(map, 'viewchange', updateMapViewInfo);

//Update the map view info with the inital map view.
updateMapViewInfo();

}

function changeCenter(x, y) {
map.setView({
center: new Microsoft.Maps.Location(x, y),
});
}

function updateMapViewInfo() {
//Make sure that there is an external endpoint that can be accessed.
if (window.external) {
var center = map.getCenter();

//Call the UpdateMapViewInfo method in the Form1 class.
window.external.UpdateMapViewInfo(center.latitude, center.longitude, map.getZoom());
}
}

function updateMapWithPushpins(enlem, boylam, ad, color) {
var point = { latitude: enlem, longitude: boylam };

var pin = new Microsoft.Maps.Pushpin(point, {
title: ad,
color: color
});

//Add the pushpin to the map
map.entities.push(pin);
}

function focusToPin(enlem, boylam) {
map.setView({
center: new Microsoft.Maps.Location(enlem, boylam),
zoom: 50,
});
}
//A function that takes in a search query, geocodes it and displays it on the map.
function search(query) {
//If search manager is not defined, load the search module.
if (!searchManager) {
//Create an instance of the search manager and call the geocodeQuery function again.
Microsoft.Maps.loadModule('Microsoft.Maps.Search', function () {
searchManager = new Microsoft.Maps.Search.SearchManager(map);
search(query);
});
} else {
var searchRequest = {
where: query,
callback: function (r) {
//Add the first result to the map and zoom into it.
if (r && r.results && r.results.length > 0) {
var pin = new Microsoft.Maps.Pushpin(r.results[0].location);
map.entities.push(pin);

map.setView({ bounds: r.results[0].bestView });
}
},
errorCallback: function (e) {
//If there is an error, alert the user about it.
alert("No results found.");
}
};

//Make the geocode request.
searchManager.geocode(searchRequest);
}
}
</script>







Taşımak için, tıklayın ve sürükleyin
Form Üzerindeki Kodlarım:

Alıntı
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.OleDb;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;

namespace FastFoodDemo
{ [ComVisible(true)]

public partial class harita : UserControl
{
public harita()
{

InitializeComponent();
analist.Visible = false;

this.MyWebBrowser.ScriptErrorsSuppressed = true; //WB Hata Bildirimlerini Kapatır.

MyWebBrowser.ObjectForScripting = this;
string htmlPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName) + "\\Html\\Map.html";
MyWebBrowser.Navigate(new Uri(htmlPath));
this.Show();
}

private void harita_Load(object sender, EventArgs e)
{

}

void harita_Closed(object sender, EventArgs e)
{
OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=sistem.mdb");
OleDbCommand cmd = new OleDbCommand();


con.Open();
cmd.Connection = con;

cmd.CommandText = "Delete from map";

cmd.ExecuteNonQuery();

con.Close();
}
public void Yenile()
{
OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=sistem.mdb");
OleDbCommand cmd = new OleDbCommand();


con.Open();
cmd.Connection = con;

cmd.CommandText = "Select * from sistem2";

cmd.ExecuteReader();


con.Close();
}
sistem1DataSetTableAdapters.sistem2TableAdapter dt = new sistem1DataSetTableAdapters.sistem2TableAdapter();

private void button1_Click(object sender, EventArgs e)
{
dataGridView3.DataSource = dt.TumListeyiGetir();

try
{

Yenile();
timer1.Enabled = true;


while (true)
{

var DBPath = "sistem1.mdb";

OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;" + "Data Source=" + DBPath);
conn.Open();

using (DataTable dt = new DataTable())
{
var x = conn.DataSource;
var y = conn.Database;
using (OleDbDataAdapter adapter = new OleDbDataAdapter("Select * from sistem", conn))
{
try
{
if (adapter != null)
adapter.Fill(dt);
else
{
MessageBox.Show("Başarıyla Kaydededildi.");

}


}

catch
{
}
}
kucuk.DataSource = dt;

}


int count = 0;
foreach (DataGridViewRow dtr in kucuk.Rows)
{

count++;

var currentCulture = System.Globalization.CultureInfo.InstalledUICulture;
var numberFormat = (System.Globalization.NumberFormatInfo)currentCulture.NumberFormat.Clone();
numberFormat.NumberDecimalSeparator = ".";

double fEnlem;
double fBoylam = 0;
double fisim;

if (count != kucuk.Rows.Count)
{
bool succeededE = double.TryParse(dtr.Cells[2].Value.ToString(), System.Globalization.NumberStyles.Any, numberFormat, out fEnlem);
bool succeededF = double.TryParse(dtr.Cells[3].Value.ToString(), System.Globalization.NumberStyles.Any, numberFormat, out fBoylam);
bool succeededG = double.TryParse(dtr.Cells[4].Value.ToString(), System.Globalization.NumberStyles.Any, numberFormat, out fisim);
if (succeededE == true && succeededF == true)
{
if (fEnlem > 10)
analist.Rows.Add(dtr.Cells[2].Value, dtr.Cells[3].Value, dtr.Cells[4].Value, dtr.Cells[0].Value, dtr.Cells[1].Value);
}
}
}
MyWebBrowser.Document.InvokeScript("changeCenter", new object[] { analist.Rows[0].Cells[0].Value, analist.Rows[0].Cells[1].Value });
analist.Visible = true;
string color;


for (int i = 0; i < analist.RowCount; i++)
{
if (analist.Rows[i].Cells[2].Value.ToString() == "GÜVENLİ BÖLGE")
color = "Green";
else color = "Brown";

MyWebBrowser.Document.InvokeScript("updateMapWithPushpins", new object[] { analist.Rows[i].Cells[0].Value, analist.Rows[i].Cells[1].Value, analist.Rows[i].Cells[4].Value, color });

}
break;

}
}
catch (Exception Hata)
{
MessageBox.Show("Harita Koordinatlarını Eklemeden Harita Üzerinde Gösterme İşlemi Sağlayamassınız");

}
}

private void timer1_Tick(object sender, EventArgs e)
{
int alımsayısı = analist.Rows.Count;

label1.Text = alımsayısı.ToString();
timer1.Stop();
}

private void button2_Click(object sender, EventArgs e)
{
OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=sistem1.mdb");
OleDbCommand cmd = new OleDbCommand();
con.Open();
cmd.Connection = con;

cmd.CommandText = "Delete from sistem2";

cmd.ExecuteNonQuery();

con.Close();
analist.DataSource = null;

analist.Rows.Clear();
}
}
}