小编And*_*rew的帖子

将更多dll加载到代码中会导致崩溃

我正在帮助开发的系统的一个要求是导入文件的能力,我们有一组适配器来处理我们期望遇到的不同类型的文件(csv,xml等).在开发的早期阶段,我们通过引用和使用命令对数据适配器进行硬编码.显然,当这个上线时,我们想要的情况是我们可以编写一个新的适配器并将dll抛出到一个文件夹中并运行该过程而无需重新编译代码.

为了实现这一点,我改编了这个问题的代码.有问题的代码位于构造函数中,如下所示

string dllLocation = @"C:MyLocation\dllLocation";
DirectoryInfo dir = new DirectoryInfo(dllLocation);
var tempfiles = dir.GetFiles("*Adapter*.dll", SearchOption.AllDirectories);     // This will need to be changed when we go live

    foreach (var file in tempfiles)
    {
        Assembly tempAssembly = null;

        //Before loading the assembly, check all current loaded assemblies in case already loaded
        //has already been loaded as a reference to another assembly
        //Loading the assembly twice can cause major issues
        foreach (Assembly loadedAssembly in AppDomain.CurrentDomain.GetAssemblies())
        {
            //Check the assembly is …
Run Code Online (Sandbox Code Playgroud)

c#

6
推荐指数
1
解决办法
213
查看次数

document.ActiveElement 不返回 Safari 中的活动元素

在我正在编写的网站中,需要在某些事情发生之前显示一些确认文本。我使用的解决方案在按钮单击时显示一个模态窗口,当窗口关闭时,Jquery 会查看单击了哪个按钮。

所以我有以下用于注销确认

$(function () {
    $('#logOut').on('click', function () {
        url = $(this).data('request-url');
        $('#modalLogout').modal('show');
    });

    $('#modalLogout').on('hide.bs.modal', function () {
        var activeElement = $(document.activeElement);

        if (activeElement.is('[data-toggle], [data-dismiss]')) {
            if (activeElement[0].id === "LogoutOk") {
                window.location.href = url;
            }
        }
    });
});
Run Code Online (Sandbox Code Playgroud)

和模态窗口

<div id="modalLogout" class="modal fade" role="dialog">
<div class="modal-dialog modal-sm" role="document">
    <div class="modal-content">
        <div class="modal-body">
            <p>Do you want to log out?</p>
        </div>
        <div class="modal-footer">
            <button type="button" class="btn btn-default" data-dismiss="modal" id="LogoutCancel">Cancel</button>
            <button type="button" class="btn btn-warning" data-dismiss="modal" id="LogoutOk">OK</button>
        </div>
    </div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)

在 Windows …

safari jquery

2
推荐指数
1
解决办法
5562
查看次数

标签 统计

c# ×1

jquery ×1

safari ×1