Esempio n. 1
0
        /// <summary>
        /// Gets the fully qualified name of the <see cref="IDialogView"/> associated to the <see cref="IDialogViewModel"/>
        /// </summary>
        /// <remarks>
        /// We assume here that for a <see cref="IDialogViewModel"/> with a fully qualified name xxx.yyy.ViewModels.DialogViewModel, the counterpart view is xxx.yyy.Views.Dialog
        /// </remarks>
        /// <param name="viewModel">The <see cref="IDialogViewModel"/></param>
        /// <returns>The Fully qualified Name</returns>
        /// <exception cref="ArgumentNullException">
        /// The viewModel must not be null
        /// </exception>
        private string GetViewTypeName(IDialogViewModel viewModel)
        {
            if (viewModel == null)
            {
                throw new ArgumentNullException("viewModel", "The viewModel must not be null");
            }

            var fullyQualifiedName = viewModel.ToString().Replace(".ViewModels.", ".Views.");

            // remove "ViewModel" from the name to get the View Name
            var viewName = System.Text.RegularExpressions.Regex.Replace(fullyQualifiedName, "ViewModel$", string.Empty);

            return(viewName);
        }