static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); LoadingThread thread = new LoadingThread("input.osm.pbf"); StartForm startForm = new StartForm(); startForm.MapFileChosen += (object o, FileNameEventArgs fnea) => { thread = new LoadingThread(fnea.FileName); }; Application.Run(startForm); if(startForm.Gebruiker > -1) { if (startForm.newUser) Application.Run(new HelpForm()); MainForm mainForm = new MainForm(startForm.UserData, startForm.Gebruiker, thread); Application.Run(mainForm); } thread.Abort(); }
public MapDragButton(MapDisplay map, Bitmap icon, ButtonMode mode, MainForm parent, bool removeIcon) { this.MouseDown += (object o, MouseEventArgs mea) => { if (!iconPlaced || !removeIcon) { mousePos = mea.Location; map.BMode = mode; this.PerformClick(); if (removeIcon) this.BackgroundImage = null; parent.ChangeCursor(icon); } }; this.MouseUp += (object o, MouseEventArgs mea) => { if (!iconPlaced || !removeIcon) { parent.ChangeCursorBack(); this.Invalidate(); if (!map.OnClick(o, new MouseMapDragEventArgs(this, mea.Button, mea.Clicks, mea.X + this.Location.X - map.Location.X, mea.Y + this.Location.Y - map.Location.Y, mea.Delta))) { // If map.OnClick returns false it means that the icon isn't placed // so if the backgroundimage is removed, it should be placed back. if (removeIcon) { this.BackgroundImage = icon; } } else { iconPlaced = true; } map.BMode = ButtonMode.None; } }; map.MapIconPlaced += (object o, MapDragEventArgs mdea) => { // If the MapIcon that links to this button is placed, the icon // on this button should be removed. if (mdea.Button == this) { if (removeIcon) this.BackgroundImage = null; iconPlaced = true; } }; map.MapIconRemoved += (object o, MapDragEventArgs mdea) => { // If the MapIcon that links to this button is removed, the icon // on this button should be visible. if (mdea.Button == this) { if (removeIcon) this.BackgroundImage = icon; iconPlaced = false; } }; this.icon = icon; }
public StreetSelectBox(MapDisplay map, LoadingThread thr, IconType type, MapDragButton button, MainForm parent) { this.map = map; this.graphThread = thr; this.type = type; this.button = button; this.Enabled = false; this.AutoCompleteMode = AutoCompleteMode.SuggestAppend; this.AutoCompleteSource = AutoCompleteSource.CustomSource; this.AutoCompleteCustomSource = new AutoCompleteStringCollection(); loadNames(); // If this control was created before the graph was fully loaded, // The names aren't initialized so initialize all names. parent.GraphLoaded += (object o, EventArgs ea) => { loadNames(); }; }