public ScrollingText() { InitializeComponent(); this.DoubleBuffered = true; this.BackgroundColor = Color.Black; this.TextColor = Color.Red; this.Speed = DEFAULT_SPEED; this.HeightPercentage = DEFAULT_HEIGHT; this.BackColor = Color.Black; _speed = DEFAULT_SPEED; _timer = new Multimedia.Timer(); _timer.Period = _speed; _timer.Tick += TickHandler; _timer.Start(); _position = 0; //Set up the resize event to set the height of the control this.Resize += ResizeHandler; _tempHeight = this.Height; }
public FrameSender() { InitializeComponent(); frames = new List<CANFrame>(); sendingData = new List<FrameSendData>(); fastTimer = new Multimedia.Timer(); fastTimer.Period = 1; }
public FrameSender() { InitializeComponent(); frames = new List <CANFrame>(); sendingData = new List <FrameSendData>(); fastTimer = new Multimedia.Timer(); fastTimer.Period = 1; }
/* Handles the click on the continuous frame button. */ private void toolStripButtonContinuousShot_Click(object sender, EventArgs e) { /*ContinuousShot(); /* Start the grabbing of images until grabbing is stopped. */ my_trigger = new Multimedia.Timer(); my_trigger.Resolution = 0; my_trigger.Period = (int)trigger_period.Value; my_trigger.Tick += new EventHandler(get_single_frame); my_trigger.Start(); }
public MainWindow() { InitializeComponent(); // Добавление кнопок в коллекцию объектов CreateTlgBtnCollection(); // Создание таймера _timer = new Multimedia.Timer { Resolution = 1, Period = Delay }; _timer.Tick += _timer_Tick; }
public SDI_Capture(frmMain frm) { videoDeviceInfo = new VideoDeviceInfo(); frmMain = frm; tmr = new Multimedia.Timer(); tmr.Period = 1000; tmr.Mode = Multimedia.TimerMode.Periodic; tmr.Tick += tmr_Tick; //frmMain.videoSourcePlayer.Parent = frmMain.pict1; //frmMain.videoSourcePlayer.Parent = frmMain.panelPict; /*frmMain.videoSourcePlayer.Parent = frmMain.pict1; * frmMain.videoSourcePlayer.Location = new System.Drawing.Point(0, 0); * frmMain.videoSourcePlayer.Size = new Size(0,0);*/ }
public Common(object parentForm, object etoSurface) { #if WINFORMS parent = (FormMain)parentForm; canvas = parent; #else parent = (MainForm)parentForm; canvas = (Drawable)etoSurface; canvas.Focus(); #endif fpsDelay = (int)(dtFactor / fps); #if WINFORMS // So far, this is the only way to get sub 15ms resolutions // while VS is not running // https://www.codeproject.com/Articles/5501/The-Multimedia-Timer-for-the-NET-Framework tmr = new Multimedia.Timer { Mode = Multimedia.TimerMode.Periodic, Period = 5, Resolution = 1 }; tmr.Tick += (_, __) => evt.Set(); UpdateTitlebarText(); SetBounds(); CreateRandomObjects(); SetEventsHandlers(); RunSimLoop(); #else parent.Shown += (_, __) => { UpdateTitlebarText(); SetBounds(); SetEventsHandlers(); CreateRandomObjects(); RunSimLoop(); }; #endif helpFont = GetMonoFont(); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.m_components = new System.ComponentModel.Container(); //this.m_captureTimer = new System.Windows.Forms.Timer(this.m_components); m_timer = new Multimedia.Timer(this.m_components); m_timer.SynchronizingObject = this; m_timer.Resolution = 1; // // timer1 // //this.m_captureTimer.Tick += new System.EventHandler(this.OnCaptureTimer_Tick); m_timer.Tick += new EventHandler(this.OnCaptureTimer_Tick); // // WebCamCapture // this.Name = "WebCamCapture"; this.Size = new System.Drawing.Size(1280, 720); }
//public Udp(IPAddress _addrTo, int _portTo, IPAddress _addrFrom, int _portFrom) public Udp(IPAddress _addrTo, int _portTo) { addrTo = _addrTo; //addrFrom = _addrFrom; portTo = _portTo; //portFrom = _portFrom; endPointTo = new IPEndPoint(addrTo, portTo); //endPointFrom = new IPEndPoint(addrFrom, portFrom); endPointFrom = new IPEndPoint(IPAddress.Any, portTo); try { udpClient.Bind(endPointFrom); } catch (SocketException ex) { throw ex; } com_timer = new Multimedia.Timer(); com_timer.Stop(); com_timer.Tick += com_timer_Tick; com_timer.Period = 1; com_timer.Resolution = 0; }
private void Tick() { var deltaTime = ((double)deltaClock.ElapsedMilliseconds / 1000d); deltaClock.Restart(); tickClock.Restart(); for (var i = 0; i < registeredGameComponents.Count; i++) { registeredGameComponents[i].Tick(deltaTime); } var elapsedExecutionTime = (int)tickClock.ElapsedMilliseconds; var delayTime = tickDelay - elapsedExecutionTime; if (IsRunning) { if (delayTime <= Multimedia.Timer.Capabilities.periodMin) { Tick(); } else { mediaTimer = new Multimedia.Timer() { Period = tickDelay - elapsedExecutionTime, Mode = Multimedia.TimerMode.OneShot }; mediaTimer.Tick += (s, e) => Tick(); mediaTimer.Start(); } } else { this.CleanUp(); } }
public TriggerTask(Action callback, long delayMilliseconds) { _callback = callback; _delayMilliseconds = delayMilliseconds; _sw = new Stopwatch(); _scanTask = true; //_mmTimer = new MMTimer(); //_mmTimer.Timer += (senser, ea) => //{ // if (_scanTask) // { // if (this.IsRunning && _callback != null) // { // if (_sw.ElapsedMilliseconds > _delayMilliseconds) // { // _callback.Invoke(); // Stop(); // } // } // } //}; //_mmTimer.Start(1, true); mmTimer = new Multimedia.Timer(ModulesFactory.Components); mmTimer.Mode = Multimedia.TimerMode.Periodic; mmTimer.Period = 1; mmTimer.Resolution = 1; mmTimer.Tick += (senser, ea) => { if (_scanTask) { if (this.IsRunning && _callback != null) { if (_sw.ElapsedMilliseconds > _delayMilliseconds) { _callback.Invoke(); Stop(); } } } }; mmTimer.Start(); //_thread = new Thread(() => //{ // uint loops = 0; // while (_scanTask) // { // if (this.IsRunning && _callback != null) // { // if (_sw.ElapsedMilliseconds > _delayMilliseconds) // { // _callback.Invoke(); // Stop(); // } // } // loops = (loops + 1) % 100; // if (Environment.ProcessorCount == 1 || loops == 0) // { // Thread.Sleep(1); // } // else // { // //Thread.SpinWait(_iterations); // Wait(1); // } // } //}); //_thread.IsBackground = true; //_thread.Start(); }