private static void CallHandler(object sender, EventHandler eventHandler)
        {
            DispatcherProxy dispatcher = DispatcherProxy.CreateDispatcher();

            if (eventHandler != null)
            {
                if (dispatcher != null && !dispatcher.CheckAccess())
                {
                    dispatcher.BeginInvoke((Action <object, EventHandler>)CallHandler, sender, eventHandler);
                }
                else
                {
                    eventHandler(sender, EventArgs.Empty);
                }
            }
        }
        private static void CallHandler(object sender, EventHandler eventHandler)
        {
            DispatcherProxy dispatcher = DispatcherProxy.CreateDispatcher();

            if (eventHandler != null)
            {
                if (!((dispatcher == null) || dispatcher.CheckAccess()))
                {
                    dispatcher.BeginInvoke(new Action <object, EventHandler>(WeakReferenceManager.CallHandler), new object[] { sender, eventHandler });
                }
                else
                {
                    eventHandler(sender, EventArgs.Empty);
                }
            }
        }
Beispiel #3
0
        private static void CallHandler(object sender, EventHandler eventHandler)
        {
            var dispatcher = DispatcherProxy.CreateDispatcher();

            if (eventHandler != null)
            {
                if (!((dispatcher == null) || dispatcher.CheckAccess()))
                {
                    dispatcher.BeginInvoke(new Action <object, EventHandler>(CallHandler), sender, eventHandler);
                }
                else
                {
                    eventHandler(sender, EventArgs.Empty);
                }
            }
        }
Beispiel #4
0
/// <summary>
///     Loads the module catalog from file.
/// </summary>
/// <param name="filePath">The file path.</param>
/// <returns></returns>
        private static async Task <IEnumerable <ModuleInfo> > LoadModuleCatalogFromFile(string filePath)
        {
            var installFolder = Package.Current.InstalledLocation;
            var file          = await installFolder.GetFileAsync(filePath);

            var str = await FileIO.ReadTextAsync(file);

            ModuleCatalog catalog = null;
            var           disp    = DispatcherProxy.CreateDispatcher();

            if (disp != null)
            {
                await
                disp.Invoke((Action)(() => { catalog = (ModuleCatalog)XamlReader.Load(str); }), CoreDispatcherPriority.Normal);
            }
            return(catalog);
        }