private void StormMenu_AddNew_Click(object sender, RoutedEventArgs e) { Logging.Log("Creating new storm window..."); Basin CurrentBasin = CurrentProject.SelectedBasin; AddNewStormHost ANSH = new AddNewStormHost(CurrentBasin.SeasonStartTime); ANSH.Owner = this; ANSH.Show(); }
private void Window_PreviewMouseDown(object sender, MouseButtonEventArgs e) { Storm Sto = CurrentProject.SelectedBasin.GetCurrentStorm(); if (Sto != null) { if (Sto.LastNode != null) { Node LastNode = Sto.LastNode; RelativePositionConverter RPC = new RelativePositionConverter(); RelativePosition RP = (RelativePosition)RPC.Convert(e.GetPosition(HurricaneBasin), typeof(RelativePosition), null, null); LastNode.Position = RP; Sto.AddNode(LastNode); LastNode = null; } } else { // left mouse button clicked (no zoom) if (e.LeftButton == MouseButtonState.Pressed) { Project CurProj = CurrentProject; // fix retardation if (CurProj != null && CurProj.SelectedBasin != null && CurProj.SelectedBasin.CurrentLayer != null) { // if we have no storms, ask the user to create a storm instead of add a track point. if (Sto == null) { AddNewStormHost Addstwindow = new AddNewStormHost(CurProj.SelectedBasin.SeasonStartTime); Addstwindow.Owner = this; Addstwindow.Show(); return; } else { // build 524 #if PRISCILLA StormTypeManager ST2M = ST2Manager; #else StormTypeManager ST2Manager = GlobalState.GetST2Manager(); #endif Storm SelectedStorm = CurProj.SelectedBasin.GetCurrentStorm(); int NodeCount = SelectedStorm.NodeList.Count - 1; // build 547: implement season start time on window feature AddTrackPointHost ATPHost = new AddTrackPointHost(ST2M.GetListOfStormTypeNames(), e.GetPosition(HurricaneBasin), SelectedStorm.GetNodeDate(NodeCount)); ATPHost.Owner = this; ATPHost.Show(); } } } else if (e.RightButton == MouseButtonState.Pressed) { // temporary code // this should be a matrix transformation but /shrug // not best practice LastRightMouseClickPos = e.GetPosition(HurricaneBasin); } } }