本文整理汇总了C#中System.Windows.Forms.Timer.Stop方法的典型用法代码示例。如果您正苦于以下问题:C# Timer.Stop方法的具体用法?C# Timer.Stop怎么用?C# Timer.Stop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Timer
的用法示例。
在下文中一共展示了Timer.Stop方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
private static void Main()
{
DefaultMediaDevice = new MMDeviceEnumerator().GetDefaultAudioEndpoint(DataFlow.Render, Role.Multimedia);
DefaultMediaDevice.AudioEndpointVolume.OnVolumeNotification += new AudioEndpointVolumeNotificationDelegate(AudioEndpointVolume_OnVolumeNotification);
TrayIcon = new NotifyIcon();
TrayIcon.Icon = IconFromVolume();
TrayIcon.Text = ToolTipFromVolume();
TrayIcon.MouseClick += new MouseEventHandler(TrayIcon_MouseClick);
TrayIcon.MouseDoubleClick += new MouseEventHandler(TrayIcon_MouseDoubleClick);
TrayIcon.Visible = true;
TrayIcon.ContextMenu = new ContextMenu();
TrayIcon.ContextMenu.MenuItems.Add(new MenuItem("Open Volume Mixer", (o, e) => { Process.Start(SystemDir + "sndvol.exe"); }));
TrayIcon.ContextMenu.MenuItems.Add(new MenuItem("-"));
TrayIcon.ContextMenu.MenuItems.Add(new MenuItem("Playback devices", (o, e) => { Process.Start(SystemDir + "rundll32.exe", @"Shell32.dll,Control_RunDLL mmsys.cpl,,playback"); }));
TrayIcon.ContextMenu.MenuItems.Add(new MenuItem("Recording devices", (o, e) => { Process.Start(SystemDir + "rundll32.exe", @"Shell32.dll,Control_RunDLL mmsys.cpl,,recording"); }));
TrayIcon.ContextMenu.MenuItems.Add(new MenuItem("Sounds", (o, e) => { Process.Start(SystemDir + "rundll32.exe", @"Shell32.dll,Control_RunDLL mmsys.cpl,,sounds"); }));
TrayIcon.ContextMenu.MenuItems.Add(new MenuItem("-"));
TrayIcon.ContextMenu.MenuItems.Add(new MenuItem("Volume control options", (o, e) => { Process.Start(SystemDir + "sndvol.exe", "-p"); }));
SingleClickWindow = new Timer();
SingleClickWindow.Interval = SystemInformation.DoubleClickTime;
SingleClickWindow.Tick += (o, e) =>
{
SingleClickWindow.Stop();
StartVolControl();
};
Application.Run();
}
示例2: Start
public void Start()
{
if (Timer == 0)
{
Do();
return;
}
this.lblTimer.Text = Timer--.ToString();
if (Restart)
lblTitle.Text = "Перезапуск компьютера через:";
Timer t = new Timer();
t.Interval = 1000;
t.Tick += (o, e) => {
if (Timer == 0)
{
Do();
t.Stop();
}
else
this.lblTimer.Text = Timer--.ToString();
};
if (!CanCancel)
{
this.btCancel.Visible = false;
this.Height = 70;
}
else
this.btCancel.Click += (o, e) => {
t.Stop();
this.Close();
};
t.Start();
}
示例3: TableImportForm
public TableImportForm()
{
InitializeComponent();
var timer = new Timer{Interval = 100, Enabled = true};
timer.Tick += (o, e) =>
{
RichTextBoxWithHiddenCaret.HideCaret(richTextBox1.Handle); timer.Stop();
RichTextBoxWithHiddenCaret.HideCaret(_tbExcelRange.Handle); timer.Stop();
};
}
示例4: Chart
public Chart() : base ()
{
//SetStyle(ControlStyles.OptimizedDoubleBuffer, true); //the PlotPane is already dbl buffered
SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.AllPaintingInWmPaint, true); //no ERASE BACKGROUND
SetStyle(ControlStyles.UserMouse, true);
UpdateStyles();
m_Style = new Style(this, null);
m_RulerStyle = new Style(this, null);
m_PlotStyle = new Style(this, null);
BuildDefaultStyle(m_Style);
BuildDefaultRulerStyle(m_RulerStyle);
BuildDefaultPlotStyle(m_PlotStyle);
m_ControllerNotificationTimer = new Timer();
m_ControllerNotificationTimer.Interval = REBUILD_TIMEOUT_MS;
m_ControllerNotificationTimer.Enabled = false;
m_ControllerNotificationTimer.Tick += new EventHandler((o, e) =>
{
//todo ETO NUJNO DLYA DRAG/DROP if (m_RepositioningColumn!=null || m_ResizingColumn!=null ) return;//while grid is being manipulated dont flush timer just yet
m_ControllerNotificationTimer.Stop();
notifyAndRebuildChart();
});
}
示例5: flash
void flash(PictureBox pictureBoxN, Timer t, Timer tp)
{
pictureBoxN.Visible = true;
if (Convert.ToInt32(pictureBoxN.Tag) == 1)
{
pictureBoxN.Image = pictureBox2.Image;
}
else if (Convert.ToInt32(pictureBoxN.Tag) == 2)
{
pictureBoxN.Image = pictureBox3.Image;
}
else if (Convert.ToInt32(pictureBoxN.Tag) == 3)
{
pictureBoxN.Image = pictureBox4.Image;
}
else if (Convert.ToInt32(pictureBoxN.Tag) == 6)
{
pictureBoxN.Image = pictureBox3.Image;
}
else if (Convert.ToInt32(pictureBoxN.Tag) == 7)
{
pictureBoxN.Image = pictureBox2.Image;
t.Start();
}
else if (Convert.ToInt32(pictureBoxN.Tag) >= 8)
{
pictureBoxN.Visible = false;
pictureBoxN.Tag = 0;
tp.Stop();
}
pictureBoxN.Tag = Convert.ToString(Convert.ToInt32(pictureBoxN.Tag) + 1);
}
示例6: TimerLogic
public TimerLogic()
{
m_timer = new Timer();
m_timer.Interval = m_tick;
m_timer.Tick += delegate
{
m_log.Debug("Tick event happened");
m_timer.Stop();
// Commented until find bugs
// if(MousePositionHelper.MouseNotMoving == false)
// {
List<Task> tasksToShow = new DbHelper().LoadTasksForShowing();
m_log.DebugFormat("Loaded {0} tasks for showing", tasksToShow.Count);
foreach (Task task in tasksToShow)
{
new TaskShowController(task).PrepareWindow(); //Įkėliau viską į preparerį.
m_log.DebugFormat("Showed task with id {0}, name {1}, showTime {2}",
task.Id, task.Text, DBTypesConverter.ToFullDateStringByCultureInfo(task.DateRemainder));
}
// }
SetNewTimerInterval();
m_timer.Start();
};
m_timer.Start();
}
示例7: SplashShown
void SplashShown(object sender, EventArgs ea)
{
Timer t = new Timer();
t.Interval = 1000;
t.Tick += (s, e) => {t.Stop(); this.Hide(); new MainForm().ShowDialog(); this.Close();};
t.Start();
}
示例8: dlDebugInfo
public dlDebugInfo()
{
InitializeComponent();
SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
if (Main.Data.Active != null && Main.Data.Active.Application == "eurotrucks2")
{
data = (Ets2DataMiner) Main.Data.Active;
}
Main.Data.AppActive += (sender, args) =>
{
if (Main.Data.Active != null && Main.Data.Active.Application == "eurotrucks2")
{
data = (Ets2DataMiner) Main.Data.Active;
}
};
var updateGfx = new Timer {Interval = 40};
updateGfx.Tick += (sender, args) => this.Invalidate();
updateGfx.Start();
this.FormClosing += (sender, args) => updateGfx.Stop();
}
示例9: Collapse
public void Collapse(bool silent = false)
{
if (silent || AnimationDelay == 0)
{
Width = pnClosed.Width;
pnOpened.Visible = false;
pnClosed.Visible = true;
}
else
{
var timer = new Timer();
timer.Interval = AnimationDelay > ContentSize ? AnimationDelay / ContentSize : 100;
timer.Tick += (o, e) =>
{
if (Width > (pnClosed.Width + 50))
Width -= 50;
else
{
Width = pnClosed.Width;
pnOpened.Visible = false;
pnClosed.Visible = true;
timer.Stop();
timer.Dispose();
timer = null;
}
Application.DoEvents();
};
timer.Start();
}
if (!silent)
StateChanged?.Invoke(this, new StateChangedEventArgs(false));
}
示例10: __reload_grid
private void __reload_grid()
{
this.grid.CreateGraphics().Clear(Color.FromKnownColor(KnownColor.Control));
Timer t = new Timer();
t.Interval = 100;
t.Tick += new EventHandler((_sender, _e) =>
{
t.Stop();
try
{
g.BlockBorders(this.grid);
g.Draw(this.grid.CreateGraphics());
}
catch
{
MessageBox.Show("Unable to load the saved configurations");
newConfigurationToolStripMenuItem_Click(new object(), new EventArgs());
}
__last_valid_grid_block = g.abs2grid(g.AgentPoint);
MarkStartPointGrid_Click(new object(), new EventArgs());
__last_valid_grid_block = g.abs2grid(g.GoalPoint);
MarkGoalPointGrid_Click(new object(), new EventArgs());
});
t.Start();
}
示例11: frmGame
public frmGame()
{
InitializeComponent();
_isStartClicked = false;
Remoting.GameSetting._frmMap = null;
Remoting.GameSetting._isGameStarted = false;
_isExit = false;
// thread
ThreadStart entryPoint = new ThreadStart(StartProcess);
_processThread = new Thread(entryPoint);
_processThread.Name = "Processing Thread";
// timer start game
_timerGame = new System.Windows.Forms.Timer();
_timerGame.Interval = 500;
_timerGame.Tick += new EventHandler(_timerGame_Tick);
_timerGame.Stop();
_timerBattle = new System.Windows.Forms.Timer();
_timerBattle.Interval = 500;
_timerBattle.Tick += new EventHandler(_timerBattle_Tick);
_timerBattle.Stop();
this.FormClosing += new FormClosingEventHandler(frmGame_FormClosing);
this.FormClosed += new FormClosedEventHandler(frmGame_FormClosed);
#if DEBUG
_logWriter = new System.IO.StreamWriter("log.txt");
#endif
}
示例12: killWindow
private void killWindow()
{
var T = new Timer();
T.Interval = 8000;
T.Tick += delegate { T.Stop(); Close(); };
T.Start();
}
示例13: hideControl
private void hideControl(Control ctrl, int time)
{
var T = new Timer();
T.Interval = time * 1000;
T.Tick += delegate { ctrl.Hide(); T.Stop(); };
T.Start();
}
示例14: CallLater
public static void CallLater(TimeSpan delay, Action method)
{
var delayMilliseconds = (int) delay.TotalMilliseconds;
if (delayMilliseconds < 0)
{
throw new ArgumentOutOfRangeException("delay", delay, Properties.Resources.ValueMustBePositive);
}
if (method == null)
{
throw new ArgumentNullException("method");
}
SafeThreadAsyncCall(delegate
{
var t = new Timer
{
Interval = Math.Max(1, delayMilliseconds)
};
t.Tick += delegate
{
t.Stop();
t.Dispose();
method();
};
t.Start();
});
}
示例15: LoadShader
private void LoadShader(string fileName)
{
try
{
var log = visualContext.AddUpdateFragmentShader(fileName);
var correctedLineEndings = log.Replace("\n", Environment.NewLine).Trim();
CallOnChange("Loading '+" + fileName + "' with success!" + Environment.NewLine + correctedLineEndings);
}
catch (ShaderLoadException e)
{
var correctedLineEndings = e.Message.Replace("\n", Environment.NewLine);
CallOnChange("Error while compiling shader '" + fileName + "'" + Environment.NewLine + correctedLineEndings);
}
catch (FileNotFoundException e)
{
CallOnChange(e.Message);
}
catch (Exception e)
{
//try reload in 2 seconds, because sometimes file system is still busy
Timer timer = new Timer(); //todo: is this executed on main thread?
timer.Interval = 2000;
timer.Tick += (a, b) =>
{
timer.Stop();
timer.Dispose();
LoadShader(shaderFileName); //if fileName is used here timer will always access fileName of first call and not a potential new one
};
timer.Start();
CallOnChange("Error while accessing shaderfile '" + fileName + "'! Will retry shortly..." + Environment.NewLine + e.Message);
}
}