//void SetStacksNumber() //{ // Dispatcher.Invoke(() => // { // if (Stacks > 1) // { // s.Visibility = Visibility.Visible; // stacksnumber.Text = Stacks.ToString(); // } // else // { // s.Visibility = Visibility.Hidden; // } // }); //} private void PacketRouter_BuffUpdated(ulong target, Data.Abnormality ab, int duration, int stacks) { //SecondsTimer.Stop(); Dispatcher.Invoke(() => { if (target == TargetId) { if (ab.Id == AbnormalityId) { Duration = duration; Stacks = stacks; CurrentTime = duration / 1000; //number.Text = (duration / 1000).ToString(); //SetStacksNumber(); //InitTimer(); if (SecondsTimer != null) { SecondsTimer.Stop(); SecondsTimer.Enabled = true; } if (duration < 0) { //durationLabel.Visibility = Visibility.Hidden; //number.Text = "-"; return; } arc.BeginAnimation(Arc.EndAngleProperty, new DoubleAnimation(0, 359.9, TimeSpan.FromMilliseconds(duration))); } } }); }
private void btnStop_Click(object sender, EventArgs e) { //closing the serialport but keeping the preferences! mySerialPort.Close(); textToAdd = "--End-of-Log--"; fileclose = true; txtlog(); filecreated = false; lblMessage.Text = "Log Stopped"; btnStop.Enabled = false; btnStart.Enabled = true; logging = false; SecondsTimer.Stop(); timer = 0; lblTimer.Text = Convert.ToString(timer); //enabling preferences btnSearchCom.Enabled = true; cbCom.Enabled = true; cbBaudRate.Enabled = true; btnLocation.Enabled = true; tbFileName.Enabled = true; tbLogID.Enabled = true; cbTimer.Enabled = true; }
public void Freeze() { lock (freezeLock) { Flashlight.UnInitCamera(); SecondsTimer.Stop(); MusicView.XNAFrameworkDispatcher.Stop(); } }
public void UnFreeze() { lock (freezeLock) { Flashlight.InitCamera(); secondsTimer_Tick(null, null); SecondsTimer.Start(); MusicView.XNAFrameworkDispatcher.Start(); } }
// Constructor public SessionViewModel(Session session) { // Set instance variables mSession = session; mTimer = new SecondsTimer(mSession.Interval); mSoundManager = new SoundManager(); // shuffle Session's list of image paths Random randy = new Random(); mShuffledImagePaths = mSession.ImagePaths.OrderBy(path => randy.Next()).ToList(); // Handle changes to SecondsTimer's properties mTimer.PropertyChanged += (sender, args) => { switch (args.PropertyName) { case "State": IntervalTimerState_Change(mTimer.State); break; case "RemainingSeconds": IntervalTimerRemainingSeconds_Change(mTimer.RemainingSeconds); break; } }; // Handle changes to Session's properties mSession.PropertyChanged += (sender, args) => { switch (args.PropertyName) { case "State": SessionState_Change(mSession.State); break; } }; // Initialize view to SecondsTimer's properties IntervalTimerState_Change(mTimer.State); IntervalTimerRemainingSeconds_Change(mTimer.RemainingSeconds); // Initialize view to Session's properties SessionState_Change(mSession.State); // Display first image CurrentImageIndex = 0; CurrentImagePath = mShuffledImagePaths[CurrentImageIndex]; // Start the interval timer by setting SessionState to Started SessionState = Session.SessionState.Started; }
private void btnStart_Click(object sender, EventArgs e) { fileName = tbFileName.Text; //configure all the serial settings and getting preferences mySerialPort = new SerialPort(COM); mySerialPort.BaudRate = BAUD; mySerialPort.Parity = Parity.None; mySerialPort.StopBits = StopBits.One; mySerialPort.DataBits = 8; mySerialPort.Handshake = Handshake.None; logID = tbLogID.Text; //binding the event mySerialPort.DataReceived += new SerialDataReceivedEventHandler(DataReceivedHandler); //opening the serialport and turn logging on mySerialPort.Open(); lblMessage.Text = "Log Started"; btnStart.Enabled = false; btnStop.Enabled = true; logging = true; fileclose = false; SecondsTimer.Start(); //disableing preferences for reasons: spacebar is used to start/stop logging, otherwise you would type in the boxes btnSearchCom.Enabled = false; cbCom.Enabled = false; cbBaudRate.Enabled = false; btnLocation.Enabled = false; tbFileName.Enabled = false; tbLogID.Enabled = false; cbTimer.Enabled = false; }
private void StartTimer() { _downloadTimer = new SecondsTimer(userData.GetJumpHashTime()); _downloadTimer.Start(); _downloadTimer.TimeOutEvent += OnTimerInvoked; }