private void lstStartLocations_Selected(object sender, ListSelectEventArgs e) { try { RouteStart loc = mStartLocations[(string)lstStartLocations[e.Row][StartLocationsList.Name][0]]; switch (e.Column) { case StartLocationsList.Icon: lstStartLocations[e.Row][StartLocationsList.Enabled][0] = !(bool)lstStartLocations[e.Row][StartLocationsList.Enabled][0]; goto case StartLocationsList.Enabled; case StartLocationsList.Enabled: loc.Enabled = (bool)lstStartLocations[e.Row][StartLocationsList.Enabled][0]; break; case StartLocationsList.Name: case StartLocationsList.Coords: edtStartLocationName.Text = loc.Name; edtStartLocationCoords.Text = loc.Coords.ToString(); edtStartLocationRunDist.Text = loc.RunDistance.ToString(); btnStartLocationAdd.Text = "Modify"; break; case StartLocationsList.Delete: if (loc.Type == RouteStartType.Regular) { if (!Util.IsControlDown()) { Util.Warning("You must hold down Ctrl while clicking to delete a start location"); } else { mStartLocations.Remove(loc.Name); lstStartLocations.Delete(e.Row); } } break; } } catch (Exception ex) { Util.HandleException(ex); } }
private void lstPortalDevices_Selected(object sender, ListSelectEventArgs e) { try { string name = (string)lstPortalDevices[e.Row][PortalDevicesList.Name][0]; switch (e.Column) { case PortalDevicesList.Icon: lstPortalDevices[e.Row][PortalDevicesList.Enabled][0] = !(bool)lstPortalDevices[e.Row][PortalDevicesList.Enabled][0]; goto case PortalDevicesList.Enabled; case PortalDevicesList.Enabled: mPortalDevices[name].Enabled = (bool)lstPortalDevices[e.Row][PortalDevicesList.Enabled][0]; break; case PortalDevicesList.Name: case PortalDevicesList.Detected: ShowDetails(mPortalDevices[name].InfoLocation); break; } } catch (Exception ex) { Util.HandleException(ex); } }
private void lstRecent_Selected(object sender, ListSelectEventArgs e) { HandleLocationListClick(lstRecent, e, false); }
private void lstRecentCoords_Selected(object sender, ListSelectEventArgs e) { try { switch (e.Column) { case RecentCoordsList.Icon: lstRecentCoords.Delete(e.Row); break; case RecentCoordsList.Name: case RecentCoordsList.Coords: Coordinates coords; if (Coordinates.TryParse((string)lstRecentCoords[e.Row][RecentCoordsList.Coords][0], out coords)) { if (Util.IsControlDown()) { SetRouteEnd(coords); } else if (Util.IsShiftDown()) { SetRouteStart(coords); } else { string name = (string)lstRecentCoords[e.Row][RecentCoordsList.Name][0]; if (name == (string)lstRecentCoords[e.Row][RecentCoordsList.Coords][0]) name = ""; Location loc = new Location(Location.GetNextInternalId(), name, LocationType.Custom, coords, ""); loc.Icon = (int)lstRecentCoords[e.Row][RecentCoordsList.Icon][1]; mArrowHud.DestinationLocation = loc; mArrowHud.Visible = true; } } break; } } catch (Exception ex) { Util.HandleException(ex); } }
private void lstRoute_Selected(object sender, ListSelectEventArgs e) { HandleLocationListClick(lstRoute, e, true); }
private void lstFavorites_Selected(object sender, ListSelectEventArgs e) { try { if (e.Column == LocationList.Icon) { if (Util.IsControlDown()) { Location loc = GetLocation(lstFavorites[e.Row][LocationList.ID][0] as string); if (loc != null) loc.IsFavorite = false; } } else { HandleLocationListClick(lstFavorites, e, true); } } catch (Exception ex) { Util.HandleException(ex); } }
private void lstSearchResults_Selected(object sender, ListSelectEventArgs e) { HandleLocationListClick(lstSearchResults, e, false); }
private void HandleLocationListClick(ListWrapper lst, ListSelectEventArgs e, bool isRouteList) { try { Location loc; switch (e.Column) { case LocationList.Icon: lst.Delete(e.Row); if (isRouteList && e.Row < mRoute.Count) { mRoute.RemoveAt(e.Row); mMapHud.Route = mRoute; } break; case LocationList.Name: case LocationList.Coords: if (null != (loc = GetLocation(lst[e.Row][LocationList.ID][0] as string))) { if (Util.IsControlDown()) SetRouteEnd(loc); else if (Util.IsShiftDown()) SetRouteStart(loc); else ShowDetails(loc); } else { Util.Error("An error has occurred getting the details of " + lst[e.Row][LocationList.Name][0]); } break; case LocationList.GoIcon: if (isRouteList) { mArrowHud.Route = mRoute; mArrowHud.RouteIndex = e.Row; mArrowHud.Visible = true; } else if (null != (loc = GetLocation(lst[e.Row][LocationList.ID][0] as string))) { mArrowHud.DestinationLocation = loc; mArrowHud.Visible = true; } else { Util.Error("An error has occurred getting the details of " + lst[e.Row][LocationList.Name][0]); } break; } } catch (Exception ex) { Util.HandleException(ex); } }
private void lstToolbarButtons_Selected(object sender, ListSelectEventArgs e) { try { bool visible = (bool)lstToolbarButtons[e.Row][ToolbarButtonsList.Visible][0]; if (e.Column != ToolbarButtonsList.Visible) { lstToolbarButtons[e.Row][ToolbarButtonsList.Visible][0] = (visible = !visible); } mToolbar[e.Row].Visible = visible; } catch (Exception ex) { Util.HandleException(ex); } }
private void lstDungeonMapMouse_Selected(object sender, ListSelectEventArgs e) { try { MouseButtons b; switch (e.Column) { case MouseList.Name: switch ((string)lstDungeonMapMouse[e.Row][MouseList.Name][0]) { case MouseControls.PanMap: Util.HelpMessage("Drag the map with this button to pan the map."); break; } return; case MouseList.Left: { b = MouseButtons.Left; break; } case MouseList.Middle: { b = MouseButtons.Middle; break; } case MouseList.Right: { b = MouseButtons.Right; break; } case MouseList.X1: { b = MouseButtons.XButton1; break; } case MouseList.X2: { b = MouseButtons.XButton2; break; } default: { return; } } // If the checkbox was selected... if ((bool)lstDungeonMapMouse[e.Row][e.Column][0]) { switch ((string)lstDungeonMapMouse[e.Row][MouseList.Name][0]) { case MouseControls.PanMap: { mDungeonHud.DragButton |= b; break; } } } else { switch ((string)lstDungeonMapMouse[e.Row][MouseList.Name][0]) { case MouseControls.PanMap: { mDungeonHud.DragButton &= ~b; break; } } } } catch (Exception ex) { Util.HandleException(ex); } }
private void lstDerethMapMouse_Selected(object sender, ListSelectEventArgs e) { try { MouseButtons b; switch (e.Column) { case MouseList.Name: switch ((string)lstDerethMapMouse[e.Row][MouseList.Name][0]) { case MouseControls.PanMap: Util.HelpMessage("Drag the map with this button to pan the map."); break; case MouseControls.SelectLocation: Util.HelpMessage("Click with this button to make the arrow point to the location. " + "Shift+Click to set the location as the route start, " + "or Ctrl+Click to set it as the route end."); break; case MouseControls.ContextMenu: Util.HelpMessage("Click with this button to show a context menu for the location."); break; } return; case MouseList.Left: { b = MouseButtons.Left; break; } case MouseList.Middle: { b = MouseButtons.Middle; break; } case MouseList.Right: { b = MouseButtons.Right; break; } case MouseList.X1: { b = MouseButtons.XButton1; break; } case MouseList.X2: { b = MouseButtons.XButton2; break; } default: { return; } } // If the checkbox was selected... if ((bool)lstDerethMapMouse[e.Row][e.Column][0]) { switch ((string)lstDerethMapMouse[e.Row][MouseList.Name][0]) { case MouseControls.PanMap: { mMapHud.DragButton |= b; break; } case MouseControls.SelectLocation: { mMapHud.SelectLocationButton |= b; break; } case MouseControls.ContextMenu: { mMapHud.ContextMenuButton |= b; break; } case MouseControls.Details: { mMapHud.DetailsButton |= b; break; } } } else { switch ((string)lstDerethMapMouse[e.Row][MouseList.Name][0]) { case MouseControls.PanMap: { mMapHud.DragButton &= ~b; break; } case MouseControls.SelectLocation: { mMapHud.SelectLocationButton &= ~b; break; } case MouseControls.ContextMenu: { mMapHud.ContextMenuButton &= ~b; break; } case MouseControls.Details: { mMapHud.DetailsButton &= ~b; break; } } } } catch (Exception ex) { Util.HandleException(ex); } }