/// <summary>
        /// Install the plugin
        /// </summary>
        public override async Task InstallAsync()
        {
            if (await _scheduleTaskService.GetTaskByTypeAsync(SCRAPE_TASK_NAME) == null)
            {
                await _scheduleTaskService.InsertTaskAsync(new Core.Domain.Tasks.ScheduleTask
                {
                    Enabled = false,
                    Name    = "Scrape from buy.am",
                    Type    = SCRAPE_TASK_NAME,
                    Seconds = 5 * 60
                });
            }

            await base.InstallAsync();
        }
Esempio n. 2
0
        /// <summary>
        /// Install the plugin
        /// </summary>
        public override async Task InstallAsync()
        {
            var pluginDescriptor = await _pluginService.GetPluginDescriptorBySystemNameAsync <IPlugin>(systemName : "ExternalAuth.Facebook", LoadPluginsMode.NotInstalledOnly);

            if (pluginDescriptor != null && pluginDescriptor.Installed) /* is not enabled */
            {
                throw new NopException("Please Uninstall Facebook authentication plugin to use this plugin");
            }

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.ExternalAuth.plugin.IsEnabled", "Enabled");

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.ExternalAuth.plugin.IsEnabled.Hint", "Check if you want to Enable this plugin.");

            //locales for facebook
            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.ExternalAuth.Facebook.ClientKeyIdentifier", "App ID/API Key");

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.ExternalAuth.Facebook.ClientKeyIdentifier.Hint", "Enter your app ID/API key here. You can find it on your FaceBook application page.");

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.ExternalAuth.Facebook.ClientSecret", "App Secret");

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.ExternalAuth.Facebook.ClientSecret.Hint", "Enter your app secret here. You can find it on your FaceBook application page.");

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.ExternalAuth.Facebook.IsEnabled", "Is enabled");

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.ExternalAuth.Facebook.IsEnabled.Hint", "Indicates whether the facebook login is enabled/active.");

            //locales for Twitter
            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.ExternalAuth.Twitter.ConsumerKey", "Consumer ID/API Key");

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.ExternalAuth.Twitter.ConsumerKey.Hint", "Enter your Consumer ID/API key here. You can find it on your Twitter application page.");

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.ExternalAuth.Twitter.ConsumerSecret", "Consumer Secret");

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.ExternalAuth.Twitter.ConsumerSecret.Hint", "Enter your Consumer secret here. You can find it on your Twitter application page.");

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.ExternalAuth.Twitter.IsEnabled", "Is enabled");

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.ExternalAuth.Twitter.IsEnabled.Hint", "Indicates whether the twitter login is enabled/active.");

            //locales for Google
            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.ExternalAuth.Google.ClientId", "Client ID/API Key");

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.ExternalAuth.Google.ClientId.Hint", "Enter your Client ID/API key here. You can find it on your Google application page.");

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.ExternalAuth.Google.ClientSecret", "Client Secret");

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.ExternalAuth.Google.ClientSecret.Hint", "Enter your Client secret here. You can find it on your Google application page.");

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.ExternalAuth.Google.IsEnabled", "Is enabled");

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.ExternalAuth.Google.IsEnabled.Hint", "Indicates whether the google login is enabled/active.");

            //locales for Microsoft
            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.ExternalAuth.Microsoft.ClientId", "Client ID/API Key");

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.ExternalAuth.Microsoft.ClientId.Hint", "Enter your Client ID/API key here. You can find it on your Microsoft application page.");

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.ExternalAuth.Microsoft.ClientSecret", "Client Secret");

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.ExternalAuth.Microsoft.ClientSecret.Hint", "Enter your Client secret here. You can find it on your Microsoft application page.");

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.ExternalAuth.Microsoft.IsEnabled", "Is enabled");

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.ExternalAuth.Microsoft.IsEnabled.Hint", "Indicates whether the microsoft login is enabled/active.");

            //locales for LinkedIn
            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.ExternalAuth.LinkedIn.ClientId", "Client ID/API Key");

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.ExternalAuth.LinkedIn.ClientId.Hint", "Enter your Client ID/API key here. You can find it on your LinkedIn application page.");

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.ExternalAuth.LinkedIn.ClientSecret", "Client Secret");

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.ExternalAuth.LinkedIn.ClientSecret.Hint", "Enter your Client secret here. You can find it on your LinkedIn application page.");

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.ExternalAuth.LinkedIn.IsEnabled", "Is enabled");

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.ExternalAuth.LinkedIn.IsEnabled.Hint", "Indicates whether the linkedIn login is enabled/active.");

            _widgetSettings.ActiveWidgetSystemNames.Add(AuthenticationDefaults.PluginSystemName);
            await _settingService.SaveSettingAsync(_widgetSettings);

            if (await _scheduleTaskService.GetTaskByTypeAsync(WeekdayProductRotation.PRODUCT_ROTATION_TASK) == null)
            {
                await _scheduleTaskService.InsertTaskAsync(new Core.Domain.Tasks.ScheduleTask
                {
                    Enabled = false,
                    Name    = "Product rotation task",
                    Type    = WeekdayProductRotation.PRODUCT_ROTATION_TASK,
                    Seconds = 5 * 60
                });
            }

            await base.InstallAsync();
        }