本文整理汇总了C#中System.Windows.Forms.Timer类的典型用法代码示例。如果您正苦于以下问题:C# Timer类的具体用法?C# Timer怎么用?C# Timer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Timer类属于System.Windows.Forms命名空间,在下文中一共展示了Timer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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();
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Splash));
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.SuspendLayout();
//
// pictureBox1
//
this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.pictureBox1.Image = ((System.Drawing.Bitmap)(resources.GetObject("pictureBox1.Image")));
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(632, 416);
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
//
// Splash
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(632, 416);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.pictureBox1});
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "Splash";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Splash";
this.ResumeLayout(false);
}
示例2: IFProcessor
public IFProcessor(ISharpControl control)
{
this._control = control;
this._control.PropertyChanged += new PropertyChangedEventHandler(this.NotifyPropertyChangedHandler);
this._fftTimer = new System.Windows.Forms.Timer();
this._fftTimer.Tick += new EventHandler(this.fftTimer_Tick);
this._fftTimer.Interval = 40;
this._fftBins = 8192;
this.InitFFTBuffers();
this.BuildFFTWindow();
this._spectrumAnalyzer = new SpectrumAnalyzer();
this._spectrumAnalyzer.Dock = DockStyle.Fill;
this._spectrumAnalyzer.Margin = new Padding(0, 0, 0, 0);
this._spectrumAnalyzer.DisplayRange = 130;
this._spectrumAnalyzer.EnableFilter = false;
this._spectrumAnalyzer.EnableHotTracking = false;
this._spectrumAnalyzer.EnableSideFilterResize = true;
this._spectrumAnalyzer.EnableFilterMove = false;
this._spectrumAnalyzer.BandType = BandType.Center;
this._spectrumAnalyzer.StepSize = 1000;
this._spectrumAnalyzer.UseSmoothing = true;
this._spectrumAnalyzer.Attack = 0.9f;
this._spectrumAnalyzer.Decay = 0.6f;
this._spectrumAnalyzer.StatusText = "IF Spectrum";
this._spectrumAnalyzer.FrequencyChanged += new ManualFrequencyChangeEventHandler(this.spectrumAnalyzer_FrequencyChanged);
this._spectrumAnalyzer.CenterFrequencyChanged += new ManualFrequencyChangeEventHandler(this.spectrumAnalyzer_CenterFrequencyChanged);
this._spectrumAnalyzer.BandwidthChanged += new ManualBandwidthChangeEventHandler(this.spectrumAnalyzer_BandwidthChanged);
this._spectrumAnalyzer.VisibleChanged += new EventHandler(this.spectrumAnalyzer_VisibleChanged);
this._control.RegisterStreamHook((object) this, ProcessorType.DecimatedAndFilteredIQ);
this._control.RegisterFrontControl((UserControl) this._spectrumAnalyzer, (PluginPosition) Utils.GetIntSetting("zoomPosition", 1));
}
示例3: LeanEngineWinForm
/// <summary>
/// Launch the Lean Engine Primary Form:
/// </summary>
/// <param name="engine">Accept the engine instance we just launched</param>
public LeanEngineWinForm(Engine engine)
{
_engine = engine;
//Setup the State:
_resultsHandler = engine.AlgorithmHandlers.Results;
//Create Form:
Text = "QuantConnect Lean Algorithmic Trading Engine: v" + Constants.Version;
Size = new Size(1024,768);
MinimumSize = new Size(1024, 768);
CenterToScreen();
WindowState = FormWindowState.Maximized;
Icon = new Icon("../../../lean.ico");
//Setup Console Log Area:
_console = new RichTextBox();
_console.Parent = this;
_console.ReadOnly = true;
_console.Multiline = true;
_console.Location = new Point(0, 0);
_console.Dock = DockStyle.Fill;
_console.KeyUp += ConsoleOnKeyUp;
//Form Events:
Closed += OnClosed;
//Setup Polling Events:
_polling = new Timer();
_polling.Interval = 1000;
_polling.Tick += PollingOnTick;
_polling.Start();
}
示例4: InitTimer
public void InitTimer()
{
_timer = new Timer();
_timer.Tick += new EventHandler(button1_Click);
_timer.Interval = Convert.ToInt32(Options.Instance.TimerInterval);
_timer.Start();
}
示例5: InitializeXBox360Timer
private void InitializeXBox360Timer()
{
Timer timer = new Timer { Enabled = true };
int guideCounter = 0;
timer.Tick += (sender, args) =>
{
if (AnyGamepadHasButton(XBox360GamepadButton.Guide) && !IsVisible)
{
guideCounter++;
if (guideCounter == 10)
{
Show();
}
}
else if (AnyGamepadHasButton(XBox360GamepadButton.B) && IsVisible)
{
Hide();
}
else if (AnyGamepadHasButton(XBox360GamepadButton.X) && IsVisible)
{
PowerOff();
}
else
{
guideCounter = 0;
}
};
}
示例6: Menu
public Menu(SquareList list)
{
children = list;
myTimer = new Timer();
myTimer.Interval = 90000;
myTimer.Enabled = true;
}
示例7: startButton_Click
private void startButton_Click(object sender, EventArgs e)
{
SynchronizationContext ctx = SynchronizationContext.Current;
// Save the new gesture name to gestureInfoNew.data
string name = gestureName.Text;
Gestures.addNewGesture(name);
Gestures.saveData(GestureStudio.GesturesDataPathNew);
Gestures.loadData(GestureStudio.GesturesDataPathNew);
// Count down 5.
int countDown = 5;
System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer();
timer.Interval = 1000;
timer.Tick += (o, src) =>
{
countDown--;
ctx.Post((state) =>
{
this.countDownLabel.Text = countDown.ToString();
}, null);
if (countDown == 0)
{
this.OnStart();
timer.Stop();
countDown = 5;
this.countDownLabel.Text = countDown.ToString();
this.gestureName.Text = "Name of the new gesture.";
}
};
timer.Start();
}
示例8: MonitorConfigurationWatcher
public MonitorConfigurationWatcher()
{
_checkTimer = new Timer();
_checkTimer.Enabled = false;
_checkTimer.Interval = 2500;
_checkTimer.Tick += OnCheckTimerTick;
}
示例9: GameTime
static GameTime()
{
_staticReference = new GameTime();
game = new Timer();
game.Interval = 30;
game.Tick += game_Tick;
}
示例10: ApplicationContext
public ApplicationContext()
{
if (Properties.Settings.Default.CallUpgrade)
{
Properties.Settings.Default.Upgrade();
Properties.Settings.Default.CallUpgrade = false;
Properties.Settings.Default.Save();
}
_components = new System.ComponentModel.Container();
_notifyIcon = new NotifyIcon(_components)
{
ContextMenuStrip = new ContextMenuStrip(),
Visible = true
};
_notifyIcon.ContextMenuStrip.Items.Add(new ToolStripMenuItem("Settings", null, new EventHandler(MenuSettingsItem_Click)));
_notifyIcon.ContextMenuStrip.Items.Add(new ToolStripMenuItem("Exit", null, new EventHandler(MenuExitItem_Click)));
_buddies = new Buddies();
_housekeepingTimer = new System.Windows.Forms.Timer();
_housekeepingTimer.Interval = 5000;
_housekeepingTimer.Tick += HousekeepingTimer_Tick;
HousekeepingTimer_Tick(null, null); // tick anyway enables timer when finished
_trackerStatus = TrackerStatus.OK;
if (trackersConfigured())
{
_trackerStatus = TrackerStatus.UNKNOWN;
UpdateTrackerSetting();
}
_viewModel = new ViewModel(_buddies);
}
示例11: MainForm
public MainForm(MainModel model)
: this()
{
_model = model;
_model.TrayIcon = _trayIcon;
_presenter = new MainPresenter(this, model, SynchronizationContext.Current);
_presenter.ConnectEvents();
this.Closing += (sender, args) => _presenter.DisconnectEvents();
_trayIconTimer = new Timer();
_trayIconTimer.Interval = 750;
_trayIconTimer.Tick += OnTrayIconTimerTick;
_shutdownTimer = new Timer();
_shutdownTimer.Interval = 20000;
_shutdownTimer.Tick += ShutdownTimerOnTick;
_progressView = new ProgressView(new ProgressModel(model.UploadManager));
_processing = true;
_trayIconTimer.Start();
Logger.LogInfo("MainForm initialized.");
if (_trayIcon != null)
_trayIcon.SetTrayIconVisibility(true);
}
示例12: SetupDrawLoop
/// <summary>
/// Setups the timer that triggers the update loop
/// </summary>
private void SetupDrawLoop()
{
Timer timer = new Timer();
timer.Interval = _updateIntervalMills;
timer.Tick += TimerTick;
timer.Start();
}
示例13: btn_BLKWHTAUTO_Click
private void btn_BLKWHTAUTO_Click(object sender, EventArgs e)
{
//:Let them know this is a larger operation.
this.Text = "Please be patient, this is a larger comparison.";
//:We do NOT want them clicking while the thread is running.
ButtonsEnabled(false);
btn_Refresh.Enabled = false;
btn_newIMG.Enabled = false;
btn_Export.Enabled = false;
btn_GRYSCL.Enabled = false;
btn_BLKWHT.Enabled = false;
nud_BWSCALE.Enabled = false;
btn_BLKWHTAUTO.Enabled = false;
ready = false; //:Not ready to continue other functions. [excluding this]
//:Start a timer along with a thread to multithread the process gargling AutoBW
System.Windows.Forms.Timer t = new System.Windows.Forms.Timer();
t.Interval = 1000;
t.Tick += new EventHandler(t_Tick);
Thread th = new Thread(new ThreadStart(BWAUTO_TH));
t.Start();
th.Start();
}
示例14: MainForm_Load
private void MainForm_Load(Object sender, EventArgs e)
{
// bind connection Strings to the dropdown lists
cboPersistenceService.DisplayMember = "Name";
cboTrackingService.DisplayMember = "Name";
foreach (ConnectionStringSettings connectionStringSetting in ConfigurationManager.ConnectionStrings)
{
cboPersistenceService.Items.Add(connectionStringSetting);
cboTrackingService.Items.Add(connectionStringSetting);
}
cboTrackingService.Items.Insert(0, "None");
if (cboPersistenceService.Items.Count > 0)
cboPersistenceService.SelectedIndex = 0;
if (cboTrackingService.Items.Count > 0)
cboTrackingService.SelectedIndex = 0;
// configure delegate trace listener
DelegateTraceListener traceListener = new DelegateTraceListener();
traceListener.WriteDelegate += traceListener_WriteDelegate;
traceListener.WriteLineDelegate += traceListener_WriteDelegate;
Trace.Listeners.Add(traceListener);
// and the timer to flush messages to the message box
traceDelegate = traceToMessageBox;
timer = new Timer();
timer.Interval = 1000;
timer.Tick += timer_Tick;
timer.Start();
}
示例15: StatusStripExtender
/// <summary>
/// Initializes a new instance of the <see cref="StatusStripExtender"/> class.
/// </summary>
public StatusStripExtender()
{
_timer = new Timer { Enabled = false, Interval = _statusDefaultDuration };
_timer.Tick += _timer_Tick;
_toolTipList = new StringCollection();
}