void load_locations_on_map(int screen_x)
{
BitmapImage background = (BitmapImage)configurations.img_background_pic;
System.Windows.Point pw = this.workspace.PointToScreen(new System.Windows.Point(0, 0));
//double max_x = this.workspace.PointFromScreen(new System.Windows.Point(this.Width - pw.X, 0)).X;
double max_x = screen_x - (screen_x * configurations.tab_width_percentage / 100) - workspace.Margin.Left;
int i = 1;
foreach (System.Windows.Point p in configurations.locations)
{
double x = (p.X / background.PixelWidth) * max_x;
double y = (p.Y / background.PixelHeight) * this.workspace.ActualHeight;
Ellipse e = new Ellipse();
e.Fill = configurations.location_dot_color;
e.Stroke = configurations.location_dot_outline_color;
e.Width = configurations.location_dot_diameter;
e.Height = configurations.location_dot_diameter;
Canvas.SetLeft(e, x - (configurations.location_dot_diameter / 2));
Canvas.SetTop(e, y - (configurations.location_dot_diameter / 2));
e.Tag = i;
e.PreviewTouchDown += new EventHandler<TouchEventArgs>(reddot_PreviewTouchDown);
TextBlock tb = new TextBlock();
tb.Text = i.ToString(); tb.FontWeight = FontWeights.Bold; tb.FontSize = 24; tb.Foreground = configurations.location_dot_font_color;
tb.Tag = i;
tb.PreviewTouchDown += new EventHandler<TouchEventArgs>(tb_PreviewTouchDown);
if (i > 9)
{
Canvas.SetLeft(tb, x - 12);
Canvas.SetTop(tb, y - 15);
}
else
{
Canvas.SetLeft(tb, x - 8);
Canvas.SetTop(tb, y - 15);
}
workspace.Children.Add(e);
workspace.Children.Add(tb);
i++;
}
Canvas.SetLeft(this.label_update, max_x - this.label_update.Width);
Canvas.SetTop(this.label_update, 0);
}