• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Forms.Timer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Windows.Forms.Timer的典型用法代码示例。如果您正苦于以下问题:C# System.Windows.Forms.Timer类的具体用法?C# System.Windows.Forms.Timer怎么用?C# System.Windows.Forms.Timer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



System.Windows.Forms.Timer类属于命名空间,在下文中一共展示了System.Windows.Forms.Timer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GameMultiplayerControl

        public GameMultiplayerControl(Control Control, GameScreen GameScreen, int MapIndex, int SaveGameIndex, MultiplayerMatchStartInformation MP)
            : base(Control, GameScreen, MapIndex, SaveGameIndex, true)
        {
            this.UserName = MP.UserName;
            this.Password = MP.Password;
            this.MatchId = MP.MatchId;
            this.GameState = 0;
            this.MultiplayerMatch = true;
            this.MultiplayerFraction = MP.MultiplayerFraction;

            // timer checking if a newer game state is available
            NewGameStateAvailableTimer = new System.Windows.Forms.Timer();
            NewGameStateAvailableTimer.Interval = 1000;
            NewGameStateAvailableTimer.Tick += UpdateGameState;
            NewGameStateAvailableTimer.Start();

            // show multiplayer tab (gui) and update it's content
            GameScreen.TabItem_Multiplayer.Visibility = Visibility.Visible;
            GameScreen.Button_Restart.IsEnabled = false; // disable restart map button for multiplayer matches
            GameScreen.Label_Multiplayer_MatchID.Content = R.String("MatchID") + ": " + MatchId.ToString();
            GameScreen.Label_Multiplayer_MatchVersion.Content = R.String("MatchVersion") + ": " + GameState.ToString();

            // background worker
            BackgroundWorkerDownloadLatestGameState.DoWork += BackgroundWorkerDownloadLatestGameStateWork;
            BackgroundWorkerDownloadLatestGameState.RunWorkerCompleted += BackgroundWorkerDownloadLatestGameState_RunWorkerCompleted;
        }
开发者ID:Simsso,项目名称:Crusades,代码行数:26,代码来源:GameMultiplayerControl.cs


示例2: TvNotifyManager

    public TvNotifyManager()
    {
      using (Settings xmlreader = new MPSettings())
      {
        _enableRecNotification = xmlreader.GetValueAsBool("mytv", "enableRecNotifier", false);
        _preNotifyConfig = xmlreader.GetValueAsInt("mytv", "notifyTVBefore", 300);
      }

      _busy = false;
      _timer = new Timer();
      _timer.Stop();
      // check every 15 seconds for notifies
      _dummyuser = new User();
      _dummyuser.IsAdmin = false;
      _dummyuser.Name = "Free channel checker";
      _timer.Interval = 15000;
      _timer.Enabled = true;
      // Execute TvNotifyManager in a separate thread, so that it doesn't block the Main UI Render thread when Tvservice connection died
      new Thread(() =>
                   {
                     _timer.Tick += new EventHandler(_timer_Tick);

                   }
        ) {Name = "TvNotifyManager"}.Start();
      _notifiedRecordings = new ArrayList();
    }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:26,代码来源:TvNotifyManager.cs


示例3: Open

        public void Open()
        {
            try
            {
                bool isConnected = FindTheHid(vendorId, productId);

                if (isConnected)
                {
                    Tracer.Trace("OK: USB Interface connected with PIC USB Proximity Board");
                }
                else
                {
                    string str = string.Format("USB Interface could not connect with device with Vendor ID={0} Product ID={1}", vendorId, productId);
                    Tracer.Error(str);
                    throw new Exception(str);
                }

                // run a monitoring thread in case we need to reset things:
                picUsbTickerTimer = new System.Windows.Forms.Timer();
                picUsbTickerTimer.Interval = 1000;    // ms
                picUsbTickerTimer.Tick += new EventHandler(picUsbTicker);
                picUsbTickerTimer.Start();

                Tracer.Trace("OK: PIC Proximity Board ticker ON");
            }
            catch (Exception ex)
            {
                Tracer.Error(ex);
                throw;
            }
        }
开发者ID:slgrobotics,项目名称:TrackRoamer,代码行数:31,代码来源:ProximityModule.cs


示例4: InitializeComponent

 /// <summary>
 /// 设计器支持所需的方法 - 不要
 /// 使用代码编辑器修改此方法的内容。
 /// </summary>
 private void InitializeComponent()
 {
     this.components = new System.ComponentModel.Container();
     this.timer1 = new System.Windows.Forms.Timer(this.components);
     this.timer2 = new System.Windows.Forms.Timer(this.components);
     this.SuspendLayout();
     //
     // timer1
     //
     this.timer1.Enabled = true;
     this.timer1.Interval = 10;
     this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
     //
     // timer2
     //
     this.timer2.Interval = 10;
     this.timer2.Tick += new System.EventHandler(this.timer2_Tick);
     //
     // Frm_Main
     //
     this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
     this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     this.BackgroundImage = global::MoveForm.Properties.Resources.星星图;
     this.ClientSize = new System.Drawing.Size(320, 91);
     this.Name = "Frm_Main";
     this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
     this.Text = "使用Timer组件制作左右飘动的窗体";
     this.ResumeLayout(false);
 }
开发者ID:TGHGH,项目名称:C-1200,代码行数:33,代码来源:Frm_Main.designer.cs


示例5: InitializeComponent

 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.components = new System.ComponentModel.Container();
     this.label1 = new System.Windows.Forms.Label();
     this.progressBar1 = new System.Windows.Forms.ProgressBar();
     this.label2 = new System.Windows.Forms.Label();
     this.timer1 = new System.Windows.Forms.Timer(this.components);
     this.SuspendLayout();
     //
     // label1
     //
     this.label1.AutoSize = true;
     this.label1.Location = new System.Drawing.Point(25, 21);
     this.label1.Name = "label1";
     this.label1.Size = new System.Drawing.Size(35, 13);
     this.label1.TabIndex = 0;
     this.label1.Text = "label1";
     //
     // progressBar1
     //
     this.progressBar1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     | System.Windows.Forms.AnchorStyles.Right)));
     this.progressBar1.Location = new System.Drawing.Point(28, 46);
     this.progressBar1.Name = "progressBar1";
     this.progressBar1.Size = new System.Drawing.Size(230, 23);
     this.progressBar1.Step = 1;
     this.progressBar1.TabIndex = 1;
     //
     // label2
     //
     this.label2.AutoSize = true;
     this.label2.Location = new System.Drawing.Point(34, 76);
     this.label2.Name = "label2";
     this.label2.Size = new System.Drawing.Size(35, 13);
     this.label2.TabIndex = 2;
     this.label2.Text = "label2";
     //
     // timer1
     //
     this.timer1.Enabled = true;
     this.timer1.Interval = 500;
     this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
     //
     // frmProgress
     //
     this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     this.ClientSize = new System.Drawing.Size(284, 98);
     this.Controls.Add(this.label2);
     this.Controls.Add(this.progressBar1);
     this.Controls.Add(this.label1);
     this.MaximizeBox = false;
     this.MinimizeBox = false;
     this.Name = "frmProgress";
     this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
     this.Text = "Progress";
     this.Load += new System.EventHandler(this.frmProgress_Load);
     this.ResumeLayout(false);
     this.PerformLayout();
 }
开发者ID:nwcs,项目名称:BaiduPCS_NET,代码行数:64,代码来源:frmProgress.designer.cs


示例6: ExplosionParticleEmitter

        public ExplosionParticleEmitter(int numParticles)
        {
            MaxParticleCount = numParticles;
            MainTimer = new Timer();
            MainTimer.Tick += AnimationStep;
            MainTimer.Interval = 10;
            Scale = 0.5f;
            Gravity = new Vector(0.0f, 0.0f, 0.0f);
            ExplosionDuration = 70;
            FadeOutDuration = 500;
            StartingColor = Color.FromArgb(255, Color.Orange);
            EndColor = Color.FromArgb(128, Color.Red);
            SmokeColor = Color.FromArgb(0, Color.Black);

            Particles = new List<RectangleParticle>();
            float z = 0.0f;
            for (int i = 0; i < MaxParticleCount; ++i)
            {
                //here we set the constant values of our particle
                var temp = new RectangleParticle(this);
                temp.AnimationTime = 10;
                temp.Location.Z = z;
                temp.Texture = defaultTexture;
                Particles.Add(temp);

                z += 0.1f;
            }
        }
开发者ID:overdrivek,项目名称:severed-infinity,代码行数:28,代码来源:ExplosionParticleEmitter.cs


示例7: InitializeComponent

		/// <summary>
		/// This method is required for Windows Forms designer support.
		/// Do not change the method contents inside the source code editor. The Forms designer might
		/// not be able to load this method if it was changed manually.
		/// </summary>
		private void InitializeComponent()
		{
			this.components = new System.ComponentModel.Container();
			System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Load));
			this.timer1 = new System.Windows.Forms.Timer(this.components);
			this.SuspendLayout();
			// 
			// timer1
			// 
			this.timer1.Enabled = true;
			this.timer1.Interval = 5000;
			this.timer1.Tick += new System.EventHandler(this.Timer1Tick);
			// 
			// Load
			// 
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			this.BackColor = System.Drawing.SystemColors.ControlLightLight;
			this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
			this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
			this.ClientSize = new System.Drawing.Size(700, 210);
			this.Cursor = System.Windows.Forms.Cursors.WaitCursor;
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
			this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
			this.Name = "Load";
			this.Opacity = 0.95D;
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "Load";
			this.TransparencyKey = System.Drawing.Color.Transparent;
			this.UseWaitCursor = true;
			this.Load += new System.EventHandler(this.LoadLoad);
			this.ResumeLayout(false);

		}
开发者ID:njmube,项目名称:Punto_de_venta,代码行数:39,代码来源:Load.Designer.cs


示例8: InitializeComponent

 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.components = new System.ComponentModel.Container();
     this.movementTimer = new System.Windows.Forms.Timer(this.components);
     this.SuspendLayout();
     //
     // movementTimer
     //
     this.movementTimer.Enabled = true;
     this.movementTimer.Interval = 1;
     this.movementTimer.Tick += new System.EventHandler(this.movementTimer_Tick);
     //
     // Notifier
     //
     this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     this.ClientSize = new System.Drawing.Size(116, 12);
     this.DoubleBuffered = true;
     this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
     this.Name = "Notifier";
     this.ShowIcon = false;
     this.ShowInTaskbar = false;
     this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
     this.Text = "Toast Notifier";
     this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.Notifier_FormClosed);
     this.Click += new System.EventHandler(this.Notifier_Click);
     this.Paint += new System.Windows.Forms.PaintEventHandler(this.Notifier_Paint);
     this.MouseEnter += new System.EventHandler(this.Notifier_MouseEnter);
     this.MouseLeave += new System.EventHandler(this.Notifier_MouseLeave);
     this.ResumeLayout(false);
 }
开发者ID:Phoshi,项目名称:LAN-Ring-Messenger,代码行数:36,代码来源:Notifier.designer.cs


示例9: SledSyntaxCheckerService

        public SledSyntaxCheckerService(ISettingsService settingsService)
        {
            Enabled = true;
            Verbosity = SledSyntaxCheckerVerbosity.Overall;

            var enabledProp =
                new BoundPropertyDescriptor(
                    this,
                    () => Enabled,
                    "Enabled",
                    null,
                    "Enable or disable the syntax checker");

            var verboseProp =
                new BoundPropertyDescriptor(
                    this,
                    () => Verbosity,
                    "Verbosity",
                    null,
                    "Verbosity level");

            // Persist settings
            settingsService.RegisterSettings(this, enabledProp, verboseProp);

            // Add user settings
            settingsService.RegisterUserSettings("Syntax Checker", enabledProp, verboseProp);

            m_syncContext = SynchronizationContext.Current;

            m_batchTimer = new Timerz { Interval = TimerIntervalMsec };
            m_batchTimer.Tick += BatchTimerTick;
            m_batchTimer.Start();
        }
开发者ID:arsaccol,项目名称:SLED,代码行数:33,代码来源:SledSyntaxCheckerService.cs


示例10: InitializeComponent

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            this.zedGraphControl1 = new ZedGraph.ZedGraphControl();
            this.timer1 = new System.Windows.Forms.Timer(this.components);
            this.SuspendLayout();
            //
            // zedGraphControl1
            //
            this.zedGraphControl1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.zedGraphControl1.Location = new System.Drawing.Point(0, 0);
            this.zedGraphControl1.Name = "zedGraphControl1";
            this.zedGraphControl1.ScrollGrace = 0D;
            this.zedGraphControl1.ScrollMaxX = 0D;
            this.zedGraphControl1.ScrollMaxY = 0D;
            this.zedGraphControl1.ScrollMaxY2 = 0D;
            this.zedGraphControl1.ScrollMinX = 0D;
            this.zedGraphControl1.ScrollMinY = 0D;
            this.zedGraphControl1.ScrollMinY2 = 0D;
            this.zedGraphControl1.Size = new System.Drawing.Size(872, 372);
            this.zedGraphControl1.TabIndex = 0;

            //
            // DeltaGraphcs
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(872, 372);
            this.Controls.Add(this.zedGraphControl1);
            this.Name = "DeltaGraphcs";
            this.Text = "DeltaGraphcs";
            this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.DeltaGraphcs_FormClosed);
            this.Resize += new System.EventHandler(this.DeltaGraphcs_Resize);
            this.ResumeLayout(false);
        }
开发者ID:tpastor,项目名称:F1_201x_TelemetrySystem,代码行数:39,代码来源:DeltaGraphcs.designer.cs


示例11: DebrisParticleEmitter

        public DebrisParticleEmitter(int numParticles)
        {
            MaxParticleCount = numParticles;
            Particles = new List<RectangleParticle>();
            Gravity = new Vector(0f, -.5f, 0f); ;
            MainTimer = new Timer();
            MainTimer.Tick += AnimationStep;
            MainTimer.Interval = 10;
            Scale = 0.5f;
            ExplosionDuration = 100;
            StartingColor = Color.FromArgb(255, Color.Orange);
            EndColor = Color.FromArgb(255, Color.DarkGray);

            Particles = new List<RectangleParticle>();
            for (int i = 0; i < MaxParticleCount; ++i)
            {
                //here we set the constant values of our particle
                var temp = new RectangleParticle(this);
                temp.Size.X = particleSize.X;
                temp.Size.Y = particleSize.Y;
                temp.AnimationTime = 10;
                temp.TargetColor = EndColor;
                temp.Texture = images[GeneralMath.RandomInt() % images.Length];
                Particles.Add(temp);
            }
        }
开发者ID:overdrivek,项目名称:severed-infinity,代码行数:26,代码来源:DebrisParticleEmitter.cs


示例12: InitializeComponent

        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            this.timer1 = new System.Windows.Forms.Timer(this.components);
            this.LookAtOptions = new System.Windows.Forms.Timer(this.components);
            this.multicastListener1 = new WithClickOnceLANLauncherShared.MulticastListenerComponent();
            this.multicastSend1 = new WithClickOnceLANLauncherShared.MulticastSendComponent();
            // 
            // timer1
            // 
            this.timer1.Enabled = true;
            this.timer1.Interval = 500;
            this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
            // 
            // LookAtOptions
            // 
            this.LookAtOptions.Enabled = true;
            this.LookAtOptions.Interval = 2000;
            this.LookAtOptions.Tick += new System.EventHandler(this.LookAtOptions_Tick);
            // 
            // multicastListener1
            // 
            this.multicastListener1.AtData += new System.Action<string>(this.multicastListener1_AtData);

        }
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:25,代码来源:FindServiceProviderOverMulticast.cs


示例13: InitializeComponent

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            components = new System.ComponentModel.Container();
            tmrApp = new System.Windows.Forms.Timer(components)
            {
                Interval = 2,
                Enabled = true
            };
            SuspendLayout();
            // 
            // tmrApp
            // 
            tmrApp.Tick += new System.EventHandler(tmrApp_Tick);
            // 
            // Maze_Form
            // 
            AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            BackColor = System.Drawing.Color.FromArgb(31,31,31);
            ClientSize = new System.Drawing.Size(484, 461);
            DoubleBuffered = true;
            KeyPreview = true;
            Name = "MazeForm";
            Text = "Maze AI";
            Load += new System.EventHandler(Form1_Load);
            Paint += new System.Windows.Forms.PaintEventHandler(Form1_Paint);
            KeyDown += new System.Windows.Forms.KeyEventHandler(Form1_KeyDown);
            MouseClick += new System.Windows.Forms.MouseEventHandler(Form1_LeftClick);
            MouseMove += new System.Windows.Forms.MouseEventHandler(Form1_MouseMove);
            Resize += new System.EventHandler(Form1_Resize);
            Shown += new System.EventHandler(OnShow);
            ResumeLayout(false);

        }
开发者ID:PeterGerrard,项目名称:Maze-Machine-Learning-Demo,代码行数:38,代码来源:MazeForm.Designer.cs


示例14: InitializeComponent

 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.components = new System.ComponentModel.Container();
     this.timer1 = new System.Windows.Forms.Timer(this.components);
     this.SuspendLayout();
     //
     // timer1
     //
     this.timer1.Enabled = true;
     this.timer1.Interval = 2600;
     this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
     //
     // Pochetna
     //
     this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     this.BackColor = System.Drawing.SystemColors.ControlLight;
     this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
     this.ClientSize = new System.Drawing.Size(864, 674);
     this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
     this.Name = "Pochetna";
     this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
     this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.Pochetna_FormClosed);
     this.Load += new System.EventHandler(this.Pochetna_Load);
     this.Paint += new System.Windows.Forms.PaintEventHandler(this.Pochetna_Paint);
     this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Pochetna_MouseDown);
     this.ResumeLayout(false);
 }
开发者ID:KristijanLaskovski,项目名称:Monopoly,代码行数:32,代码来源:Pochetna.designer.cs


示例15: SplashWindow_ContentRendered

 void SplashWindow_ContentRendered(object sender, EventArgs e)
 {
     System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer();
     timer.Interval = 5000;
     timer.Tick += timer_Tick;
     timer.Enabled = true;
 }
开发者ID:Alexz18z35z,项目名称:Gibbo2D,代码行数:7,代码来源:SplashWindow.xaml.cs


示例16: tweening

        /**
        * @param target_pos target position for each point in Polygon
        * @param frame_count number of frame that construct the tweening
        */
        public void tweening(int[,] start_pos, int[,] target_pos, double progress, Callback callback)
        {
            if (target_pos.GetLength(0) < this.vertices.GetLength(0) || (progress < 0 || progress > 1))
            {
                Console.WriteLine("[Debug] Tweening failed, new points length not match." + progress);
                return;
            }

            for (int i = 0; i < this.vertices.GetLength(0); i++)
            {
                double x = ((1 - progress) * start_pos[i, 0] + (progress * target_pos[i, 0]));
                double y = ((1 - progress) * start_pos[i, 1] + (progress * target_pos[i, 1]));
                Console.WriteLine("[" + i + "] " + x + ", " + y);

                this.vertices[i].translate((int)x, (int)y, false);
            }

            callback();

            return;
            System.Windows.Forms.Timer timr = new System.Windows.Forms.Timer();
            timr.Tick += (sender, e) =>
            {
                for (int i = 0; i < this.vertices.GetLength(0); i++)
                {
                    int x = (int) ((1 - progress) * target_pos[i, 0] + (progress * start_pos[i, 0]));
                    int y = (int) ((1 - progress) * target_pos[i, 1] + (progress * start_pos[i, 1]));

                    this.vertices[i].translate(x, y, false);
                }
            };
            timr.Interval = 50;
            timr.Start();
        }
开发者ID:Abdillah,项目名称:TweenerAnimation,代码行数:38,代码来源:Polygon.cs


示例17: Schedule

        /// <summary>
        /// Schedules action to be executed after dueTime on the message loop associated with the control.
        /// </summary>
        public IDisposable Schedule(Action action, TimeSpan dueTime)
        {
            if (action == null)
                throw new ArgumentNullException("action");

            var dt = Scheduler.Normalize(dueTime);
            var time = (int)dt.TotalMilliseconds;
            if (time == 0)
                return Schedule(action);

            System.Windows.Forms.Timer timer = null;
            Control.Invoke(new Action(() =>
            {
                timer = new System.Windows.Forms.Timer();
                timer.Tick += (s, e) =>
                {
                    var t = timer;
                    if (t != null)
                        t.Enabled = false;
                    timer = null;
                    action();
                };
                timer.Interval = time;
                timer.Enabled = true;
            }));

            return new AnonymousDisposable(() =>
            {
                var t = timer;
                if (t != null)
                    t.Enabled = false;
                timer = null;
            });
        }
开发者ID:modulexcite,项目名称:IL2JS,代码行数:37,代码来源:ControlScheduler.cs


示例18: InitializeComponent

 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.components = new System.ComponentModel.Container();
     this.timer1 = new System.Windows.Forms.Timer(this.components);
     this.img1 = new reSize.Img();
     this.SuspendLayout();
     //
     // timer1
     //
     this.timer1.Interval = 1000;
     this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
     //
     // img1
     //
     this.img1.BackColor = System.Drawing.Color.Transparent;
     this.img1.Location = new System.Drawing.Point(64, 32);
     this.img1.Name = "img1";
     this.img1.Size = new System.Drawing.Size(153, 192);
     this.img1.TabIndex = 1;
     this.img1.Text = "img1";
     this.img1.DoubleClick += new System.EventHandler(this.img1_DoubleClick);
     //
     // face
     //
     this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
     this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
     this.ClientSize = new System.Drawing.Size(292, 273);
     this.Controls.Add(this.img1);
     this.Name = "face";
     this.Text = "双击选框进行裁剪";
     this.Load += new System.EventHandler(this.face_Load);
     this.ResumeLayout(false);
 }
开发者ID:jxb505,项目名称:reSize,代码行数:38,代码来源:face.designer.cs


示例19: InitializeComponent

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            this.lbContacts = new System.Windows.Forms.ListBox();
            this.label1 = new System.Windows.Forms.Label();
            this.btnStartChat = new System.Windows.Forms.Button();
            this.chatCheckTimer = new System.Windows.Forms.Timer(this.components);
            this.SuspendLayout();
            // 
            // lbContacts
            // 
            this.lbContacts.FormattingEnabled = true;
            this.lbContacts.Location = new System.Drawing.Point(12, 25);
            this.lbContacts.Name = "lbContacts";
            this.lbContacts.Size = new System.Drawing.Size(207, 290);
            this.lbContacts.TabIndex = 0;
            this.lbContacts.SelectedIndexChanged += new System.EventHandler(this.lbContacts_SelectedIndexChanged);
            // 
            // label1
            // 
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(12, 9);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(49, 13);
            this.label1.TabIndex = 1;
            this.label1.Text = "Contacts";
            // 
            // btnStartChat
            // 
            this.btnStartChat.Location = new System.Drawing.Point(225, 25);
            this.btnStartChat.Name = "btnStartChat";
            this.btnStartChat.Size = new System.Drawing.Size(106, 23);
            this.btnStartChat.TabIndex = 2;
            this.btnStartChat.Text = "Start Chat";
            this.btnStartChat.UseVisualStyleBackColor = true;
            this.btnStartChat.Click += new System.EventHandler(this.btnStartChat_Click);
            // 
            // chatCheckTimer
            // 
            this.chatCheckTimer.Enabled = true;
            this.chatCheckTimer.Interval = 2000;
            this.chatCheckTimer.Tick += new System.EventHandler(this.chatCheckTimer_Tick);
            // 
            // HoofdForm
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(340, 327);
            this.Controls.Add(this.btnStartChat);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.lbContacts);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
            this.MaximizeBox = false;
            this.Name = "HoofdForm";
            this.Text = "HoofdForm";
            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.HoofdForm_FormClosing);
            this.ResumeLayout(false);
            this.PerformLayout();

        }
开发者ID:kndschilders,项目名称:Profchat,代码行数:64,代码来源:HoofdForm.Designer.cs


示例20: InitTimer1

 private void InitTimer1()
 {
     var _timer1 = new System.Windows.Forms.Timer();
     _timer1.Tick += new EventHandler(timer1_Tick);
     _timer1.Interval = 1000; // in miliseconds
     _timer1.Start();
 }
开发者ID:sithantic,项目名称:Music,代码行数:7,代码来源:Program.cs



注:本文中的System.Windows.Forms.Timer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Forms.ToolStrip类代码示例发布时间:2022-05-24
下一篇:
C# Forms.TextBox类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap