private void initializeCodeActivity_ExecuteCode(object sender, EventArgs e)
        {
            FileBasedFunctionProvider <UserControlBasedFunction> provider;
            FileBasedFunction <UserControlBasedFunction>         function;

            GetProviderAndFunction((FileBasedFunctionEntityToken)this.EntityToken, out provider, out function);

            string title = Path.GetFileName(function.VirtualPath);

            this.Bindings.Add("Title", title);

            string[] files = GetFiles(function);

            // Binding all the files
            for (int i = 0; i < files.Length; i++)
            {
                var websiteFile = new WebsiteFile(files[i]);

                string bindingPrefix = GetBindingPrefix(i);

                this.Bindings.Add(bindingPrefix + "Content", websiteFile.ReadAllText());
                this.Bindings.Add(bindingPrefix + "Name", websiteFile.FileName);
                this.Bindings.Add(bindingPrefix + "MimeType", websiteFile.MimeType);
            }
        }
        private void initializeCodeActivity_ExecuteCode(object sender, EventArgs e)
        {
            string filePath = GetFilePath();

            WebsiteFile websiteFile = new WebsiteFile(filePath);

            this.Bindings.Add("FileContent", websiteFile.ReadAllText());
            this.Bindings.Add("FileName", websiteFile.FileName);
            this.Bindings.Add("FileMimeType", websiteFile.MimeType);
        }
        private void initializeCodeActivity_ExecuteCode(object sender, EventArgs e)
        {
            FileBasedFunctionProvider <RazorBasedFunction> provider;
            FileBasedFunction <RazorBasedFunction>         function;

            GetProviderAndFunction((FileBasedFunctionEntityToken)this.EntityToken, out provider, out function);

            string title = Path.GetFileName(function.VirtualPath);

            this.Bindings.Add("Title", title);

            string file = GetFile(function);

            var websiteFile = new WebsiteFile(file);

            this.Bindings.Add("FileContent", websiteFile.ReadAllText());
            this.Bindings.Add("FileName", websiteFile.FileName);
            this.Bindings.Add("FileMimeType", websiteFile.MimeType);
        }
        private void initializeCodeActivity_ExecuteCode(object sender, EventArgs e)
        {
            var entityToken = this.EntityToken;

            string title;

            if (entityToken is PageTemplateEntityToken)
            {
                title = GetPageTemplate().Title;
            }
            else
            {
                var sharedFileEntityToken = (SharedCodeFileEntityToken)entityToken;

                title = Path.GetFileName(sharedFileEntityToken.VirtualPath);
            }

            this.Bindings.Add("TemplateTitle", title);

            string[] files = GetFiles();

            // Binding all the files
            for (int i = 0; i < files.Length; i++)
            {
                var websiteFile = new WebsiteFile(files[i]);

                string bindingPrefix = GetBindingPrefix(i);

                this.Bindings.Add(bindingPrefix + "Content", websiteFile.ReadAllText());
                this.Bindings.Add(bindingPrefix + "Name", websiteFile.FileName);
                // Assigning "text/html" mimetype so CodeMirror will show it correctly

                // this.Bindings.Add(bindingPrefix + "MimeType", i == 0 ? HtmlMimeType : websiteFile.MimeType);
                this.Bindings.Add(bindingPrefix + "MimeType", websiteFile.MimeType);
            }
        }