标签: event-handling

将侦听器添加到Outlook中的其他文件夹

我试图将侦听器添加到主收件箱和另一个名为“ AssignNumber”的文件夹中。当邮件进入我的主收件箱时,我写了MACRO,侦听新邮件,然后对该邮件进行处理。另一方面,对于我的AssignNumber文件夹,我希望能够将电子邮件拖到该文件夹​​中,并且一旦将电子邮件拖放到该文件夹​​中,该文件夹就会侦听它们,然后执行一些我将不涉及的其他操作。我的问题是,我所有用于侦听进入MAIN INBOX的邮件的代码都是在ThisOutlookSession中编写的,我不知道在哪里添加侦听AssignNumber文件夹的代码。这是我在ThisOutlookSession中拥有的代码:

    Private WithEvents Items As Outlook.Items

    Private Sub Application_Startup()
       Dim olApp As Outlook.Application
       Dim objNS As Outlook.NameSpace
       Set olApp = Outlook.Application
       Set objNS = olApp.GetNamespace("MAPI")
       ' default local Inbox
       Set Items = objNS.GetDefaultFolder(olFolderInbox).Items
    End Sub

    Private Sub Items_ItemAdd(ByVal item As Object)
    'do Stuff to mailitem
    End Sub
Run Code Online (Sandbox Code Playgroud)

我不知道在哪里/如何添加类似的代码,这些代码将侦听我的AssignNumber文件夹中拖放到其中的项目。谁能帮忙?非常感谢。

vba event-handling listener outlook-2010

0
推荐指数
1
解决办法
2490
查看次数

如何使用DropDownList的SelectedIndexChanged事件

我的DropDownListwebform中有两个s,当我在第一个下拉列表中选择一个值时,我希望在第二个下拉列表中自动选择一个相关值.

这就是我目前拥有的:

    <table>   
        <tr>
            <td>
                <asp:Label ID="lbmanu" runat="server" Text="Furniture Manufacturer : 
                   "></asp:Label>
            </td>
            <td>
                <asp:DropDownList ID="ddmanu" runat="server" 
                    DataSourceID="Sql_fur_model_manu"    
                    DataTextField="manufacturer" DataValueField="manufacturer" 
                    onselectedindexchanged="ddmanu_SelectedIndexChanged">
                </asp:DropDownList>
                <asp:SqlDataSource ID="Sql_fur_model_manu" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:conStr %>" 
                    SelectCommand="SELECT DISTINCT [manufacturer] FROM 
                     [furniture_manufacturer]">
                </asp:SqlDataSource>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="lbtype" runat="server" Text="Furniture Type : 
                        "></asp:Label>
            </td>
            <td>
                <asp:DropDownList ID="ddtype" runat="server" AutoPostBack="True">
                   </asp:DropDownList>
            </td>
        </tr>
   </table>
Run Code Online (Sandbox Code Playgroud)

代码背后:

protected void ddmanu_SelectedIndexChanged(object sender, EventArgs e)
{
    string query = "select furniture from furniture_model where manufacturer='" + 
    ddmanu.SelectedValue.ToString() + "'";
    con.Open();
    cmd …
Run Code Online (Sandbox Code Playgroud)

c# asp.net webforms event-handling

0
推荐指数
2
解决办法
10万
查看次数

jQuery卸载事件仅用于关闭窗口而不用于链接导航

我在关闭页面时使用此代码注销用户,但用户也会在点击其他链接(同一网站)时注销:

  $( window ).unload(function() {
    $.ajax({url:"?logout&leave=yes", async:false})
  });
Run Code Online (Sandbox Code Playgroud)

有没有办法区分链接导航和真实页面关闭?

编辑:

我目前正在实施此解决方案,但它缺乏检测页面重新加载

  $('a').click(function(){
      var url = $(this).attr("href");
      window.onbeforeunload = null;
      $(window).unbind('beforeunload');
      window.location = url;
  });
Run Code Online (Sandbox Code Playgroud)

ajax jquery event-handling javascript-events

0
推荐指数
1
解决办法
1万
查看次数

HTML5如何获取被点击的对象的ID?

我有一个像这样的画布列表:

<div id="lists" style="position:absolute">
        <ul>
            <li>
                <canvas id="product1" class="product" width="1200" height="360"></canvas>
            </li>
            <li>
                <canvas id="product2" class="product" width="1200" height="360"></canvas>
            </li>
            <li>
                <canvas id="product3" class="product" width="1200" height="360"></canvas>
            </li>
            <li>
                <canvas id="product4" class="product" width="1200" height="360"></canvas>
            </li>
            <li>
                <canvas id="product5" class="product" width="1200" height="360"></canvas>
            </li>
        </ul>
    </div>
Run Code Online (Sandbox Code Playgroud)

我想为所有五个游说者写一个事件监听器:

$(".product").mousedown(function(e) {

}
Run Code Online (Sandbox Code Playgroud)

我想知道用户在事件处理程序中单击了哪个画布.有没有办法知道这个?如果我为五幅画布写了五个事件处理程序,代码就会太难看了.

javascript html5 event-handling

0
推荐指数
1
解决办法
331
查看次数

除非单击输入元素,否则单击时淡出

.container需求淡出,当用户点击任何地方,但不是当用户点击输入字段.

有没有办法让它淡出,除非单击输入字段?

小提琴

$('.container').click(function () {
    $(this).fadeOut();
});
Run Code Online (Sandbox Code Playgroud)
<div class="container">
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aperiam eum ad adipisci velit assumenda cupiditate molestias facere officia neque maxime voluptatum officiis libero animi sit a accusamus culpa quasi quis!</p>
    <input type="text" name="" id="" autofocus />
</div>
Run Code Online (Sandbox Code Playgroud)

奖励积分如果适用于旧版浏览器.

javascript css jquery event-handling

0
推荐指数
1
解决办法
116
查看次数

asp.net页面上的编译器错误与表单提交

我尝试通过asp按钮来提交.我得到的错误是'ASP.default_aspx中没有定义vor SubmitBtn_Click.

BootstrapASP.Master:

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="BootstrapASP.master.cs" Inherits="Shift.BootstrapASP" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html" charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <title>Shift</title>
    <link type="text/css" rel="stylesheet" href="css/bootstrap.css" /> 
    <link type="text/css" rel="stylesheet" href="css/main.css" /> 
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
      <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
    <![endif]-->
    <asp:ContentPlaceHolder ID="head" runat="server"></asp:ContentPlaceHolder>
</head>
<body>
    <div>
        <asp:ContentPlaceHolder ID="ContentMain" runat="server"></asp:ContentPlaceHolder> …
Run Code Online (Sandbox Code Playgroud)

c# forms asp.net event-handling

0
推荐指数
1
解决办法
368
查看次数

将参数传递给循环中的事件

我从数据库加载了一些带有图像位置的Picturebox,我想将参数(价格和名称)传递给循环中的click事件处理程序

代码看起来像这样:

private void Caisse_Load(object sender, EventArgs e)
    {

        int repetition = 0;
        int rep = 1;
        textMontant.Text = mont;
        SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["Test"].ToString());
        con.Open();
        SqlCommand cmd = new SqlCommand( "select desig_prd,prix_prd ,image from Produit ",con);

       using (SqlDataReader reader1 = cmd.ExecuteReader())
       {
           while (reader1.Read())
           {
               if (repetition % 3== 0)
                   repetition = 0;

               PictureBox p = new PictureBox();

              p.Click += new System.EventHandler(P_Click(sender, 
              new MyEventArgs { design = reader1["desig_prd"].ToString(), prix = (float)reader1["prix_prd"] }));

               p.ImageLocation = reader1["image"].ToString();

              p.Height = 100;
              p.Width …
Run Code Online (Sandbox Code Playgroud)

c# events parameter-passing event-handling winforms

0
推荐指数
1
解决办法
142
查看次数

何时删除事件处理程序

我真的需要知道何时删除事件处理程序。创建用户控件时,c#是否会自动删除事件处理程序,并将其添加到控件的模板部分中?

我在WPF窗口的Loaded事件中添加的事件处理程序呢?我应该在它们的比窗口关闭事件中删除它们吗?还是C#会为我做到?

那其他情况呢?我到底有多少要删除事件处理程序?

c# event-handling

0
推荐指数
1
解决办法
85
查看次数

C# - 自定义引发事件的问题

我有我的课程,我定义了我的活动:

public class EventRaiserUtility
{
    public event EventHandler updateList;

    public void updateListEvent()
    {
        if (updateList != null)
        {
            updateList(this, EventArgs.Empty);
        }
    }
    public static EventRaiserUtility raiser = new EventRaiserUtility();
}
Run Code Online (Sandbox Code Playgroud)

这就是我举起活动的地方:

EventRaiserUtility.raiser.updateListEvent();
Run Code Online (Sandbox Code Playgroud)

最后这是我正在尝试创建监听器的地方:

...
EventRaiserUtility.raiser.updateList += new EventHandler(raiser_updateList);
//placed in the init method of another class
...

private void raiser_updateList(object sender, EventArgs e)
{
    connType = MainWindowViewModel.getTTC();
}
Run Code Online (Sandbox Code Playgroud)

简单地说:此事件必须在更新列表时通知,然后使用getTTC()with 更新另一个列表raiser_updateList.

但从raiser_updateList未被称为.为什么?我所有的3个代码段都在3个不同的类(同一个项目)中,但这不是问题......对吧?

c# wpf events event-handling custom-events

0
推荐指数
1
解决办法
94
查看次数

带有eventFilter的PyQt4信号和插槽

我无法接收事件过滤器发送的信号.在下面的示例中,按下按下的信号/插槽工作正常,并且焦点输出滤波器信号发出OK.然而,焦点输出信号没有被截取,并且插槽不会触发.知道我做错了什么吗?

from PyQt4.QtCore import SIGNAL, QObject, QEvent
from PyQt4.QtGui import QApplication, QLabel, QWidget, QLineEdit, QPushButton, QTextEdit, QVBoxLayout

class SignalOnFocus(QWidget):
    def __init__(self):
        super(SignalOnFocus, self).__init__()
        layout = QVBoxLayout()
        self.label = QLabel("Type in some text then push button")
        self.inputLineEdit1 = QLineEdit()
        self.inputLineEdit1.setObjectName("inputLineEdit1")

        self.focusOutFilter = FocusOutFilter()
        self.inputLineEdit1.installEventFilter(self.focusOutFilter)
        self.connect(self.inputLineEdit1, SIGNAL("focus_out"),
                 self.focusLost)
        self.inputLineEdit2 = QLineEdit()
        self.inputLineEdit2.setObjectName("inputLineEdit2")
        self.mousePressedFilter = MousePressedFilter()
        self.inputLineEdit2.installEventFilter(self.mousePressedFilter)
        self.connect(self.inputLineEdit2, SIGNAL("mouse_clicked"), self.mouseClicked)
        self.button1 = QPushButton("Press me")
        self.button1.setObjectName("button1")
        self.connect(self.button1, SIGNAL("clicked()"), self.buttonPressed)
        self.textEdit = QTextEdit()
        layout.addWidget(self.label)
        layout.addWidget(self.inputLineEdit1)
        layout.addWidget(self.inputLineEdit2)
        layout.addWidget(self.button1)  
        layout.addWidget(self.textEdit)
        self.setLayout(layout)

    def mouseClicked(self):
        self.textEdit.append(" mouse clicked")

    def …
Run Code Online (Sandbox Code Playgroud)

python pyqt event-handling signals-slots pyqt4

0
推荐指数
1
解决办法
1501
查看次数