为什么要“线程化"?是Visual Studio未知的吗? [英] Why "threading" is unknown for visual studio?

查看:91
本文介绍了为什么要“线程化"?是Visual Studio未知的吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我包含了using System.Windows;,但是线程仍然在命名空间中不存在 ?!

I include using System.Windows; but threading still it doesn't exist in the namespace ?!

            using System;
        using System.Collections.Generic;
        using System.Linq;
        using System.Web;
        using System.Web.UI;
        using System.Web.UI.WebControls;
        using System.Data.SqlClient;
        using System.Configuration;
        using System.Data;
        using System.Net.Mail;
        using System.Net;
        using System.ComponentModel;
        using System.Drawing;
        using System.Text;
        using System.Windows;
        using System.Timers;
        using Graduation_Project;




        namespace GP
        {
            public partial class Register : System.Web.UI.Page
            {
                static int count = 0;
                static int timer = 600;
                protected void Page_Load(object sender, EventArgs e)
                {

                    System.Windows.Threading.DispatcherTimer dt = new System.Windows.Threading.DispatcherTimer();
                    dt.Interval = new TimeSpan(0, 0, 0, 0, 600000); // 600000 Milliseconds
                    dt.Tick += new EventHandler(dt_Tick); 

                }

仍有问题

推荐答案

System.Windows.Threading.DispatcherTimerWindowsBase.dll程序集中.确保您已添加对该程序集的引用.

System.Windows.Threading.DispatcherTimer is in WindowsBase.dll assembly. Make sure you have added reference to that assembly.

MSDN -

更新-

DispatcherTimer用于WPF and Silverlight apps.它不能用于asp.net项目.相反,您应该使用计时器类用于Web项目.

DispatcherTimer is meant for WPF and Silverlight apps. It can't be used for asp.net project. Instead you should use Timer class meant for web projects.

这篇关于为什么要“线程化"?是Visual Studio未知的吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆