Beispiel #1
0
        private static async Task Launch(IHtmlHelper htmlHelper)
        {
            // Only one thread can execute this at a time

            await ExtensionSemaphoreSlim.WaitAsync();

            try
            {
                await ExtensionHandler.LoadAppExtensions(htmlHelper);
            }
            finally
            {
                ExtensionSemaphoreSlim.Release();
            }
        }
Beispiel #2
0
        private static async Task HandleChangedAppExtensions(IHtmlHelper htmlHelper)
        {
            // Just an extra check so that unnecessary semaphore is avoided
            if (ExtensionWatcher.CmsExtensionWatcherFailed || ExtensionWatcher.ContentExtensionWatcherFailed ||
                ExtensionWatcher.CmsChangedExtensionUrls.Count > 0 || ExtensionWatcher.ContentChangedExtensionUrls.Count > 0)
            {
                await ExtensionSemaphoreSlim.WaitAsync();

                // Only one thread can execute this at a time

                try
                {
                    if (ExtensionWatcher.CmsExtensionWatcherFailed || ExtensionWatcher.ContentExtensionWatcherFailed)
                    {
                        await ExtensionHandler.LoadAppExtensions(htmlHelper);

                        ExtensionWatcher.CmsExtensionWatcherFailed     = false;
                        ExtensionWatcher.ContentExtensionWatcherFailed = false;

                        ExtensionWatcher.CmsChangedExtensionUrls.Clear();
                        ExtensionWatcher.ContentChangedExtensionUrls.Clear();
                    }

                    foreach (var extUrl in ExtensionWatcher.CmsChangedExtensionUrls)
                    {
                        await ExtensionHandler.LoadAppExtension(extUrl, htmlHelper);
                    }

                    foreach (var extUrl in ExtensionWatcher.ContentChangedExtensionUrls)
                    {
                        await ExtensionHandler.LoadAppExtension(extUrl, htmlHelper);
                    }

                    ExtensionWatcher.CmsChangedExtensionUrls.Clear();
                    ExtensionWatcher.ContentChangedExtensionUrls.Clear();
                }
                finally
                {
                    ExtensionSemaphoreSlim.Release();
                }
            }
        }