Exemplo n.º 1
0
    public void Page_Init(object sender, EventArgs e)
    {
        // When user selects item in the first dropdown (hourly, daily, weekly), display correct second drop down
        ddlMainFrequency.SelectedIndexChanged += (s, ea) => DisplayCorrectExtendedDropDownList();

        // Bind to the event when settings page is being saved and perform a Strands setup call after page is saved
        SettingsGroupViewerControl settingsGroupViewer = ControlsHelper.GetParentControl <SettingsGroupViewerControl>(this);

        // Do nothing if this form control is not placed under SettingsGroupViewerControl control (can happen in form control preview for example)
        if (settingsGroupViewer != null)
        {
            settingsGroupViewer.SettingsSave.After += (s, ea) =>
            {
                if (StrandsSettings.IsStrandsEnabled(SiteContext.CurrentSiteName))
                {
                    try
                    {
                        var setupCall = new StrandsSetupCall();
                        setupCall.DoWithDefaults();
                    }
                    catch (Exception ex)
                    {
                        EventLogProvider.LogException("Strands Recommender", "SETUPCALL", ex);
                    }
                }
            };
        }
    }
    public void Page_Init(object sender, EventArgs e)
    {
        // When user selects item in the first dropdown (hourly, daily, weekly), display correct second drop down
        ddlMainFrequency.SelectedIndexChanged += (s, ea) => DisplayCorrectExtendedDropDownList();

        // Bind to the event when settings page is being saved and perform a Strands setup call after page is saved
        SettingsGroupViewerControl settingsGroupViewer = ControlsHelper.GetParentControl<SettingsGroupViewerControl>(this);
        // Do nothing if this form control is not placed under SettingsGroupViewerControl control (can happen in form control preview for example)
        if (settingsGroupViewer != null)
        {
            settingsGroupViewer.SettingsSave.After += (s, ea) =>
            {
                if (StrandsSettings.IsStrandsEnabled(SiteContext.CurrentSiteName))
                {
                    try
                    {
                        var setupCall = new StrandsSetupCall();
                        setupCall.DoWithDefaults();
                    }
                    catch (Exception ex)
                    {
                        EventLogProvider.LogException("Strands Recommender", "SETUPCALL", ex);
                    }
                }
            };
        }
    }