本文整理汇总了C#中System.Windows.Forms.Timer.Stop方法的典型用法代码示例。如果您正苦于以下问题:C# System.Windows.Forms.Timer.Stop方法的具体用法?C# System.Windows.Forms.Timer.Stop怎么用?C# System.Windows.Forms.Timer.Stop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Timer
的用法示例。
在下文中一共展示了System.Windows.Forms.Timer.Stop方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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();
}
示例2: Flash
public void Flash(TimeSpan duration)
{
if (Timer != null)
{
Timer.Stop();
}
Enabled = true;
Scanner.UpdateLedState();
Timer = new System.Windows.Forms.Timer();
Timer.Interval = (int)duration.TotalMilliseconds;
Timer.Start();
Timer.Tick += new EventHandler(delegate(Object sender, EventArgs args)
{
Timer.Stop();
Enabled = false;
Scanner.UpdateLedState();
});
}
示例3: TimerMessageBox
public TimerMessageBox()
{
this.InitializeComponent();
// Insert code required on object creation below this point.
int nSeconds=10;
string sMessage=Application.Current.FindResource("MessageID325") as string;
MsgContent.Text = string.Format(sMessage, nSeconds.ToString());
var timerLogoff = new System.Windows.Forms.Timer { Interval = 1000, Enabled = true };
timerLogoff.Tick += (object sender, EventArgs e) =>
{
MsgContent.Text = string.Format(sMessage, nSeconds.ToString());
if (nSeconds == 0)
{
_DialogResult = "NO";
timerLogoff.Stop();
Hide();
}
nSeconds--;
};
}
示例4: accountButton_Click
private void accountButton_Click(object sender, RoutedEventArgs e)
{
this.userNamestackPanel.Visibility = System.Windows.Visibility.Collapsed;
this.currentUser.name = this.Username.Text;
int count = 4;
System.Windows.Forms.Timer myTimer = new System.Windows.Forms.Timer();
System.Windows.Point center = new System.Windows.Point(RenderWidth/2, RenderHeight/2);
myTimer.Interval = 1000;
myTimer.Start();
myTimer.Tick += (_, a) =>
{
if (count-- == 1)
{
myTimer.Stop();
if (this.isUserNew)
{
this.myImageBox.Visibility = Visibility.Collapsed;
this.scanpanel.Visibility = System.Windows.Visibility.Visible;
}
else
{
this.progressBar1.Width = 170;
this.myImageBox.Visibility = Visibility.Collapsed;
this.scanpanel.Visibility = System.Windows.Visibility.Visible;
this.progressBar2.Visibility = System.Windows.Visibility.Collapsed;
this.progressBar3.Visibility = System.Windows.Visibility.Collapsed;
}
this.isfaceTrackerOn = true;
faceTrackingViewer.setSensor(this.sensor);
CurrentObjectBag.SCurrentFaceClassifier.OnUserReceived += new GiveUser(GiveUser);
}
else
{
this.myImageBox.Visibility = Visibility.Visible;
using (DrawingContext dc = this.liveFeedbackGroup.Open())
{
//dc.DrawEllipse(Brushes.Red, inferredBonePen,center,20, 20);
this.myImageBox.Source = handSource;
dc.DrawText(
new FormattedText(count.ToString(),
System.Globalization.CultureInfo.GetCultureInfo("en-us"),
FlowDirection.LeftToRight,
new Typeface("Verdana"),
40, System.Windows.Media.Brushes.Black),
new System.Windows.Point(RenderWidth / 3, RenderHeight/ 3));
}
}
};
}
示例5: LaunchGame
internal static void LaunchGame()
{
string GameDirectory = Location;
var p = new Process
{
StartInfo =
{
WorkingDirectory = GameDirectory,
FileName = Path.Combine(GameDirectory, "League of Legends.exe")
}
};
p.Exited += p_Exited;
p.StartInfo.Arguments = "\"8394\" \"" + RootLocation + "LoLLauncher.exe" + "\" \"" + "\" \"" +
CurrentGame.ServerIp + " " +
CurrentGame.ServerPort + " " +
CurrentGame.EncryptionKey + " " +
CurrentGame.SummonerId + "\"";
p.Start();
var t = new Timer
{
Interval = 5000,
};
t.Tick += (o, m) =>
{
if (Region.Garena)
return;
GameScouter scouter = new GameScouter();
scouter.LoadScouter(LoginPacket.AllSummonerData.Summoner.Name);
scouter.Show();
scouter.Activate();
t.Stop();
};
t.Start();
}
示例6: XmppConnection_OnPresence
void XmppConnection_OnPresence(object sender, Presence pres)
{
if (jid.Bare.Contains(pres.From.User))
return;
if (Client.InstaCall)
{
Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
{
var tr = new TextRange(ChatText.Document.ContentEnd, ChatText.Document.ContentEnd)
{
Text = Client.LoginPacket.AllSummonerData.Summoner.Name + ": "
};
tr.ApplyPropertyValue(TextElement.ForegroundProperty, Brushes.OrangeRed);
tr = new TextRange(ChatText.Document.ContentEnd, ChatText.Document.ContentEnd);
if (Client.Filter)
tr.Text = Client.CallString.Filter() + Environment.NewLine;
else
tr.Text = Client.CallString + Environment.NewLine;
tr.ApplyPropertyValue(TextElement.ForegroundProperty, Brushes.White);
Client.XmppConnection.Send(new Message(jid, Client.CallString));
ChatText.ScrollToEnd();
var t = new Timer
{
Interval = 10000
};
t.Start();
t.Tick += (o, e) =>
{
Client.InstaCall = false;
t.Stop();
};
}));
}
Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
{
//Solve multipile joins
if (firstPlayer == null)
firstPlayer = pres.From.User;
else
{
if (firstPlayer == pres.From.User)
{
Client.XmppConnection.MessageGrabber.Remove(jid);
Client.XmppConnection.OnPresence -= XmppConnection_OnPresence;
}
}
if (PreviousPlayers.Any(previousPlayer => previousPlayer == pres.From.User))
{
return;
}
var tr = new TextRange(ChatText.Document.ContentEnd, ChatText.Document.ContentEnd)
{
Text = pres.From.Resource + " joined the room." + Environment.NewLine
};
PreviousPlayers.Add(pres.From.User);
tr.ApplyPropertyValue(TextElement.ForegroundProperty, Brushes.Yellow);
ChatText.ScrollToEnd();
}));
}
示例7: RecordPause
/// <summary>
/// Method that starts or pauses the recording
/// </summary>
private void RecordPause()
{
Extras.CreateTemp(_pathTemp);
switch (Stage)
{
case Stage.Stopped:
#region To Record
_capture = new Timer { Interval = 1000 / FpsNumericUpDown.Value };
_snapDelay = null;
ListFrames = new List<FrameInfo>();
#region If Fullscreen
if (Settings.Default.FullScreen)
{
_bt = new Bitmap((int)_sizeScreen.X, (int)_sizeScreen.Y);
HideWindowAndShowTrayIcon();
}
else
{
_bt = new Bitmap((int)((Width - 18) * _dpi), (int)((Height - 69) * _dpi));
}
#endregion
_gr = Graphics.FromImage(_bt);
HeightTextBox.IsEnabled = false;
WidthTextBox.IsEnabled = false;
FpsNumericUpDown.IsEnabled = false;
IsRecording(true);
Topmost = true;
_size = new System.Drawing.Size(_bt.Size.Width, _bt.Size.Height);
FrameRate.Start(_capture.Interval);
#region Start
if (Settings.Default.PreStart)
{
Title = "Screen To Gif (2 " + Properties.Resources.TitleSecondsToGo;
RecordPauseButton.IsEnabled = false;
Stage = Stage.PreStarting;
_preStartCount = 1; //Reset timer to 2 seconds, 1 second to trigger the timer so 1 + 1 = 2
_preStartTimer.Start();
}
else
{
if (Settings.Default.ShowCursor)
{
#region If Show Cursor
if (!Settings.Default.Snapshot)
{
#region Normal Recording
if (!Settings.Default.FullScreen)
{
//To start recording right away, I call the tick before starting the timer,
//because the first tick will only occur after the delay.
_capture.Tick += Cursor_Elapsed;
//Cursor_Elapsed(null, null);
_capture.Start();
}
else
{
_capture.Tick += FullCursor_Elapsed;
//FullCursor_Elapsed(null, null);
_capture.Start();
}
Stage = Stage.Recording;
RecordPauseButton.Text = Properties.Resources.Pause;
RecordPauseButton.Content = (Canvas)FindResource("Vector.Pause");
RecordPauseButton.HorizontalContentAlignment = HorizontalAlignment.Left;
AutoFitButtons();
#endregion
}
else
{
#region SnapShot Recording
//Set to Snapshot Mode, change the text of the record button to "Snap" and
//every press of the button, takes a screenshot
Stage = Stage.Snapping;
RecordPauseButton.Content = (Canvas)FindResource("Vector.Camera.Old");
RecordPauseButton.Text = Properties.Resources.btnSnap;
//.........这里部分代码省略.........
示例8: RecordPause
/// <summary>
/// Method that starts or pauses the recording
/// </summary>
private void RecordPause()
{
Extras.CreateTemp(_pathTemp);
switch (Stage)
{
case Stage.Stopped:
#region To Record
_capture = new Timer {Interval = 1000/(int) FpsNumericUpDown.Value};
_snapDelay = null;
ListFrames = new List<FrameInfo>();
HeightTextBox.IsEnabled = false;
WidthTextBox.IsEnabled = false;
FpsNumericUpDown.IsEnabled = false;
IsRecording(true);
Topmost = true;
FrameRate.Start(_capture.Interval);
#region Start
if (!Settings.Default.Snapshot)
{
#region Normal Recording
_capture.Tick += Normal_Elapsed;
//Normal_Elapsed(null, null);
_capture.Start();
Stage = Stage.Recording;
AutoFitButtons();
#endregion
}
else
{
#region SnapShot Recording
Stage = Stage.Snapping;
Title = "Board Recorder - " + Properties.Resources.Con_SnapshotMode;
AutoFitButtons();
#endregion
}
break;
#endregion
#endregion
case Stage.Recording:
#region To Pause
Stage = Stage.Paused;
Title = FindResource("Recorder.Paused").ToString();
AutoFitButtons();
_capture.Stop();
FrameRate.Stop();
break;
#endregion
case Stage.Paused:
#region To Record Again
Stage = Stage.Recording;
Title = "Board Recorder";
AutoFitButtons();
FrameRate.Start(_capture.Interval);
_capture.Start();
break;
#endregion
case Stage.Snapping:
#region Take Screenshot (All possibles types)
_snapDelay = Settings.Default.SnapshotDefaultDelay;
Normal_Elapsed(null, null);
//.........这里部分代码省略.........
示例9: SettingsMenu
public SettingsMenu(MainMenu MenuParent)
{
Parent = MenuParent.ParentWindow;
ParentMenu = MenuParent;
soundStatus = Properties.Settings.Default.SoundStatus;
musicStatus = Properties.Settings.Default.MusicStatus;
mainTimer = new Timer();
mainTimer.Interval = 10;
titleLabel = new Label();
titleLabel.Text = "Settings";
titleLabel.Location = new Vector(100, -250.5f);
toggleSoundLabel = new Label();
toggleSoundLabel.Location = new Vector(130, -220.5f);
toggleSoundLabel.Text = "Sound: " + (soundStatus ? "On " : "Off");
toggleSound = new Button();
toggleSound.Location = new Vector(270, -220.5f);
toggleSound.ApplyStylishEffect();
toggleSound.Size = new Vector(70, 20);
toggleSound.Image = "data/img/bck.bmp";
toggleSound.Text = "Toggle";
toggleSound.MouseClick += (pos) =>
{
soundStatus = soundStatus ? false : true;
toggleSoundLabel.Text = "Sound: " + (soundStatus ? "On " : "Off");
};
saveButton = new Button();
saveButton.Location = new Vector(200, -30);
saveButton.Image = "data/img/bck.bmp";
saveButton.ApplyStylishEffect();
saveButton.Text = "Save";
saveButton.MouseClick += (pos) => SaveAndHide();
toggleMusicLabel = new Label();
toggleMusicLabel.Location = new Vector(130, -180.5f);
toggleMusicLabel.Text = "Music: " + (musicStatus ? "On " : "Off");
toggleMusic = new Button();
toggleMusic.Location = new Vector(270, -180.5f);
toggleMusic.ApplyStylishEffect();
toggleMusic.Size = new Vector(70, 20);
toggleMusic.Image = "data/img/bck.bmp";
toggleMusic.Text = "Toggle";
toggleMusic.MouseClick += (pos) =>
{
musicStatus = musicStatus ? false : true;
toggleMusicLabel.Text = "Music: " + (musicStatus ? "On " : "Off");
};
deleteSaveGames = new Button();
deleteSaveGames.Location = new Vector(150, -120.5f);
deleteSaveGames.ApplyStylishEffect();
deleteSaveGames.Image = "data/img/bck.bmp";
deleteSaveGames.Text = "Delete saved games";
deleteSaveGames.MouseClick += (pos) =>
{
Game.Game.DeleteProgress(false);
Game.Game.LoadGame();
SaveAndHide();
};
deleteSaveGames.Size = new Vector(160, 25);
Parent.AddChildren(toggleSound, saveButton, toggleMusicLabel, toggleMusic, deleteSaveGames);
mainTimer.Tick += (o, e) =>
{
//lazy delay implementation
//TODO: maybe fix
elapsed++;
if (elapsed < 10)
return;
if (curShift < destShift)
{
curShift += shiftIncr;
titleLabel.Location.Y -= curShift;
toggleSoundLabel.Location.Y -= curShift;
toggleSound.Location.Y -= curShift;
saveButton.Location.Y -= curShift;
toggleMusicLabel.Location.Y -= curShift;
toggleMusic.Location.Y -= curShift;
deleteSaveGames.Location.Y -= curShift;
return;
}
mainTimer.Stop();
};
}
示例10: ScrollToElement
/// <summary>
/// Adjust the scrollbar of the panel on html element by the given id.<br/>
/// The top of the html element rectangle will be at the top of the panel, if there
/// is not enough height to scroll to the top the scroll will be at maximum.<br/>
/// </summary>
/// <param name="elementId">the id of the element to scroll to</param>
public virtual void ScrollToElement(string elementId, out string result, out List<string> availableIds)
{
availableIds = new List<string>();
result = "_htmlContainer is null";
ArgChecker.AssertArgNotNullOrEmpty(elementId, "elementId");
if (_htmlContainer != null)
{
result = "id not found";
CssBox box = null;
var rect = _htmlContainer.GetElementRectangle(elementId, out availableIds, out box);
if (rect.HasValue)
{
result = "";//Scrolled to " + rect.Value.Location.X + ":" + rect.Value.Location.Y;
Dispatcher.Invoke(new Action(() =>
{
ScrollToPoint(rect.Value.Location.X, Math.Max(rect.Value.Location.Y - 50, 0));
box.BorderLeftColor = "red";
box.BorderLeftStyle = "solid";
box.BorderLeftWidth = "2px";
box.PaddingLeft = "3px";
System.Windows.Forms.Timer t = new System.Windows.Forms.Timer();
t.Interval = 300;
this.InvalidateVisual();
int counter = 0;
t.Tick += (sen, ev) =>
{
if (counter == 6)
{
t.Stop();
box.BorderLeftColor = "black";
box.BorderLeftStyle = "none";
box.BorderLeftWidth = "0";
box.PaddingLeft = "0";
}
if (counter % 2 == 0)
box.BorderLeftWidth = "2px";
else
box.BorderLeftWidth = "0px";
this.InvalidateVisual();
counter++;
};
t.Start();
_htmlContainer.HandleMouseMove(this, Mouse.GetPosition(this));
}));
}
}
}
示例11: PlayGameMenu
public PlayGameMenu(MainMenu menuParent)
{
MenuParent = menuParent;
Parent = menuParent.ParentWindow;
resumeGameButton = new Button();
resumeGameButton.Text = "Resume Game";
resumeGameButton.Location = new Vector(255, 0);
resumeGameButton.ApplyStylishEffect();
resumeGameButton.Size.X -= 10;
resumeGameButton.Image = "data/img/bck.bmp";
resumeGameButton.MouseClick += (pos) =>
{
Game.Game.ResumeGame();
Hide();
MenuParent.HideMenu();
};
newGameButton = new Button();
newGameButton.Text = "New Game";
newGameButton.Location = new Vector(250, 0);
newGameButton.ApplyStylishEffect();
newGameButton.Image = "data/img/bck.bmp";
newGameButton.MouseClick += (pos) =>
{
Game.Game.NewGame();
Hide();
MenuParent.HideMenu();
};
backButton = new Button();
backButton.Text = "Back";
backButton.Location = new Vector(265, 0);
backButton.ApplyStylishEffect();
backButton.Image = "data/img/bck.bmp";
backButton.Size.X -= 30;
backButton.MouseClick += (pos) => Hide();
mainTimer = new Timer();
mainTimer.Interval = 10;
mainTimer.Tick += (o, e) =>
{
if (curShift < destShift)
{
curShift += shiftIncr;
resumeGameButton.Location.Y -= curShift;
newGameButton.Location.Y -= curShift;
backButton.Location.Y -= curShift;
return;
}
mainTimer.Stop();
};
resumeGameButton.Location.Y = -250.5f;
newGameButton.Location.Y = -220.5f;
backButton.Location.Y = -1900.5f;
Parent.AddChildren(resumeGameButton, newGameButton, backButton);
canResume = Game.Game.CheckProgress();
if (!canResume)
{
Parent.Children.Remove(resumeGameButton);
Parent.Children.Add(this);
}
}
示例12: InitUIUpdates
//--------------------------------------------------------------------------------------------
private void InitUIUpdates()
{
var timer = new System.Windows.Forms.Timer { Interval = 100 };
timer.Tick += delegate
{
List<string> duplicated_group = null;
while ((duplicated_group = getNextDuplicatedGroupOfFiles()) != null)
{
OnDuplocatedGroupFound(duplicated_group);
if (IsRunning())
break;
}
if (!IsRunning())
{
timer.Stop();
if (OnProcessingFinished != null)
OnProcessingFinished();
}
if (OnProgressStarted != null && m_should_notify_progress_type_changed)
{
OnProgressStarted(m_current_progress_type);
m_should_notify_progress_type_changed = false;
}
if (OnProgressChanged != null && m_current_progress_type == ProgressType.Determinate)
OnProgressChanged(m_progress);
};
timer.Start();
}