Ejemplo n.º 1
0
        /// <summary>
        /// A total hack to get the new name of the layer after it's already been renamed.
        /// In V3 everything will be binded to GlobalState, GlueAPI etc so this will not be necessary.
        /// </summary>
        /// <param name="OldName">The old name</param>
        /// <returns>The new name.</returns>
        private string GetNewName(int LayerIndex)
        {
#if PRISCILLA
            Basin CurrentProject = MnWindow.CurrentProject.SelectedBasin;
#else
            Project CurrentProject = GlobalState.GetCurrentProject();
#endif

            // this should never happen...most of this is terrible but will be fixed in v3
            Debug.Assert(CurrentProject.Layers.Count > 0 && (CurrentProject.Layers.Count - 1) <= LayerIndex);

            Layer Lay = CurrentProject.Layers[LayerIndex];

            return(Lay.Name);
        }
        /// <summary>
        /// Frontend code for adding a storm...
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="DEA"></param>
        private void OKHit(object sender, DanoEventArgs DEA)
        {
            Debug.Assert(DEA.DanoParameters.Count == 2);
#if DANO
            Project Proj = GlobalState.GetCurrentProject();
            Basin   Bas  = Proj.SelectedBasin;
#else
            MainWindow MnWindow = (MainWindow)Application.Current.MainWindow;

            string   StormName      = (string)DEA.DanoParameters[0];
            DateTime StormStartTime = (DateTime)DEA.DanoParameters[1];

            Basin        Bas      = MnWindow.CurrentProject.SelectedBasin;
            List <Storm> FlatList = Bas.GetFlatListOfStorms();

            if (FlatList.Count == 0)
            {
                Bas.SeasonStartTime = StormStartTime;
            }
#endif
            Bas.AddStorm(StormName, StormStartTime);
            Close();
        }