Here are the examples of the csharp api System.Timers.Timer.Start() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1088 Examples
19
Source : WavePlayer.cs
with BSD 3-Clause "New" or "Revised" License
from anoyetta
with BSD 3-Clause "New" or "Revised" License
from anoyetta
public void Play(
string file,
float volume = 1.0f,
WavePlayerTypes playerType = WavePlayerTypes.WASAPI,
string deviceID = null,
bool sync = false)
{
#if DEBUG
var sw = System.Diagnostics.Stopwatch.StartNew();
#endif
try
{
if (!File.Exists(file))
{
return;
}
if (playerType == WavePlayerTypes.WASAPIBuffered)
{
BufferedWavePlayer.Instance.Play(file, volume, deviceID, sync);
if (DisposeTimer.Enabled)
{
DisposeTimer.Stop();
}
DisposeSoundOuts();
return;
}
var audio = new AudioFileReader(file)
{
Volume = volume
};
var player = this.CreatePlayer(playerType, deviceID);
player.Init(audio);
player.PlaybackStopped += (x, y)
=> DisposeQueue.Enqueue(x as IWavePlayer);
player.Play();
if (!DisposeTimer.Enabled)
{
DisposeTimer.Start();
}
BufferedWavePlayer.Instance.Dispose();
}
finally
{
#if DEBUG
sw.Stop();
AppLog.DefaultLogger.Info($"play wave duration_ticks={sw.ElapsedTicks:N0}, duration_ms={sw.ElapsedMilliseconds:N0} type={playerType}");
#endif
}
}
19
Source : ChatLogWorker.cs
with BSD 3-Clause "New" or "Revised" License
from anoyetta
with BSD 3-Clause "New" or "Revised" License
from anoyetta
public void Begin()
{
lock (this.LogBuffer)
{
this.LogBuffer.Clear();
}
if (this.worker != null)
{
this.worker.Stop();
this.worker.Dispose();
this.worker = null;
}
this.worker = new System.Timers.Timer(FlushInterval.TotalMilliseconds)
{
AutoReset = true,
};
this.worker.Elapsed += (x, y) => this.Write();
this.worker.Start();
}
19
Source : BoyomichanSpeechController.cs
with BSD 3-Clause "New" or "Revised" License
from anoyetta
with BSD 3-Clause "New" or "Revised" License
from anoyetta
public void Initialize()
{
this.LazySpeakQueueSubscriber.Value.Start();
}
19
Source : PluginCore.cs
with BSD 3-Clause "New" or "Revised" License
from anoyetta
with BSD 3-Clause "New" or "Revised" License
from anoyetta
private void StartReplaceTTSMethodTimer()
{
lock (this)
{
this.replaceTTSMethodTimer = new System.Timers.Timer()
{
Interval = 3 * 1000,
AutoReset = true,
};
// 置き換え監視タイマを開始する
if (!this.replaceTTSMethodTimer.Enabled)
{
this.replaceTTSMethodTimer.Elapsed += (s, e) =>
{
lock (this)
{
if (this.replaceTTSMethodTimer.Enabled)
{
this.ReplaceTTSMethod();
}
}
};
this.replaceTTSMethodTimer.Start();
}
}
}
19
Source : AudioManager.cs
with MIT License
from AntonyCorbett
with MIT License
from AntonyCorbett
public void PlayAudio(
string mediaItemFilePath,
Guid mediaItemId,
TimeSpan startPosition,
bool startFromPaused)
{
_mediaItemId = mediaItemId;
if (!startFromPaused)
{
OnMediaChangeEvent(CreateMediaEventArgs(_mediaItemId, MediaChange.Starting));
}
Log.Debug($"PlayAudio - Media Id = {_mediaItemId}");
if (_outputDevice == null)
{
_outputDevice = new WaveOutEvent();
_outputDevice.PlaybackStopped += OnPlaybackStopped;
}
if (_audioFileReader == null)
{
_audioFileReader = new AudioFileReader(mediaItemFilePath);
_outputDevice.Init(_audioFileReader);
}
if (!startFromPaused && startPosition != TimeSpan.Zero)
{
_audioFileReader.SetPosition(startPosition);
}
_outputDevice.Play();
_timer.Start();
OnMediaChangeEvent(CreateMediaEventArgs(_mediaItemId, MediaChange.Started));
}
19
Source : ARNotificationView.cs
with Apache License 2.0
from AppRopio
with Apache License 2.0
from AppRopio
private void StartAnimatedHiddenHint()
{
_hintTimer = new Timer(MILLISECONDS_FOR_HINT)
{
AutoReset = false
};
_hintTimer.Elapsed += OnHintTimerElapsed;
_hintTimer.Start();
}
19
Source : ARNotificationView.cs
with Apache License 2.0
from AppRopio
with Apache License 2.0
from AppRopio
private void StartHiddenTimer()
{
_hiddenTimer = new Timer(MILLISECONDS_FOR_HIDE)
{
AutoReset = false
};
_hiddenTimer.Elapsed += OnHiddenTimerElapsed;
_hiddenTimer.Start();
}
19
Source : ChopperGenerator.cs
with MIT License
from Apress
with MIT License
from Apress
public void GenerateChoppers()
{
if (_generating)
{
return;
}
_choppersGenerated = 0;
_timer.Start();
}
19
Source : ChopperGenerator.cs
with MIT License
from Apress
with MIT License
from Apress
public void GenerateChoppers(int nbChoppers)
{
if (_generating)
{
return;
}
_maxChoppers = nbChoppers;
_choppersGenerated = 0;
_timer.Start();
}
19
Source : Program.cs
with GNU General Public License v3.0
from approved
with GNU General Public License v3.0
from approved
public static void Main(string[] args)
{
if (!File.Exists(SettingsFile))
{
Directory.CreateDirectory("settings");
CurrentSettings.CreateNew(SettingsFile);
}
else
{
CurrentSettings.Load(SettingsFile);
}
ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
Client.Proxy = null;
Console.Clear();
Console.CursorVisible = false;
InputManager.Initialize();
InputManager.OnKeyboardEvent += InputManager_OnKeyboardEvent;
InputManager.OnMouseEvent += InputManager_OnMouseEvent;
OrbWalkTimer.Elapsed += OrbWalkTimer_Elapsed;
#if DEBUG
Timer callbackTimer = new Timer(16.66);
callbackTimer.Elapsed += Timer_CallbackLog;
#endif
Timer attackSpeedCacheTimer = new Timer(OrderTickRate);
attackSpeedCacheTimer.Elapsed += AttackSpeedCacheTimer_Elapsed;
attackSpeedCacheTimer.Start();
Console.WriteLine($"Press and hold '{(VirtualKeyCode)CurrentSettings.ActivationKey}' to activate the Orb Walker");
CheckLeagueProcess();
Console.ReadLine();
}
19
Source : Program.cs
with GNU General Public License v3.0
from approved
with GNU General Public License v3.0
from approved
private static void InputManager_OnKeyboardEvent(VirtualKeyCode key, KeyState state)
{
if (key == (VirtualKeyCode)CurrentSettings.ActivationKey)
{
switch (state)
{
case KeyState.Down when !OrbWalkerTimerActive:
OrbWalkerTimerActive = true;
OrbWalkTimer.Start();
break;
case KeyState.Up when OrbWalkerTimerActive:
OrbWalkerTimerActive = false;
OrbWalkTimer.Stop();
break;
}
}
}
19
Source : DiscordPresence.cs
with MIT License
from Archomeda
with MIT License
from Archomeda
public virtual void Start()
{
if (this.HasPresenceStarted)
return;
this.stopRequested = false;
this.HasPresenceStarted = true;
this.rpcClient = new DiscordRpcClient(clientId)
{
Logger = new DiscordShellLogger()
{
Level = LogLevel.Warning,
Logger = this.Logger
}
};
this.rpcClient.OnConnectionEstablished += this.RpcClient_OnConnectionEstablished;
this.rpcClient.OnConnectionFailed += this.RpcClient_OnConnectionFailed;
this.rpcClient.Initialize();
this.rpcEventLoopThread = new Thread(this.RpcEventLoop);
this.rpcEventLoopThread.Start();
this.rpcReconnectTimer.Start();
}
19
Source : Program.cs
with MIT License
from Archomeda
with MIT License
from Archomeda
public static async Task Start()
{
if (!Paused)
return;
Paused = false;
updateCheckerTimer.Start();
var tasks = new List<Task>() { CheckForUpdates() };
SetSaliensBot(Settings.EnableBot);
if (Settings.EnableDiscordPresence)
SetDiscordPresence(Settings.EnableBot ? PresenceActivationType.EnabledWithBot : PresenceActivationType.EnabledPresenceOnly);
await Task.WhenAll(tasks);
}
19
Source : TrackChangeAnimator.cs
with MIT License
from arjankuijpers
with MIT License
from arjankuijpers
private void StartTrackChangeAnimation()
{
string trackName = m_currentTrack.TrackResource.Name;
string artistName = m_currentTrack.ArtistResource.Name;
Console.WriteLine("Show New track name: " + trackName);
m_menuCommand.Text = String.Format("{0} - {1}", trackName, artistName);
if(m_timer != null)
{
m_timer.Stop();
m_timer.Start();
}
else
{
m_timer = new System.Timers.Timer() { Interval = m_animationTimeWait };
m_timer.Elapsed += TrackChangeAnimTimerTick;
m_timer.Start();
}
}
19
Source : TrackChangeAnimator.cs
with MIT License
from arjankuijpers
with MIT License
from arjankuijpers
private void TrackChangeAnimTimerTick(object sender, System.Timers.ElapsedEventArgs e)
{
Debug.WriteLine("TrackChangeAnimator:: TrackChange Wait done.");
m_timer.Stop();
m_timer.Elapsed -= TrackChangeAnimTimerTick;
if(!m_animationEnabled)
{
m_timer = null;
m_menuCommand.Text = m_standardCommandText;
return;
}
// Else Animation is enabled.
m_timer.Elapsed += TimerAnimationTick;
m_timer.Interval = m_animationFrameTime;
m_timer.Start();
}
19
Source : CrossJobs.cs
with MIT License
from aritchie
with MIT License
from aritchie
public static void Init(TimeSpan? periodicTime = null)
{
var ts = periodicTime ?? TimeSpan.FromMinutes(10);
timer = new Timer(ts.TotalMilliseconds);
timer.Elapsed += async (sender, args) =>
{
timer.Stop();
try
{
await Current.RunAll().ConfigureAwait(false);
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
timer.Start();
};
timer.Start();
}
19
Source : VideoPlayerRenderer.cs
with MIT License
from arqueror
with MIT License
from arqueror
private void RegisterEvents()
{
// CurrentTime Setup
_currentPositionTimer = new Timer(1000);
_currentPositionTimer.Elapsed += (source, eventArgs) =>
{
if (_currentPositionTimer.Enabled && Control.Player != null)
Element.SetValue(VideoPlayer.CurrentTimePropertyKey, TimeSpan.FromMilliseconds(Control.CurrentPosition));
};
// Prepared
Control.Prepared += OnPrepared;
// Time Elapsed
Control.TimeElapsed += (sender, args) => Element.OnTimeElapsed(CreateVideoPlayerEventArgs());
// Completion
Control.Completion += (sender, args) =>
{
_currentPositionTimer.Stop();
Element.OnCompleted(CreateVideoPlayerEventArgs());
};
// Error
Control.Error += (sender, args) =>
{
_currentPositionTimer.Stop();
Element.OnFailed(CreateVideoPlayerErrorEventArgs(args.What));
};
// Play
Control.Started += (sender, args) =>
{
_currentPositionTimer.Start();
Element.OnPlaying(CreateVideoPlayerEventArgs());
};
// Paused
Control.Paused += (sender, args) =>
{
_currentPositionTimer.Stop();
Element.OnPaused(CreateVideoPlayerEventArgs());
};
// Stopped
Control.Stopped += (sender, args) =>
{
_currentPositionTimer.Stop();
Element.OnPaused(CreateVideoPlayerEventArgs());
};
}
19
Source : Program.cs
with MIT License
from aschearer
with MIT License
from aschearer
static void Main(string[] args)
{
Trace.Listeners.Add(new ConsoleTraceListener());
pollingFrequencyRaw = ConfigurationSettings.AppSettings["POLLING_FREQUENCY"];
pollingFrequency = int.Parse(pollingFrequencyRaw) * 1000 * 60;
ScanForNewBuilds(null, null);
timer = new Timer();
timer.Interval = pollingFrequency;
timer.Elapsed += ScanForNewBuilds;
timer.Start();
System.Console.Write("Press any key to exit... ");
System.Console.ReadKey();
}
19
Source : TestProvider.cs
with Apache License 2.0
from asynkron
with Apache License 2.0
from asynkron
private void StartTtlTimer()
{
_ttlReportTimer = new Timer(_options.RefreshTtl.TotalMilliseconds);
_ttlReportTimer.Elapsed += (sender, args) => { RefreshTTL(); };
_ttlReportTimer.Enabled = true;
_ttlReportTimer.AutoReset = true;
_ttlReportTimer.Start();
}
19
Source : ModuleTimer.cs
with GNU General Public License v3.0
from AutoDarkMode
with GNU General Public License v3.0
from AutoDarkMode
public void Start()
{
Logger.Info($"starting {Name} timer with {Timer.Interval} ms timer interval");
Timer.Start();
if (TickOnStart)
{
OnTimedEvent(this, EventArgs.Empty as ElapsedEventArgs);
}
}
19
Source : FileTest.cs
with MIT License
from Autodesk
with MIT License
from Autodesk
private static Task Delay(double milliseconds)
{
var tcs = new TaskCompletionSource<bool>();
System.Timers.Timer timer = new System.Timers.Timer();
timer.Elapsed += (obj, args) => { tcs.TrySetResult(true); };
timer.Interval = milliseconds;
timer.AutoReset = false;
timer.Start();
return tcs.Task;
}
19
Source : Watcher.cs
with MIT License
from Autodesk
with MIT License
from Autodesk
void _timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
if (DirectoryUnavailable != null)
{
if (!_directory.Exists)
{
WatcherEventArgs ea = new WatcherEventArgs(_directory);
DirectoryUnavailable(this, ea); // raise event to subscribers
}
else
{
_timer.Start(); // restart timer
}
}
else
{
_timer.Start();
}
}
19
Source : ProgressIndicatorDemo.axaml.cs
with MIT License
from AvaloniaCommunity
with MIT License
from AvaloniaCommunity
private void ProgressIndicatorDemo_AttachedToVisualTree(object sender, VisualTreeAttachmentEventArgs e)
{
timer.Start();
}
19
Source : SnackbarHost.xaml.cs
with MIT License
from AvaloniaCommunity
with MIT License
from AvaloniaCommunity
public static void Post(SnackbarModel model, string targetHost = null)
{
if (targetHost is null)
targetHost = GetFirstHostName();
var host = GetHost(targetHost);
if (host is null)
throw new ArgumentNullException(nameof(targetHost), $"The target host named \"{targetHost}\" is not exist.");
ElapsedEventHandler onExpired = null;
onExpired = delegate(object sender, ElapsedEventArgs args)
{
if (sender is Timer timer)
{
// Remove timer.
timer.Stop();
timer.Elapsed -= onExpired;
timer.Dispose();
OnSnackbarDurationExpired(host, model);
}
};
var timer = new Timer(model.Duration.TotalMilliseconds);
timer.Elapsed += onExpired;
timer.Start();
Dispatcher.UIThread.Post(delegate
{
host.SnackbarModels.Add(model);
});
}
19
Source : GameNetworkManager.cs
with Apache License 2.0
from aws-samples
with Apache License 2.0
from aws-samples
private void SetupServerAndGamelift()
{
// start the unet server
networkPort = LISTEN_PORT;
StartServer();
print($"Server listening on port {networkPort}");
// initialize GameLift
print("Starting GameLift initialization.");
var initSDKOutcome = GameLiftServerAPI.InitSDK();
if(initSDKOutcome.Success)
{
isGameliftServer = true;
var processParams = new ProcessParameters(
(gameSession) =>
{
// onStartGameSession callback
GameLiftServerAPI.ActivateGameSession();
// quit if no player joined within two minutes
timer.Elapsed += this.CheckPlayersJoined;
timer.AutoReset = false;
timer.Start();
},
(updateGameSession) =>
{
},
() =>
{
// onProcessTerminate callback
TerminateSession();
},
() =>
{
// healthCheck callback
return true;
},
LISTEN_PORT,
new LogParameters(new List<string>()
{
"/local/game/logs/myserver.log"
})
);
var processReadyOutcome = GameLiftServerAPI.ProcessReady(processParams);
if(processReadyOutcome.Success)
{
print("GameLift process ready.");
}
else
{
print($"GameLift: Process ready failure - {processReadyOutcome.Error.ToString()}.");
}
}
else
{
print($"GameLift: InitSDK failure - {initSDKOutcome.Error.ToString()}.");
}
}
19
Source : FailoverRegion.cs
with Apache License 2.0
from awslabs
with Apache License 2.0
from awslabs
public void MarkIsDown()
{
if (_isRegionIsDown) return;
_isRegionIsDown = true;
// Setup Timer to enable region after Timeout
_resetTimer.Elapsed += new ElapsedEventHandler(Reset);
_resetTimer.AutoReset = false;
_resetTimer.Start();
}
19
Source : FailoverSink.cs
with Apache License 2.0
from awslabs
with Apache License 2.0
from awslabs
public TAWSClient FailOverToSecondaryRegion(Throttle throttle)
{
// Stop timer if no errors
if (throttle.ConsecutiveErrorCount == 0)
{
_secondaryRegionFailoverTimer.Stop();
_secondaryRegionFailoverActivated = false;
}
// Start timer on first error
else if (throttle.ConsecutiveErrorCount > 0 && !_secondaryRegionFailoverTimer.Enabled)
{
_secondaryRegionFailoverTimer.Start();
}
// Failover to Secondary Region if available
// Reaching maximum consecutive error counts or timeout
if (throttle.ConsecutiveErrorCount >= _maxErrorsCountBeforeFailover || _secondaryRegionFailoverActivated)
{
_logger?.LogWarning($"FailoverSink id {Id} max consecutive errors count {throttle.ConsecutiveErrorCount}, trying to fail over to secondary region.");
// Setup client with Secondary Region
var client = _failoverSinkRegionStrategy.GetSecondaryRegionClient();
if (client is not null)
{
// Reset Throttle
throttle.SetSuccess();
_logger?.LogInformation($"FailoverSink id {Id} after reaching max consecutive errors limit to {throttle.ConsecutiveErrorCount}, failed over successfully to secondary region {_failoverSinkRegionStrategy.GetCurrentRegion().Region.SystemName}.");
return client;
}
else
{
_logger?.LogError($"FailoverSink id {Id} fail over to secondary region unsuccessful, looks like all of secondary regions are currently down.");
}
}
return null;
}
19
Source : TimeSolution.cs
with MIT License
from ay2015
with MIT License
from ay2015
public static void StartTimer(this System.Timers.Timer timer)
{
timer.Enabled = true;
timer.Start();
}
19
Source : Benchmark.cs
with MIT License
from Azer0s
with MIT License
from Azer0s
public static void Main(string[] args)
{
Log.SetLevel(Log.Level.FATAL, Log.Groups.HIDE);
Vlan.Register(1, "DEFAULT");
Global.SetDeviceAutoStartup(true);
var pc1 = new EthernetDevice("pc1");
var pc2 = new EthernetDevice("pc2");
pc1[ETH01].Init();
pc2[ETH01].Init();
pc1[ETH01].ConnectTo(pc2[ETH01]);
var size = ((Ethernet) new EthernetFrame(Constants.ETHERNET_BROADCAST_PORT, pc1[ETH01], Vlan.Get(1),
new RawPacket(new byte[100]))).ToEthernetFrame().ToBytes().Length;
var run = true;
var count = 0;
var timer = new Timer(60_000);
timer.Elapsed += (a, b) => { run = false; };
timer.Start();
while (run)
{
pc1[ETH01].SendAsync(new EthernetFrame(Constants.ETHERNET_BROADCAST_PORT, pc1[ETH01], Vlan.Get(1), new RawPacket(new byte[100])));
count++;
}
Console.WriteLine($"{(count * size).ToString()} bytes transmitted!");
Console.WriteLine($"{(count * size * 8/60).ToString()} b/s");
Console.WriteLine($"{(count * size / 1024 * 8/60).ToString()} Kb/s");
Console.WriteLine($"{(count * size / 1024 / 1024 * 8/60).ToString()} Mb/s");
Console.ReadKey();
}
19
Source : WorkerSupervisor.cs
with MIT License
from Azure
with MIT License
from Azure
public async Task StartAsync() {
await EnsureWorkersAsync();
_ensureWorkerRunningTimer.Start();
}
19
Source : WriterGroupMessageSource.cs
with MIT License
from Azure
with MIT License
from Azure
public async Task ActivateAsync(CancellationToken ct) {
if (Subscription == null) {
_outer._logger.Warning("Subscription not registered");
return;
}
// only try to activate if already enabled. Otherwise the activation
// will be handled by the session's keep alive mechanism
if (Subscription.Enabled) {
await Subscription.ActivateAsync(null).ConfigureAwait(false);
}
if (_keyframeTimer != null) {
ct.Register(() => _keyframeTimer.Stop());
_keyframeTimer.Start();
}
if (_metadataTimer != null) {
ct.Register(() => _metadataTimer.Stop());
_metadataTimer.Start();
}
}
19
Source : DeviceConnectivityManager.cs
with MIT License
from Azure
with MIT License
from Azure
public void SetConnectionManager(IConnectionManager connectionManager)
{
this.connectivityChecker = new ConnectivityChecker(connectionManager, this.testClientIdenreplacedy);
this.connectedTimer.Start();
Events.SetConnectionManager();
}
19
Source : DeviceConnectivityManager.cs
with MIT License
from Azure
with MIT License
from Azure
void ResetDisconnectedTimer()
{
this.disconnectedTimer.Stop();
this.disconnectedTimer.Start();
}
19
Source : DeviceConnectivityManager.cs
with MIT License
from Azure
with MIT License
from Azure
void ResetConnectedTimer()
{
this.connectedTimer.Stop();
this.connectedTimer.Start();
}
19
Source : DeviceConnectivityManager.cs
with MIT License
from Azure
with MIT License
from Azure
void OnConnected()
{
Events.OnConnected();
this.connectedTimer.Start();
}
19
Source : DeviceConnectivityManager.cs
with MIT License
from Azure
with MIT License
from Azure
void OnDisconnected()
{
Events.OnDisconnected();
Metrics.Instance.LogOfflineCounter(1, this.testClientIdenreplacedy.Id);
this.stopWatch.Restart();
this.DeviceDisconnected?.Invoke(this, EventArgs.Empty);
this.disconnectedTimer.Start();
}
19
Source : ConnectionReauthenticator.cs
with MIT License
from Azure
with MIT License
from Azure
public void Init()
{
Events.StartingReauthTimer(this.timer);
this.timer.Start();
}
19
Source : MainService.cs
with GNU General Public License v3.0
from Azure99
with GNU General Public License v3.0
from Azure99
public void StartService()
{
_timer.Start();
}
19
Source : MainService.cs
with GNU General Public License v3.0
from Azure99
with GNU General Public License v3.0
from Azure99
private void WorkEvent(object sender, ElapsedEventArgs e)
{
LogManager.WriteLine("Checking time...");
try
{
Work();
}
catch (Exception ex)
{
LogManager.ShowException(ex);
if (!_timer.Enabled)
{
_timer.Start();
}
}
}
19
Source : JudgeService.cs
with MIT License
from Azure99
with MIT License
from Azure99
public void Start()
{
LogManager.Info("Start service");
ClearTempDirectory();
_workTimer.Start();
}
19
Source : MainService.cs
with GNU General Public License v3.0
from Azure99
with GNU General Public License v3.0
from Azure99
public void GetNewsAndSendToKindle()
{
_timer.Stop();
NewsBody[] bodies = CrawleNews();
LogManager.WriteLine("Build news html page...");
string html = BuildHTML(bodies);
string filePath = "RssToKindle" + DateTime.Now.ToString("yy-MM-dd") + ".html";
#if DEBUG
filePath = "R2K-Debug" + DateTime.Now.ToString("HH-mm-ss") + ".html";
#endif
try
{
File.WriteAllText(filePath, html, Encoding.UTF8);
}
catch (Exception ex)
{
LogManager.ShowException(ex, "Cannot create news file, push failed!");
return;
}
LogManager.WriteLine("Send mail to kindle...");
SendEmail(filePath);
LogManager.WriteLine("All done!");
LogManager.WriteLine("----------");
ConfigManager.Config.LastSendTime = DateTime.Now;
ConfigManager.SaveConfig();
_timer.Start();
}
19
Source : Program.cs
with MIT License
from AzureIoTGBB
with MIT License
from AzureIoTGBB
static void Main(string[] args)
{
// The Edge runtime gives us the connection string we need -- it is injected as an environment variable
string connectionString = Environment.GetEnvironmentVariable("EdgeHubConnectionString");
// Cert verification is not yet fully functional when using Windows OS for the container
bool bypreplacedCertVerification = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
if (!bypreplacedCertVerification) InstallCert();
Init(connectionString, bypreplacedCertVerification).Wait();
System.Timers.Timer t = new System.Timers.Timer(timeBetweenMessages);
t.Elapsed += OnTimerEvent;
t.AutoReset = true;
t.Start();
// Wait until the app unloads or is cancelled
var cts = new CancellationTokenSource();
replacedemblyLoadContext.Default.Unloading += (ctx) => cts.Cancel();
Console.CancelKeyPress += (sender, cpe) => cts.Cancel();
WhenCancelled(cts.Token).Wait();
}
19
Source : ScenePlayer.cs
with MIT License
from b-editor
with MIT License
from b-editor
public void Play()
{
if (State is PlayerState.Playing) return;
GC.Collect();
State = PlayerState.Playing;
_startTime = DateTime.Now;
_startframe = Scene.PreviewFrame;
_timer.Start();
Playing?.Invoke(this, new(_startframe));
Task.Run(() =>
{
var context = Scene.GetRequiredParent<IApplication>().AudioContext;
if (context is AudioContext audioContext)
{
PlayWithOpenAL(audioContext);
}
else if (context is XAudioContext xcontext)
{
PlayWithAudio2(xcontext);
}
});
}
19
Source : BacktraceDatabase.cs
with MIT License
from backtrace-labs
with MIT License
from backtrace-labs
private async void OnTimedEventAsync(object source, ElapsedEventArgs e)
{
if (!BacktraceDatabaseContext.Any() || _timerBackgroundWork)
{
return;
}
_timerBackgroundWork = true;
_timer.Stop();
//read first record (keep in mind LIFO and FIFO settings) from memory database
var record = BacktraceDatabaseContext.FirstOrDefault();
while (record != null)
{
var backtraceData = record.BacktraceData;
//meanwhile someone delete data from a disk
if (backtraceData == null || backtraceData.Report == null)
{
Delete(record);
}
else
{
//send record from database to API
var result = await BacktraceApi.SendAsync(backtraceData);
if (result.Status == BacktraceResultStatus.Ok)
{
Delete(record);
}
else
{
record.Dispose();
BacktraceDatabaseContext.IncrementBatchRetry();
break;
}
}
record = BacktraceDatabaseContext.FirstOrDefault();
}
_timer.Start();
_timerBackgroundWork = false;
}
19
Source : BacktraceDatabase.cs
with MIT License
from backtrace-labs
with MIT License
from backtrace-labs
private void OnTimedEvent(object source, ElapsedEventArgs e)
{
if (!BacktraceDatabaseContext.Any() || _timerBackgroundWork)
{
return;
}
_timerBackgroundWork = true;
_timer.Stop();
//read first record (keep in mind LIFO and FIFO settings) from memory database
var record = BacktraceDatabaseContext.FirstOrDefault();
while (record != null)
{
var backtraceData = record.BacktraceData;
//meanwhile someone delete data from a disk
if (backtraceData == null || backtraceData.Report == null)
{
Delete(record);
}
else
{
//send record from database to API
var result = BacktraceApi.Send(backtraceData);
if (result.Status == BacktraceResultStatus.Ok)
{
Delete(record);
}
else
{
record.Dispose();
BacktraceDatabaseContext.IncrementBatchRetry();
break;
}
}
record = BacktraceDatabaseContext.FirstOrDefault();
}
_timerBackgroundWork = false;
_timer.Start();
}
19
Source : AntMessageService.cs
with MIT License
from bang88
with MIT License
from bang88
private void startTimer()
{
if (timer == null)
{
timer = new Timer(interval * 1000);
timer.Elapsed += hide;
timer.AutoReset = false;
}
if (timer.Enabled)
{
timer.Stop();
}
timer.Start();
}
19
Source : SearchBox.xaml.cs
with MIT License
from barry-jones
with MIT License
from barry-jones
private void Search_TextChanged(object sender, TextChangedEventArgs e) {
TextBox textBox = e.Source as TextBox;
if (textBox != null) {
this.searchEntryTimer.Start();
}
}
19
Source : MainWindow.xaml.cs
with MIT License
from barry-jones
with MIT License
from barry-jones
private void searchBox_Populating(object sender, PopulatingEventArgs e)
{
AutoCompleteBox textBox = e.Source as AutoCompleteBox;
if(textBox != null)
{
this.searchEntryTimer.Start();
}
}
19
Source : LogManager.cs
with MIT License
from Battlerax
with MIT License
from Battlerax
public static void StartLogArchiveTimer()
{
ArchiveLogs();
archiveTimer = new Timer {Interval = 3.6e+6};
archiveTimer.Elapsed += ArchiveTimer_Elapsed;
archiveTimer.Start();
}
19
Source : TimeWeatherManager.cs
with MIT License
from Battlerax
with MIT License
from Battlerax
[ServerEvent(Event.ResourceStart)]
public void OnResourceStart()
{
NAPI.Util.ConsoleOutput("Loading Weather Module.");
//Set proper current time
var time = CurrentTime;
Minutes = Math.Abs(time.Minute - 30);
Hours = Math.Abs(time.Hour - 12);
WeatherTimeTimer_Elapsed(this, null);
_weatherTimeTimer = new Timer(60000);
_weatherTimeTimer.Elapsed += WeatherTimeTimer_Elapsed;
_weatherTimeTimer.AutoReset = true;
_weatherTimeTimer.Start();
NAPI.Util.ConsoleOutput("Weather Updated To LA.");
}
See More Examples