Esempio n. 1
0
        public void OKHit(object sender, DanoEventArgs DEA)
        {
            Debug.Assert(DEA.DanoParameters.Count == 4);

#if DANO
            Basin CBasin = GlobalState.GetCurrentBasin(); // only valid when project valid
            Storm Sto = CBasin.GetCurrentStorm();
#else
            MainWindow MnWindow = (MainWindow)Application.Current.MainWindow;
            Storm Sto = MnWindow.CurrentProject.SelectedBasin.GetCurrentStorm();

            try
            {
                int Intensity = (int)DEA.DanoParameters[0];
                string Type = (string)DEA.DanoParameters[1];
                Point Position = (Point)DEA.DanoParameters[2];
                int Pressure = (int)DEA.DanoParameters[3];

                Sto.AddNode(Intensity, Type, Position, Pressure, MnWindow.ST2Manager);
                Close();
            }
            catch (InvalidCastException err)
            {
#if DEBUG
                Error.Throw("Warning!", $"Internal error: Cannot convert DanoParameters to their actual types.\n\n{err}", ErrorSeverity.Warning, 403);
#else
                Error.Throw("Warning!", "Internal error: Cannot convert DanoParameters to their actual types.\n\n{err}", ErrorSeverity.Warning, 403); 
#endif
#endif
            }

        }