protected void Page_Load(object sender, EventArgs e)
    {
        txtText.Editor.Language = LanguageEnum.HTMLMixed;

        // Set window title and image
        CurrentMaster.Title.TitleText  = GetString("EditingFormControl.TitleText");
        CurrentMaster.Title.TitleImage = GetImageUrl("Design/Controls/EditingFormControl/title.png");

        // Set macro options using the querystring argument
        bool allowMacros = QueryHelper.GetBoolean("allowMacros", true);

        if (allowMacros)
        {
            string resolverName = QueryHelper.GetString("resolverName", null);
            if (!string.IsNullOrEmpty(resolverName))
            {
                macroSelectorElem.Resolver = ResolverFactory.GetResolver(resolverName);
            }
            else
            {
                macroSelectorElem.Resolver = EmailTemplateMacros.EmailTemplateResolver;
            }
            macroSelectorElem.ExtendedTextAreaElem = txtText.Editor.EditorID;
            macroSelectorElem.TextAreaID           = txtText.Editor.ClientID;
        }
        else
        {
            macroSelectorElem.Visible = false;
        }

        // Register macro scripts
        RegisterModalPageScripts();
        RegisterEscScript();
    }
Exemple #2
0
    /// <summary>
    /// Page load.
    /// </summary>
    protected void Page_Load(object sender, EventArgs e)
    {
        // Set control style and css class
        if (!string.IsNullOrEmpty(ControlStyle))
        {
            txtMacro.Editor.Attributes.Add("style", ControlStyle);
        }
        if (!string.IsNullOrEmpty(CssClass))
        {
            txtMacro.Editor.CssClass = CssClass;
        }

        txtMacro.ShowAutoCompletionAbove = ShowAutoCompletionAbove;
        txtMacro.Editor.UseSmallFonts    = true;
        txtMacro.MixedMode = false;

        txtMacro.Resolver = ResolverFactory.GetResolver(ResolverName);

        var ed = txtMacro.Editor;

        ed.ShowToolbar     = false;
        ed.ShowLineNumbers = false;
        ed.DynamicHeight   = true;

        string script = @"
function InsertMacroCondition" + this.ClientID + @"(text) {
    var hidden = document.getElementById('" + hdnValue.ClientID + @"');
    hidden.value = text;
    " + ControlsHelper.GetPostBackEventReference(btnRefresh, null) + @";
}";

        ScriptHelper.RegisterClientScriptBlock(Page, typeof(string), "InsertMacroCondition" + this.ClientID, script, true);
        ScriptHelper.RegisterDialogScript(Page);

        btnEdit.ToolTip  = GetString("macrodesigner.edit");
        btnEdit.ImageUrl = GetImageUrl("Design/Controls/UniGrid/Actions/Edit.png");
        btnEdit.Click   += new ImageClickEventHandler(btnEdit_Click);

        btnClear.ToolTip       = GetString("macrodesigner.clearcondition");
        btnClear.ImageUrl      = GetImageUrl("Design/Controls/UniGrid/Actions/Clear.png");
        btnClear.OnClientClick = "if (confirm(" + ScriptHelper.GetString(GetString("macrodesigner.clearconditionconfirm")) + ")) { InsertMacroCondition" + this.ClientID + "(''); } return false;";

        btnRefresh.Click += new EventHandler(btnRefresh_Click);

        if (txtMacro.ReadOnly)
        {
            txtMacro.Editor.Language = LanguageEnum.Text;
        }

        if (MaxWidth > 0)
        {
            pnlConditionBuilder.Attributes["style"] += " max-width: " + MaxWidth + "px;";
        }
    }
Exemple #3
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            const string signingSecurityKey = "0d5b3235a8b403c3dab9c3f4f65c07fcalskd234n1k41230";
            var          signingKey         = new SigningSymmetricKey(signingSecurityKey);

            services.AddSingleton <IJwtSigningEncodingKey>(signingKey);
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
            const string jwtSchemeName      = "JwtBearer";
            var          signingDecodingKey = (IJwtSigningDecodingKey)signingKey;

            services
            .AddAuthentication(options => {
                options.DefaultAuthenticateScheme = jwtSchemeName;
                options.DefaultChallengeScheme    = jwtSchemeName;
            })
            .AddJwtBearer(jwtSchemeName, jwtBearerOptions => {
                jwtBearerOptions.TokenValidationParameters = new TokenValidationParameters()
                {
                    ValidateIssuerSigningKey = true,
                    IssuerSigningKey         = signingDecodingKey.GetKey(),

                    ValidateIssuer = true,
                    ValidIssuer    = "Shop",

                    ValidateAudience = true,
                    ValidAudience    = "Shop",

                    ValidateLifetime = true,

                    ClockSkew = TimeSpan.FromSeconds(5)
                };
            });

            /*
             *
             * var resolver = ResolverFactory.GetResolver(Configuration.GetValue<string>("ProviderType"));
             * resolver.ResolveDB(services,this.Configuration);
             * resolver.ResolveRepositories(services);
             */

            IConfiguration config   = Configuration.GetSection("ProviderType");
            var            resolver = ResolverFactory.GetResolver(config.GetValue <string>("MsSql"));

            resolver.ResolveDb(services, this.Configuration);
            resolver.ResolveRepositories(services);


            // services.Add(new ServiceDescriptor(typeof(ApplicationContext), new ApplicationContext(Configuration.GetConnectionString("DefaultConnection"))));
            // In production, the Angular files will be served from this directory
            services.AddSpaStaticFiles(configuration =>
            {
                configuration.RootPath = "ClientApp/dist";
            });
        }
    private static void Main(string[] args)
    {
        ResolverFactory <Stream, Hat> .RegisterResolver(new MyStreamToHatResolver());

        var res = ResolverFactory <Stream, Hat> .GetResolver();
    }