Defines the TextTransformation type.
        /// <summary>
        /// Adds the text templates.
        /// </summary>
        /// <param name="statusBarMessage">The status bar message.</param>
        /// <param name="textTemplates">The text templates.</param>
        public IEnumerable<string> AddTextTemplates(
            string statusBarMessage,
            IEnumerable<TextTemplateInfo> textTemplates)
        {
            TraceService.WriteLine("TextTemplatingService::AddTextTemplates");

            this.Messages = new List<string>();

            this.visualStudioService.WriteStatusBarMessage(statusBarMessage);

            foreach (TextTemplateInfo textTemplateInfo in textTemplates)
            {
                TraceService.WriteLine("TextTemplatingService::AddTextTemplates textTemplate=" + textTemplateInfo.FileName);

                IProjectService projectService = this.visualStudioService.GetProjectServiceBySuffix(textTemplateInfo.ProjectSuffix);

                if (projectService != null)
                {
                    this.visualStudioService.WriteStatusBarMessage(statusBarMessage + "for " + projectService.Name);

                    ITextTransformationService textTransformationService = this.visualStudioService.GetTextTransformationService();

                    TextTransformationRequest textTransformationRequest = new TextTransformationRequest
                                                                            {
                                                                                SourceFile = textTemplateInfo.TemplateName,
                                                                                Parameters = textTemplateInfo.Tokens,
                                                                                RemoveFileHeaders = this.SettingsService.RemoveDefaultFileHeaders,
                                                                                RemoveXmlComments = this.SettingsService.RemoveDefaultComments,
                                                                                RemoveThisPointer = this.SettingsService.RemoveThisPointer
                                                                            };

                    textTemplateInfo.TextOutput = textTransformationService.Transform(textTransformationRequest).Output;

                    string message = projectService.AddTextTemplate(textTemplateInfo, this.SettingsService.OutputTextTemplateContentToTraceFile);

                    this.Messages.Add(message);
                }
            }

            return this.Messages;
        }
        /// <summary>
        ///     Gets the code behind text template information.
        /// </summary>
        /// <param name="projectSuffix">The project suffix.</param>
        /// <param name="viewName">Name of the view.</param>
        /// <param name="viewTemplateName">Name of the view template.</param>
        /// <param name="tokens">The tokens.</param>
        /// <returns>A TextTemplateInfo.</returns>
        protected TextTemplateInfo GetCodeBehindTextTemplateInfo(
            string projectSuffix,
            string viewName,
            string viewTemplateName,
            Dictionary<string, string> tokens)
        {
            var templateDirectory = this.SettingsService.ItemTemplatesDirectory;

            if (projectSuffix == this.SettingsService.XamarinFormsProjectSuffix)
            {
                templateDirectory += "\\XamarinForms";
            }

            TextTemplateInfo textTemplateInfo = new TextTemplateInfo
            {
                ProjectSuffix = projectSuffix,
                ProjectFolder = "Views",
                Tokens = tokens,
                ShortTemplateName = viewTemplateName,
                TemplateName = templateDirectory + "\\" + "BlankViewCodeBehind.t4"
            };

            TextTransformationRequest textTransformationRequest = new TextTransformationRequest
            {
                SourceFile = textTemplateInfo.TemplateName,
                Parameters = textTemplateInfo.Tokens,
                RemoveFileHeaders = this.SettingsService.RemoveDefaultFileHeaders,
                RemoveXmlComments = this.SettingsService.RemoveDefaultComments,
                RemoveThisPointer = this.SettingsService.RemoveThisPointer
            };

            TextTransformation textTransformation = this.GetTextTransformationService().Transform(textTransformationRequest);

            textTemplateInfo.TextOutput = textTransformation.Output;
            textTemplateInfo.FileName = viewName + "." + textTransformation.FileExtension;

            return textTemplateInfo;
        }
        /// <summary>
        /// Gets the MVVM cross view.
        /// </summary>
        /// <param name="itemTemplateInfo">The item template information.</param>
        /// <param name="tokens">The tokens.</param>
        /// <param name="viewTemplateName">Name of the view template.</param>
        /// <param name="viewName">Name of the view.</param>
        /// <returns></returns>
        public TextTemplateInfo GetMvvmCrossView(
            ItemTemplateInfo itemTemplateInfo,
            Dictionary<string, string> tokens,
            string viewTemplateName,
            string viewName)
        {
            TraceService.WriteLine("MvvmCrossViewFactory::GetMvvmCrossView viewTemplateName=" + viewTemplateName);

            if (itemTemplateInfo.ProjectSuffix == this.SettingsService.iOSProjectSuffix)
            {
                return this.GetiOSMvvmCrossView(
                    itemTemplateInfo,
                    tokens,
                    viewTemplateName,
                    viewName);
            }

            TextTemplateInfo textTemplateInfo = new TextTemplateInfo
            {
                ProjectSuffix = itemTemplateInfo.ProjectSuffix,
                ProjectFolder = "Views",
                Tokens = tokens,
                ShortTemplateName = viewTemplateName,
                TemplateName = this.SettingsService.ItemTemplatesDirectory + "\\" + itemTemplateInfo.ProjectType + "\\" + viewTemplateName
            };

            TextTransformationRequest textTransformationRequest = new TextTransformationRequest
            {
                SourceFile = textTemplateInfo.TemplateName,
                Parameters = textTemplateInfo.Tokens,
                RemoveFileHeaders = this.SettingsService.RemoveDefaultFileHeaders,
                RemoveXmlComments = this.SettingsService.RemoveDefaultComments,
                RemoveThisPointer = this.SettingsService.RemoveThisPointer
            };

            TextTransformation textTransformation = this.GetTextTransformationService().Transform(textTransformationRequest);

            textTemplateInfo.TextOutput = textTransformation.Output;
            textTemplateInfo.FileName = viewName + "." + textTransformation.FileExtension;

            if (itemTemplateInfo.ProjectSuffix == this.SettingsService.DroidProjectSuffix)
            {
                textTemplateInfo.FileOperations.Add(
                    this.GetCompileFileOperation(textTemplateInfo.ProjectSuffix, textTemplateInfo.FileName));
            }
            else
            {
                textTemplateInfo.FileOperations.Add(
                    this.GetPageFileOperation(textTemplateInfo.ProjectSuffix, textTemplateInfo.FileName));
            }

            return textTemplateInfo;
        }
        /// <summary>
        /// Getis the os MVVM cross view.
        /// </summary>
        /// <param name="itemTemplateInfo">The item template information.</param>
        /// <param name="tokens">The tokens.</param>
        /// <param name="viewTemplateName">Name of the view template.</param>
        /// <param name="viewName">Name of the view.</param>
        /// <returns>A TextTemplateInfo.</returns>
        internal TextTemplateInfo GetiOSMvvmCrossView(
            ItemTemplateInfo itemTemplateInfo,
            Dictionary<string, string> tokens,
            string viewTemplateName,
            string viewName)
        {
            TraceService.WriteLine("MvvmCrossViewFactory::GetiOSMvvmCrossView viewTemplateName=" + viewTemplateName);

            string folder = viewTemplateName.Replace("View.t4", string.Empty);

            TraceService.WriteLine("folder=" + folder);

            string subFolder = this.SettingsService.SelectedMvvmCrossiOSViewType;

            TraceService.WriteLine("subFolder=" + subFolder);

            folder = folder.Replace(subFolder, string.Empty);

            TraceService.WriteLine("folder=" + folder);

            string templateFolder = this.SettingsService.ItemTemplatesDirectory + "\\iOS\\" + folder + "\\" + subFolder + "\\";
            string shortFolderName = folder + "\\" + subFolder + "\\";

            TraceService.WriteLine("templateFolder=" + templateFolder);

            TextTemplateInfo textTemplateInfo = new TextTemplateInfo
            {
                ProjectSuffix = this.SettingsService.iOSProjectSuffix,
                ProjectFolder = "Views",
                Tokens = tokens,
                ShortTemplateName = shortFolderName + "View.t4",
                TemplateName = templateFolder + "View.t4"
            };

            TextTransformationRequest textTransformationRequest = new TextTransformationRequest
            {
                SourceFile = textTemplateInfo.TemplateName,
                Parameters = tokens,
                RemoveFileHeaders = this.SettingsService.RemoveDefaultFileHeaders,
                RemoveXmlComments = this.SettingsService.RemoveDefaultComments,
                RemoveThisPointer = this.SettingsService.RemoveThisPointer
            };

            TextTransformation textTransformation = this.GetTextTransformationService().Transform(textTransformationRequest);

            textTemplateInfo.TextOutput = textTransformation.Output;
            textTemplateInfo.FileName = viewName + "." + textTransformation.FileExtension;

            textTemplateInfo.FileOperations.Add(this.GetCompileFileOperation(
                textTemplateInfo.ProjectSuffix,
                textTemplateInfo.FileName));

            //// now handle xib and story board options!

            TraceService.WriteLine("SelectedMvvmCrossiOSViewType=" + this.SettingsService.SelectedMvvmCrossiOSViewType);

            if (this.SettingsService.SelectedMvvmCrossiOSViewType == MvvmCrossViewType.StoryBoard.GetDescription() ||
                this.SettingsService.SelectedMvvmCrossiOSViewType == MvvmCrossViewType.Xib.GetDescription())
            {
                viewTemplateName = this.SettingsService.SelectedMvvmCrossiOSViewType == MvvmCrossViewType.Xib.GetDescription() ? "ViewXib.t4" : "ViewStoryBoard.t4";

                TraceService.WriteLine("Adding ChildTextTemplate ViewTemplateName=" + viewTemplateName);

                TextTemplateInfo childTextTemplateInfo = new TextTemplateInfo
                {
                    ProjectSuffix = itemTemplateInfo.ProjectSuffix,
                    ProjectFolder = "Views",
                    Tokens = tokens,
                    ShortTemplateName = shortFolderName + viewTemplateName,
                    TemplateName = templateFolder + viewTemplateName
                };

                TextTransformationRequest childTextTransformationRequest = new TextTransformationRequest
                {
                    SourceFile = childTextTemplateInfo.TemplateName,
                    Parameters = tokens,
                    RemoveFileHeaders = this.SettingsService.RemoveDefaultFileHeaders,
                    RemoveXmlComments = this.SettingsService.RemoveDefaultComments,
                    RemoveThisPointer = this.SettingsService.RemoveThisPointer
                };

                textTransformation = this.GetTextTransformationService().Transform(childTextTransformationRequest);

                childTextTemplateInfo.TextOutput = textTransformation.Output;
                childTextTemplateInfo.FileName = viewName + "." + textTransformation.FileExtension;

                textTemplateInfo.ChildItems.Add(childTextTemplateInfo);

                //// add in designer file

                viewTemplateName = "ViewDesigner.t4";

                TraceService.WriteLine("Adding ChildTextTemplate ViewTemplateName=" + viewTemplateName);

                childTextTemplateInfo = new TextTemplateInfo
                {
                    ProjectSuffix = itemTemplateInfo.ProjectSuffix,
                    ProjectFolder = "Views",
                    Tokens = tokens,
                    ShortTemplateName = shortFolderName + viewTemplateName,
                    TemplateName = templateFolder + viewTemplateName
                };

                childTextTransformationRequest = new TextTransformationRequest
                {
                    SourceFile = childTextTemplateInfo.TemplateName,
                    Parameters = tokens,
                    RemoveFileHeaders = this.SettingsService.RemoveDefaultFileHeaders,
                    RemoveXmlComments = this.SettingsService.RemoveDefaultComments,
                    RemoveThisPointer = this.SettingsService.RemoveThisPointer
                };

                textTransformation = this.GetTextTransformationService().Transform(childTextTransformationRequest);

                childTextTemplateInfo.TextOutput = textTransformation.Output;
                childTextTemplateInfo.FileName = viewName + ".designer." + textTransformation.FileExtension;

                textTemplateInfo.ChildItems.Add(childTextTemplateInfo);
            }

            return textTemplateInfo;
        }
        /// <summary>
        /// Gets the droid MVVM cross view layout.
        /// </summary>
        /// <param name="textTemplateInfo">The text template information.</param>
        /// <param name="tokens">The tokens.</param>
        /// <param name="viewName">Name of the view.</param>
        internal void GetDroidMvvmCrossViewLayout(
            TextTemplateInfo textTemplateInfo,
            Dictionary<string, string> tokens,
            string viewName)
        {
            string viewTemplateName = textTemplateInfo.ShortTemplateName.Replace(".t4", ".axml.t4");

            TextTemplateInfo childTextTemplateInfo = new TextTemplateInfo
            {
                ProjectSuffix = this.SettingsService.DroidProjectSuffix,
                ProjectFolder = "Resources\\Layout",
                Tokens = tokens,
                ShortTemplateName = viewTemplateName,
                TemplateName = this.SettingsService.ItemTemplatesDirectory + "\\Droid\\" + viewTemplateName
            };

            TextTransformationRequest textTransformationRequest = new TextTransformationRequest
            {
                SourceFile = childTextTemplateInfo.TemplateName,
                Parameters = tokens,
                RemoveFileHeaders = this.SettingsService.RemoveDefaultFileHeaders,
                RemoveXmlComments = this.SettingsService.RemoveDefaultComments,
                RemoveThisPointer = this.SettingsService.RemoveThisPointer
            };

            TextTransformation textTransformation = this.GetTextTransformationService().Transform(textTransformationRequest);

            childTextTemplateInfo.TextOutput = textTransformation.Output;
            childTextTemplateInfo.FileName = viewName + "." + textTransformation.FileExtension;

            textTemplateInfo.ChildItems.Add(childTextTemplateInfo);
        }
        /// <summary>
        /// Gets the xamarin forms view.
        /// </summary>
        /// <param name="viewModelName">Name of the view model.</param>
        /// <param name="view">The view.</param>
        /// <returns>A TextTemplateInfo.</returns>
        internal TextTemplateInfo GetXamarinFormsView(string viewModelName, View view)
        {
            TraceService.WriteLine("ViewModelAndViewsFactory::GetXamarinFormsView viewModelName=" + viewModelName + " view=" + view.Name);

            string viewTemplateName =
                this.GetViewTemplate(
                    FrameworkType.MvvmCross.GetValueFromDescription<FrameworkType>(view.Framework),
                    view.PageType);

            string viewName = viewModelName.Remove(viewModelName.Length - ViewModelSuffix.Length) + "View";
            string pageType = view.PageType.Replace(" ", string.Empty);

            Dictionary<string, string> tokens = new Dictionary<string, string>
            {
                { "ClassName", viewName },
                { "CoreProjectName", this.VisualStudioService.CoreProjectService.Name },
                { "NameSpace", this.VisualStudioService.XamarinFormsProjectService.Name + ".Views" },
                { "PageType", pageType },
                { "CompileOption", this.SettingsService.UseXamarinFormsXamlCompilation ? XamarinFormsCompileOption.Compile.GetDescription() : XamarinFormsCompileOption.Skip.GetDescription() },
                { "Content", this.GetFormsViewContent(view)
                }
            };

            TextTemplateInfo textTemplateInfo = new TextTemplateInfo
            {
                ProjectSuffix = this.SettingsService.XamarinFormsProjectSuffix,
                ProjectFolder = "Views",
                Tokens = tokens,
                ShortTemplateName = viewTemplateName,
                TemplateName = this.SettingsService.ItemTemplatesDirectory + "\\XamarinForms\\" + viewTemplateName
            };

            TextTransformationRequest textTransformationRequest = new TextTransformationRequest
            {
                SourceFile = textTemplateInfo.TemplateName,
                Parameters = textTemplateInfo.Tokens,
                RemoveFileHeaders = this.SettingsService.RemoveDefaultFileHeaders,
                RemoveXmlComments = this.SettingsService.RemoveDefaultComments,
                RemoveThisPointer = this.SettingsService.RemoveThisPointer
            };

            TextTransformation textTransformation = this.GetTextTransformationService().Transform(textTransformationRequest);

            textTemplateInfo.TextOutput = textTransformation.Output;
            textTemplateInfo.FileName = viewName + "." + textTransformation.FileExtension;

            //// we also need to add a build action for the xaml file!

            textTemplateInfo.FileOperations.Add(
                this.GetEmbeddedResourceFileOperation(
                    this.SettingsService.XamarinFormsProjectSuffix,
                    textTemplateInfo.FileName));

            //// add code behind file

            TextTemplateInfo childTextTemplateInfo =
                this.GetCodeBehindTextTemplateInfo(
                    this.SettingsService.XamarinFormsProjectSuffix,
                    viewName,
                    viewTemplateName,
                    tokens);

            textTemplateInfo.ChildItems.Add(childTextTemplateInfo);

            return textTemplateInfo;
        }
        /// <summary>
        /// Gets the view model text template information.
        /// </summary>
        /// <param name="view">The view.</param>
        /// <param name="viewModelName">Name of the view model.</param>
        /// <returns>A TextTemplateInfo.</returns>
        internal TextTemplateInfo GetViewModelTextTemplateInfo(
            View view,
            string viewModelName)
        {
            TraceService.WriteLine("ViewModelAndViewsFactory::GetViewModelTextTemplateInfo viewModelName=" + viewModelName + " view=" + view.Name);

            string templateName = this.GetViewModelTemplate(FrameworkType.MvvmCross.GetValueFromDescription<FrameworkType>(view.Framework), view.PageType);

            Dictionary<string, string> tokens = new Dictionary<string, string>
            {
                { "ClassName", viewModelName },
                { "NameSpace",  this.VisualStudioService.CoreProjectService != null ? this.VisualStudioService.CoreProjectService.Name + ".ViewModels" : string.Empty}
            };

            TextTemplateInfo textTemplateInfo = new TextTemplateInfo
            {
                ProjectSuffix = this.SettingsService.CoreProjectSuffix,
                FileName = viewModelName + ".cs",
                ProjectFolder = "ViewModels",
                Tokens = tokens,
                ShortTemplateName = templateName,
                TemplateName = this.SettingsService.ItemTemplatesDirectory + "\\ViewModels\\" + templateName
            };

            TextTransformationRequest textTransformationRequest = new TextTransformationRequest
            {
                SourceFile = textTemplateInfo.TemplateName,
                Parameters = textTemplateInfo.Tokens,
                RemoveFileHeaders = this.SettingsService.RemoveDefaultFileHeaders,
                RemoveXmlComments = this.SettingsService.RemoveDefaultComments,
                RemoveThisPointer = this.SettingsService.RemoveThisPointer
            };

            textTemplateInfo.TextOutput = this.GetTextTransformationService().Transform(textTransformationRequest).Output;

            return textTemplateInfo;
        }
        /// <summary>
        /// Gets the unit testing item template.
        /// </summary>
        /// <param name="view">The view.</param>
        /// <param name="viewModelName">Name of the view model.</param>
        /// <returns>A TextTemplateInfo.</returns>
        internal TextTemplateInfo GetUnitTestingItemTemplate(
            View view,
            string viewModelName)
        {
            TraceService.WriteLine("ViewModelAndViewsFactory::GetUnitTestingItemTemplate viewModelName=" + viewModelName + " view=" + view.Name);

            string templateName = this.GetTestViewModelTemplate(FrameworkType.MvvmCross.GetValueFromDescription<FrameworkType>(view.Framework), view.PageType);

            Dictionary<string, string> tokens = new Dictionary<string, string>
            {
                { "ClassName", "Test" + viewModelName },
                { "NameSpace", this.VisualStudioService.CoreTestsProjectService.Name + ".ViewModels" },
                { "TestingLibrary", this.testingFrameworkFactory.GetTestingLibrary() },
                { "TestingClassAttribute", this.testingFrameworkFactory.GetTestingClassAttribute() },
                { "TestingMethodAttribute", this.testingFrameworkFactory.GetTestingMethodAttribute() },
                { "TestableObject", viewModelName },
                { "TestableObjectInstance", viewModelName.LowerCaseFirstCharacter() }
            };

            TextTemplateInfo textTemplateInfo = new TextTemplateInfo
            {
                ProjectSuffix = this.SettingsService.CoreTestsProjectSuffix,
                FileName = "Test" + viewModelName + ".cs",
                ProjectFolder = "ViewModels",
                Tokens = tokens,
                ShortTemplateName = templateName,
                TemplateName = this.SettingsService.ItemTemplatesDirectory + "\\TestViewModels\\" + templateName
            };

            TextTransformationRequest textTransformationRequest = new TextTransformationRequest
            {
                SourceFile = textTemplateInfo.TemplateName,
                Parameters = textTemplateInfo.Tokens,
                RemoveFileHeaders = this.SettingsService.RemoveDefaultFileHeaders,
                RemoveXmlComments = this.SettingsService.RemoveDefaultComments,
                RemoveThisPointer = this.SettingsService.RemoveThisPointer
            };

            textTemplateInfo.TextOutput = this.GetTextTransformationService().Transform(textTransformationRequest).Output;

            return textTemplateInfo;
        }