public void Open() { try { bool isConnected = FindTheHid(vendorId, productId); if (isConnected) { Tracer.Trace("OK: USB Interface connected with PIC USB Proximity Board"); } else { string str = string.Format("USB Interface could not connect with device with Vendor ID={0} Product ID={1}", vendorId, productId); Tracer.Error(str); throw new Exception(str); } // run a monitoring thread in case we need to reset things: picUsbTickerTimer = new System.Windows.Forms.Timer(); picUsbTickerTimer.Interval = 1000; // ms picUsbTickerTimer.Tick += new EventHandler(picUsbTicker); picUsbTickerTimer.Start(); Tracer.Trace("OK: PIC Proximity Board ticker ON"); } catch (Exception ex) { Tracer.Error(ex); throw; } }
public SledSyntaxCheckerService(ISettingsService settingsService) { Enabled = true; Verbosity = SledSyntaxCheckerVerbosity.Overall; var enabledProp = new BoundPropertyDescriptor( this, () => Enabled, "Enabled", null, "Enable or disable the syntax checker"); var verboseProp = new BoundPropertyDescriptor( this, () => Verbosity, "Verbosity", null, "Verbosity level"); // Persist settings settingsService.RegisterSettings(this, enabledProp, verboseProp); // Add user settings settingsService.RegisterUserSettings("Syntax Checker", enabledProp, verboseProp); m_syncContext = SynchronizationContext.Current; m_batchTimer = new Timerz { Interval = TimerIntervalMsec }; m_batchTimer.Tick += BatchTimerTick; m_batchTimer.Start(); }
public GameMultiplayerControl(Control Control, GameScreen GameScreen, int MapIndex, int SaveGameIndex, MultiplayerMatchStartInformation MP) : base(Control, GameScreen, MapIndex, SaveGameIndex, true) { this.UserName = MP.UserName; this.Password = MP.Password; this.MatchId = MP.MatchId; this.GameState = 0; this.MultiplayerMatch = true; this.MultiplayerFraction = MP.MultiplayerFraction; // timer checking if a newer game state is available NewGameStateAvailableTimer = new System.Windows.Forms.Timer(); NewGameStateAvailableTimer.Interval = 1000; NewGameStateAvailableTimer.Tick += UpdateGameState; NewGameStateAvailableTimer.Start(); // show multiplayer tab (gui) and update it's content GameScreen.TabItem_Multiplayer.Visibility = Visibility.Visible; GameScreen.Button_Restart.IsEnabled = false; // disable restart map button for multiplayer matches GameScreen.Label_Multiplayer_MatchID.Content = R.String("MatchID") + ": " + MatchId.ToString(); GameScreen.Label_Multiplayer_MatchVersion.Content = R.String("MatchVersion") + ": " + GameState.ToString(); // background worker BackgroundWorkerDownloadLatestGameState.DoWork += BackgroundWorkerDownloadLatestGameStateWork; BackgroundWorkerDownloadLatestGameState.RunWorkerCompleted += BackgroundWorkerDownloadLatestGameState_RunWorkerCompleted; }
public SparkleBubble(string title, string subtext) : base(title, subtext) { System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer (); timer.Tick += delegate { this.Close (); }; timer.Interval = 4500; timer.Start (); }
public void breakdown() { setBrokenDown(true); breakdownTimer = new System.Windows.Forms.Timer(); breakdownTimer.Interval = Settings.getSimSettings().getBreakdownTime(); breakdownTimer.Start(); breakdownTimer.Tick += new EventHandler(breakdown_Tick); }
private Timer CreateTimer(Action action, int seconds) { var timer = new Timer(); timer.Tick += (sender, args) => action(); timer.Interval = seconds * 1000; timer.Start(); return timer; }
/// <summary> /// Initializes static members of the <see cref="MovieScrapeFactory"/> class. /// </summary> static MovieScrapeFactory() { postProcess = new BindingList<MovieModel>(); timer = new Timer(); timer.Tick += Timer_Tick; timer.Interval = 100; timer.Start(); }
public bool ShowPage(string url) { var window = dte.ItemOperations.Navigate(url, vsNavigateOptions.vsNavigateOptionsNewWindow); activationTimer = new System.Windows.Forms.Timer(); activationTimer.Tick += (sender, args) => ActivateWindow(window); activationTimer.Interval = 5000; activationTimer.Start(); return true; }
private void CreateTickTimer() { DestroyTickTimer(); const float fps = 80; float interval = (1.0f / fps) * 1000.0f; tickTimer = new System.Windows.Forms.Timer(); tickTimer.Interval = (int)interval; tickTimer.Tick += tickTimer_Tick; tickTimer.Start(); }
public void Start() { IsFlooding = true; LastAction = Tick(); tTimepoll = new System.Windows.Forms.Timer(); tTimepoll.Tick += new EventHandler(tTimepoll_Tick); tTimepoll.Start(); BackgroundWorker bw = new BackgroundWorker(); bw.DoWork += new DoWorkEventHandler(bw_DoWork); bw.RunWorkerAsync(); }
/// <summary> /// Constructor. /// </summary> public SampleCounter() { // Initialise variables prevSamplesReceived = 0; SamplesReceived = 0; // Setup timer timer = new System.Windows.Forms.Timer(); timer.Interval = 1000; timer.Tick += new EventHandler(timer_Tick); timer.Start(); }
/// <summary> /// Constructs a Time-Based progress meter that shows progress against an expected time. /// </summary> /// <param name="progressHandler"></param> /// <param name="baseMessage"></param> /// <param name="EstimatedTime"></param> public ProgressMeter(IProgressHandler progressHandler, string baseMessage, TimeSpan EstimatedTime) { _progressHandler = progressHandler; _baseMessage = baseMessage; _timeSpan = EstimatedTime; _endValue = EstimatedTime.TotalSeconds * 1000; _timer = new System.Windows.Forms.Timer(); _timer.Interval = Convert.ToInt32(_timeSpan.TotalSeconds * 10); // Attempt to have a tick once during each estimated percentile //_timer.Interval = 100; _timer.Tick += new EventHandler(_timer_tick); _timer.Start(); // Timers should be on another thread... }
public TimerBox(TimeSpan time) { InitializeComponent(); this.Topmost = true; this.Top = 0; this.Left = 0; timer = time; timer1 =new System.Windows.Forms.Timer(); timer1.Interval = 1000; timer1.Tick += new EventHandler(timer1_Tick); initiate(); timer1.Start(); }
private object ShownWorkSpaceChangedReceiver(Message message, FQID sender, FQID related) { if (message.Data is Item && ((Item)message.Data).FQID.ObjectId == Id) { _workSpaceSelected = true; Notification = null; _updateInformationTimer.Stop(); } else { _workSpaceSelected = false; _updateInformationTimer.Start(); } return(null); }
public AudioManager() { starttime = DateTime.Now; time = new System.Windows.Forms.Timer(); time.Interval = 1000; time.Tick += Time_Tick; time.Start(); WavIn = new WaveInEvent(); WavIn.BufferMilliseconds = 50; WavIn.WaveFormat = new WaveFormat(SAMPLERATE, 16, 1); WavIn.DeviceNumber = -1; WavIn.DataAvailable += WavIn_DataAvailable; WavIn.StartRecording(); }
private async void dbInit() { List <PcGroupe> temp = await HttpMessage.MethodGet <PcGroupe>("api/Pcs"); if (temp == null) { return; } Data.PcGroupe = new ObservableCollection <PcGroupe>(temp); PcGroupes = Data.PcGroupe; timer.Start(); }
public void ToggleReading() { if (!readTimer.Enabled) { readTimer.Start(); castView.UpdateReadButton(false); castView.EnableControls(true); } else { readTimer.Stop(); castView.UpdateReadButton(true); castView.EnableControls(false); } }
public VirtualCapture(string name, string uuid, Size size, int fps, int numRadialDistortionCoefficients = 0, Matrix<float> undistortMapX = null, Matrix<float> undistortMapY = null) : base(name, uuid, size) { NumRadialDistortionCoefficients = numRadialDistortionCoefficients; UndistortMapX = undistortMapX; UndistortMapY = undistortMapY; Rgba = new Picture<Rgba, byte>(Width, Height); Gray = new Picture<Gray, byte>(Width, Height); Timer = new Timer(); Timer.Interval = 1000 / fps; Timer.Tick += Update; Timer.Start(); }
public void Enable() { try { Enabled = true; Timer.Start(); LastFrameNum = 0; CurrentFrameNum = 0; Globals.Host.Underlying.Hooks.RenderPreUI += new Decal.Interop.Core.IACHooksEvents_RenderPreUIEventHandler(hooks_RenderPreUI); } catch (Exception ex) { Util.LogError(ex); } }
void ProgressDialog_Load(object sender, EventArgs e) { banner.Image = Runtime.Session.GetResourceBitmap("WixUI_Bmp_Banner"); if (!WindowsIdentity.GetCurrent().IsAdmin() && Uac.IsEnabled()) { this.waitPrompt.Text = Runtime.Session.Property("UAC_WARNING"); showWaitPromptTimer.Start(); } ResetLayout(); Shell.StartExecute(); }
public CorpseTracker() { try { CoreManager.Current.WorldFilter.CreateObject += new EventHandler <Decal.Adapter.Wrappers.CreateObjectEventArgs>(WorldFilter_CreateObject); CoreManager.Current.WorldFilter.ChangeObject += new EventHandler <ChangeObjectEventArgs>(WorldFilter_ChangeObject); CoreManager.Current.WorldFilter.ReleaseObject += new EventHandler <ReleaseObjectEventArgs>(WorldFilter_ReleaseObject); CoreManager.Current.ContainerOpened += new EventHandler <ContainerOpenedEventArgs>(Current_ContainerOpened); maintenanceTimer.Interval = 60000; maintenanceTimer.Tick += new EventHandler(maintenanceTimer_Tick); maintenanceTimer.Start(); } catch (Exception ex) { Debug.LogException(ex); } }
private void ButtonResume_Click(object sender, RoutedEventArgs e) { //' Handle button states ButtonResume.IsEnabled = false; ButtonSuspend.IsEnabled = true; //' Enable timer timer.Start(); //' Handle UI elements ProgressBar.IsIndeterminate = true; LabelStatus.Content = "Monitor running"; WriteLogFile("Successfully resumed monitoring data process"); }
/// <summary> /// Show magnifier and begin eye dropping. /// </summary> private void BeginEyedropping() { _isEyedropperMode = true; timer1Ticks = 0; eyeDropperTimer.Start(); Mouse.OverrideCursor = eyeDropperCursor; PPExtraEventHelper.PPMouse.LeftButtonUp += LeftMouseButtonUpEventHandler; magnifier.Show(); if (_eyedropperMode == MODE.MAIN) { eyeDropperPreviewRectangle.Fill = selectedColorRectangle.Fill; selectedColorRectangle.Opacity = 0; } }
public void StartWork() { _dal = new ZdPressDal(); if (WithFakeData) { Rundomizer = new Random(1); FakeTestTimer = new System.Windows.Forms.Timer { Interval = 3000 }; FakeTestTimer.Tick += (e, a) => { PressOperationData od = new PressOperationData { ShowGraph = true, DlinaSopr = cc++ *20 + Rundomizer.Next(2), DispPress = cc + Rundomizer.Next(200) * 10 }; if (cc % 10 == 0) { od.ShowGraph = false; cc = 0; } if (CurrentPressOperation.PressOperationData == null) { CurrentPressOperation.PressOperationData = new BindingList <PressOperationData>(); } FireOperationDataCreated(od); SavePressOperationData(od); }; FakeTestTimer.Start(); } else { OpcResponderSingleton.Instance.OnReceivedDataAction += OnReceivedData; OpcResponderSingleton.Instance.ConfigureProcessor(); OpcResponderSingleton.Instance.TimerStart(); } }
private void Window_Loaded_1(object sender, RoutedEventArgs e) { m_hwnd = new WindowInteropHelper(this).Handle; Int32 windowStyle = GetWindowLongPtr(m_hwnd, GWL_STYLE); SetWindowLongPtr(m_hwnd, GWL_STYLE, windowStyle & ~WS_MAXIMIZEBOX); m_bIsSupportTaskbarManager = true; this.TaskbarItemInfo.ThumbnailClipMargin = new Thickness(0, 0, 0, 0); try { DateTime restoreStart = DateTime.Parse(TomatoTimerWPF.TimerSettings.Default.TimerRestoreDateTime); m_TimeDateStart = restoreStart; m_TimeDatePauseStart = restoreStart; //m_TimeDateStart = DateTime.Now; //m_TimeDatePauseStart = DateTime.Now; m_mode = (TimerMode)TomatoTimerWPF.TimerSettings.Default.TimerRestoreMode; } catch (Exception) { m_TimeDateStart = DateTime.Now; m_TimeDatePauseStart = DateTime.Now; } m_pageButtons = new Page_Buttons(this); m_pageSettings = new Page_Settings(this); m_pageSoundSettings = new Page_SoundSettings(this); btnAlwaysOnTop.IsChecked = TomatoTimerWPF.TimerSettings.Default.AlwaysOnTop; if (btnAlwaysOnTop.IsChecked == true) { this.ToggleAlwaysOnTop(); } spWindowControlStackPanel.Margin = new Thickness(0, -this.Height, 0, 0); m_sbAniOut.Begin(spWindowControlStackPanel); this.ucContent.Children.Add(m_pageButtons); UpdateUI(); m_timer = new System.Windows.Forms.Timer(); m_timer.Interval = 1000; m_timer.Tick += new EventHandler(Timer_Tick); m_timer.Start(); }
private void VideoHost_MouseDoubleClickEvent(object sender, System.Windows.Forms.MouseEventArgs e) { try { if (i == 0) { x = Grid.GetColumn((VideoHost)sender); y = Grid.GetRow((VideoHost)sender); i++; } if (full) { Grid.SetRow((VideoHost)sender, y); Grid.SetColumn((VideoHost)sender, x); Grid.SetRowSpan((VideoHost)sender, 1); Grid.SetColumnSpan((VideoHost)sender, 1); foreach (var item in LV) { item.Visibility = Visibility.Visible; } full = false; i--; } else { Grid.SetRow((VideoHost)sender, 0); Grid.SetColumn((VideoHost)sender, 0); Grid.SetRowSpan((VideoHost)sender, row); Grid.SetColumnSpan((VideoHost)sender, col); foreach (var item in LV) { item.Visibility = Visibility.Hidden; } ((VideoHost)sender).Visibility = Visibility.Visible; full = true; } ifx.txStatus.Visibility = Visibility.Visible; myTimer.Dispose(); myTimer.Tick += new EventHandler(Inforxaml_Hidden); myTimer.Enabled = false; myTimer.Interval = 4000; myTimer.Start(); } catch { } }
public void PulseChanger() { iu = 0; id = 62; if (lastcolor == "red") { or = 64; og = 0; ob = 64; lastcolor = "violet"; } else if (lastcolor == "violet") { or = 0; og = 0; ob = 64; lastcolor = "blue"; } else if (lastcolor == "blue") { or = 0; og = 64; ob = 64; lastcolor = "cyan"; } else if (lastcolor == "cyan") { or = 0; og = 64; ob = 0; lastcolor = "green"; } else if (lastcolor == "green") { or = 64; og = 64; ob = 0; lastcolor = "yellow"; } else if (lastcolor == "yellow") { or = 64; og = 0; ob = 0; lastcolor = "red"; } colorchanger.Start(); }
public RunMode(int nodenumber) { MyInitializeComponent(nodenumber); lastcalls = new Queue <string>(); this.Loaded += new RoutedEventHandler(RunMode_Loaded); uiTimer = new System.Windows.Forms.Timer(); uiTimer.Tick += new EventHandler(uiTimer_Tick); uiTimer.Interval = 200; //200ms for UI update uiTimer.Start(); tm_cursor = new System.Windows.Forms.Timer(); tm_cursor.Tick += new EventHandler(tm_cursor_Tick); tm_cursor.Interval = 5000; this.MouseLeftButtonDown += new MouseButtonEventHandler(RunMode_MouseMove); this.title_speed.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.title_speed_MouseDown); }
private void Window_Loaded(object sender, RoutedEventArgs e) { this.Visibility = Visibility.Hidden; loginWindow lw = new loginWindow(enginee); lw.Top = this.Top + 100; lw.Left = this.Left + 100; lw.Owner = this; lw.Show(); lw.Focus(); lw.tbLogin.Focus(); System.Windows.Forms.Timer tim = new System.Windows.Forms.Timer(); tim.Tick += new EventHandler(enginee._sendEmpty); tim.Interval = 20000; tim.Start(); }
private void InitializeDelayedTextChangedEvent() { if (m_delayedTextChangedTimer != null) { m_delayedTextChangedTimer.Stop(); } if (m_delayedTextChangedTimer == null || m_delayedTextChangedTimer.Interval != this.DelayedTextChangedTimeout) { m_delayedTextChangedTimer = new System.Windows.Forms.Timer(); m_delayedTextChangedTimer.Tick += new EventHandler(HandleDelayedTextChangedTimerTick); m_delayedTextChangedTimer.Interval = this.DelayedTextChangedTimeout; } m_delayedTextChangedTimer.Start(); }
public void StartThreadForSync() { bool firstSync = true; m_timer = new System.Windows.Forms.Timer(); m_timer.Interval = Minder.Static.StaticData.Settings.Sync.Interval * 1000 * 60; m_timer.Tick += delegate { if (firstSync == false) { Sync(); } firstSync = false; }; // Thread.Sleep(m_timer.Interval); m_timer.Start(); }
protected virtual void CommitEx() { // 需要clone 一份SearchPara, 避免与界面上的重用冲突 SearchPara searchPara = m_SearchPara.Clone() as SearchPara; try { Framework.Container.Instance.VideoSearchService.StartSearch(m_SearchPara); CanSearchOrCancelSearch = false; m_Timer.Start(); } catch (SDKCallException ex) { Common.SDKCallExceptionHandler.Handle(ex, "检索"); } }
public GifImageStyle(FastColoredTextBox parent) : base(null, null, FontStyle.Regular) { ImagesByText = new Dictionary<string, Image>(); this.parent = parent; //create timer timer = new System.Windows.Forms.Timer(); timer.Interval = 100; timer.Tick += (EventHandler)delegate { ImageAnimator.UpdateFrames(); parent.Invalidate(); }; timer.Start(); }
public notify(MainWindow1 parentWindow) { parent = parentWindow; InitializeComponent(); this.Left = ((parent.Displays[Properties.Settings.Default.DisplayIndex].Bounds.Location.X + parent.Displays[Properties.Settings.Default.DisplayIndex].Bounds.Width) - this.Width) - 107; this.Top = parent.Displays[Properties.Settings.Default.DisplayIndex].Bounds.Location.Y - this.Height; ypos = parent.Displays[Properties.Settings.Default.DisplayIndex].Bounds.Location.Y; this.Show(); this.SetAeroGlass(); this.Topmost = Properties.Settings.Default.TopMostNotify; Timer.Tick += new EventHandler(timer_Tick); Timer.Interval = (1); Timer.Start(); }
public ERDOnlineBase() { listener = new TcpListener(port); listener.Start(); rmd_listener = new TcpListener(RMDServer.port); rmd_listener.Start(); list_timer.Interval = 100; list_timer.Tick += Timer_Elapsed; list_timer.Start(); rmd_timer.Interval = 20; rmd_timer.Tick += Rmd_timer_Elapsed; rmd_timer.Start(); }
private void Animate(AnimationSpeed speed, MovementDirection direction) { _isAnimating = true; var interval = SpeedMap.GetSpeed(speed); if (direction == MovementDirection.Right) { AutoAnimationSpeed = -AutoAnimationSpeed; } _timer = new System.Windows.Forms.Timer { Interval = interval }; VarZ = AutoAnimationSpeed; _timer.Tick += (s, a) => ResetZ(0); _timer.Start(); }
/// <summary> /// Initializes a new instance of the <see cref="StartupScreen" /> class. /// </summary> /// <exception cref="InvalidOperationException"> /// The item to add already has a different logical parent. /// </exception> /// <exception cref="InvalidOperationException">The collection is in ItemsSource mode.</exception> public StartupScreen() { Globals.UserToken = null; Application.Current.ChangeAppStyle(ThemeManager.GetAccent("Emerald")); InitializeComponent(); FlipView.HideControlButtons(); foreach (var image in SplashImageList) { FlipView.Items.Add(new Image { Source = image, Stretch = Stretch.UniformToFill }); } myTimer.Tick += TimerEventProcessor; myTimer.Interval = 10000; myTimer.Start(); }
public SpriteCanvas() { _buffer = new Bitmap(2000, 2000); _timer = new System.Windows.Forms.Timer(); _timer.Interval = 10; _timer.Tick += (s, e) => { _animationStep += AnimationStepSize; if (_animationStep > AnimationSteps) { _animationStep = 0; } this.Invalidate(); }; _timer.Start(); }
public GifImageStyle(FastColoredTextBox parent) : base(null, null, FontStyle.Regular) { ImagesByText = new Dictionary <string, Image>(); this.parent = parent; //create timer timer = new System.Windows.Forms.Timer(); timer.Interval = 100; timer.Tick += (EventHandler) delegate { ImageAnimator.UpdateFrames(); parent.Invalidate(); }; timer.Start(); }
void StartCalculation() { cancellation = new CancellationTokenSource(); calculation = new ParallelCalculation { Prof = this.Prof, Prop = this.Prop, Rango = this.Rango }; calculation.Run(Finished, cancellation.Token, threads); progressBar.Value = 0; progressTimer = new System.Windows.Forms.Timer(components) { Interval = 100 }; progressTimer.Tick += ProgressTimer_Tick; progressTimer.Start(); UpdateUI(); }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { CheckAniLeft = Resources["CheckAniLeft"] as Storyboard; CheckAniRight = Resources["CheckAniRight"] as Storyboard; t.Interval = 5000; t.Tick += delegate { t.Interval = 5000; if (HasCheck) { HasCheck = false; t.Interval = 10000; } TurnRight(); }; t.Start(); }
/// <summary> Выйти в перерыв, заблокировав рабочую область и запустить отчёт времени перерыва </summary> void toRest(System.Windows.Controls.Button toRestButton, int count) { togglePanel(); sw.Stop(); dt.Stop(); continue_button.IsEnabled = true; parseSqlTime(sessionRestTime, ref timeRestCollector); ts = TimeSpan.FromMinutes(count); maxUnitTime = count; timer = new System.Windows.Forms.Timer(); timer.Tick += Timer_Tick; timer.Interval = 1000; rest_time_label.Content = String.Format(cd, ts.ToString()); toggleWorkingElements(); timer.Start(); }
public void Start() { System.Windows.Forms.Timer t = new System.Windows.Forms.Timer(); socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); IPEndPoint iep = new IPEndPoint(host_address_ip, host_address_port); socket.Bind(iep); socket.Listen(5); socket.BeginAccept(Connected, this); t.Interval = 1000; t.Tick += new EventHandler(t_Tick); t.Start(); }
/// <summary> /// 打印机状态 /// </summary> /// <returns></returns> private SeatManage.EnumType.Printer PrintStatusHandle() { printServer.Refresh(); PrintQueue printQueue = printServer.DefaultPrintQueue; if (printQueue.NumberOfJobs >= 1) { printerStatusTimer.Start(); return(SeatManage.EnumType.Printer.NoPaper); } else { printerStatusTimer.Stop(); return(SeatManage.EnumType.Printer.Normal); } }
public Call(User friend) { Frame = new BitmapImage(); Resolution = null; Friend = friend; PlayingVoice = false; VoiceQueue = new Queue <byte[]>(); ShowDebug = true; FPSRetrieved = 0; timer = new System.Windows.Forms.Timer { Interval = 1000 }; timer.Tick += FPSChecking; timer.Start(); }
public TrainConnection(CTrafficMessage trafficMessage) { administration = Program._Administration; TrafficMessage = trafficMessage; connectedTrains = new List<Arduino>(); _IP2ARDUINO = new Dictionary<IPEndPoint, Arduino>(); _ARDUINO2IP = new Dictionary<Arduino, IPEndPoint>(); _ID2ARDUINO = new Dictionary<int, Arduino>(); _ARDUINO2ID = new Dictionary<Arduino, int>(); _ARDUINO2TRAIN = new Dictionary<Arduino, Train>(); string[] ports = System.IO.Ports.SerialPort.GetPortNames(); int id = 1; foreach(string port in ports) { IPEndPoint endpoint = new IPEndPoint(new IPAddress(0xA9FE0000+ArduinoIdToIPAddress(id)), 3333);//169.254.0.0+id:3333 Arduino a = new Arduino(id, port); Train arduinoTrain = new Train(id, int.Parse(port.Remove(0, 3))); connectedTrains.Add(a); AddArduino(endpoint, a, arduinoTrain); try { a.Connect(); } catch(Exception ex) { Console.WriteLine(ex.Message); } id++; } //_timer = new Timer(1000.0); //_timer.Elapsed += Tick; _timer = new System.Windows.Forms.Timer(); _timer.Interval = 127; _timer.Tick += _timer_Tick; ; _timer.Enabled = true; _timer.Start(); Program._TrainConnection = this; }
public MainWindow() { InitializeComponent(); BtnStart.Content = "START"; MyTimerText.Content = "00:00:00.00"; MyDateTimeText.Content = string.Format("{0} - {1}", DateTime.Now.ToLongDateString(), DateTime.Now.ToLongTimeString()); myDateTimeTimer = new System.Windows.Forms.Timer(); myDateTimeTimer.Tick += new EventHandler(myDateTimeTimer_Tick); myDateTimeTimer.Interval = 1000; myDateTimeTimer.Start(); myTimer = new System.Windows.Forms.Timer(); myTimer.Tick += new EventHandler(myTimer_Tick); myTimer.Interval = 10; }
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(); }); }
/// <summary> /// constructor /// </summary> public Learner() { #if __DEBUG__ this.DebugUI = new iDebug(Console.Title); this.DebugUI.Hide(); #endif // init random # generator this.RandGen = new Random(Environment.TickCount); // init previous mutation factor container this.PrevMutationfactor = new KeyValuePair<SAPair, uint>(); /** * Make timer to update the random # generator's seed value */ System.Windows.Forms.Timer t = new System.Windows.Forms.Timer(); t.Tick += new EventHandler((object sender, EventArgs e) => { lock (this.RandGen)this.RandGen = new Random(Environment.TickCount); }); // with 100ms interval t.Interval = 100; t.Start(); }
public InfoViewModel() { System.Windows.Forms.Timer t = new System.Windows.Forms.Timer(); t.Interval = 500; t.Tick += new EventHandler((object o, EventArgs e) => { AvailPhysicalRam = ""; AvailVirtualRam = ""; UsedRam = ""; Temperature = ""; }); Fetching(); t.Start(); NetIndex = 0; DIMMIndex = 0; LogDriveIndex = 0; PhysDriveIndex = 0; OptDriveIndex = 0; }
public Navigator() { InitializeComponent(); curImageContainer.Visibility = Visibility.Hidden; curInfoContainer.Visibility = Visibility.Hidden; mainScatterViewItem.Width = 1920; MainCanvas.Width = 0; mainScatterViewItem.Background = Brushes.Transparent; _curZoomFactor = 1.0; DependencyPropertyDescriptor dpd = DependencyPropertyDescriptor.FromProperty(ScatterViewItem.CenterProperty, typeof(ScatterViewItem)); dpd.AddValueChanged(mainScatterViewItem, mainScatterViewItem_CenterChanged); _imageCollection = new List<ImageData>(); _timer = new System.Windows.Forms.Timer(); _timer.Interval = 5000; _timer.Start(); _artOpen = false; _collectionEmpty = true; timeline.nav = this; }
/// <summary> /// Calls a function repeatedly, with a fixed time delay between each call to that function. /// </summary> /// <param name="func">func is the function you want to be called repeatedly.</param> /// <param name="milliseconds">is the number of milliseconds (thousandths of a second) that the setInterval() function should wait before each call to func.</param> /// <returns>unique interval ID you can pass to clearInterval().</returns> public int setInterval(object func, object milliseconds) { int m = 100; int.TryParse(milliseconds.ToString(), out m); var timer = new Timer(); timer.Interval = m; timer.Tick += delegate { bool isLocked = !Monitor.TryEnter(sync); if (!isLocked) { if (func != null) ((ScriptFunction) func).Invoke(this, new object[] {}); Monitor.Exit(sync); } }; timer.Start(); //preserve link to the timer inside internal collection _timers.Add(_index, timer); return _index++; }
public RoboEntity(EZRoboNetDevice netdevice, byte avatarnodeid, Random randgen) { NetDevice = netdevice; AvatarNodeID = avatarnodeid; // assigning random generator RandGen = randgen; // initializing the timer SyncTimer = new System.Windows.Forms.Timer(); SyncTimer.Interval = 500; // 0.5 s interval SyncTimer.Tick += handleMessages; // initializing the incoming packet queue ReceivedPackets = new EZPacket[MAX_RECEIVED_PACKETS_NUM]; ReceivedPacketsNum = 0; // registering the entity to the NetDevice server EntityID = NetDevice.registerEntity(this); // starting the Timer SyncTimer.Start(); }
public SledLanguageParserService(ISettingsService settingsService) { Verbosity = SledLanguageParserVerbosity.Overall; var verboseProp = new BoundPropertyDescriptor( this, () => Verbosity, "Verbosity", null, "Verbosity level"); // Persist settings settingsService.RegisterSettings(this, verboseProp); // Add user settings settingsService.RegisterUserSettings("Language Parser", verboseProp); m_syncContext = SynchronizationContext.Current; m_batchTimer = new Timerz { Interval = TimerIntervalMsec }; m_batchTimer.Tick += BatchTimerTick; m_batchTimer.Start(); }
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)); } } }; }
void newt_Drop(object sender, DragEventArgs e) { e.Handled = true; var tabItemTarget = e.Source as CloseableTabItem; var tabItemSource = e.Data.GetData(typeof(CloseableTabItem)) as CloseableTabItem; if (tabItemSource != null) { if (!tabItemTarget.Equals(tabItemSource)) { var tabControl = tabItemTarget.Parent as TabControl; int tabState = -1; int sourceIndex = tabControl.Items.IndexOf(tabItemSource); int targetIndex = tabControl.Items.IndexOf(tabItemTarget); if (!tabItemSource.IsSelected && tabItemTarget.IsSelected) tabState = 1; else if (!tabItemSource.IsSelected && !tabItemTarget.IsSelected) tabState = 2; else tabState = 0; tabControl.Items.Remove(tabItemSource); tabControl.Items.Insert(targetIndex, tabItemSource); tabControl.Items.Remove(tabItemTarget); tabControl.Items.Insert(sourceIndex, tabItemTarget); if (tabState == 1) tabControl.SelectedIndex = sourceIndex; else if (tabState == 0) tabControl.SelectedIndex = targetIndex; } } else { System.Windows.Point pt = e.GetPosition(sender as IInputElement); //if (e.Data.GetDataPresent(DataFormats.FileDrop)) //{ if ((sender as CloseableTabItem).Path.IsFileSystemObject) { if ((e.KeyStates & DragDropKeyStates.ControlKey) == DragDropKeyStates.ControlKey) { e.Effects = DragDropEffects.Copy; if (e.Data.GetDataPresent(DataFormats.FileDrop)) { DropData PasteData = new DropData(); String[] collection = (String[])e.Data.GetData(DataFormats.FileDrop); StringCollection scol = new StringCollection(); scol.AddRange(collection); PasteData.DropList = scol; PasteData.PathForDrop = (sender as CloseableTabItem).Path.ParsingName; Thread t = null; t = new Thread(new ParameterizedThreadStart(Explorer.DoCopy)); t.SetApartmentState(ApartmentState.STA); t.Start(PasteData); } } else { //if (Path.GetPathRoot((sender as CloseableTabItem).Path.ParsingName) == // Path.GetPathRoot(Explorer.NavigationLog.CurrentLocation.ParsingName)) //{ e.Effects = DragDropEffects.Move; if (e.Data.GetDataPresent(DataFormats.FileDrop)) { DropData PasteData = new DropData(); String[] collection = (String[])e.Data.GetData(DataFormats.FileDrop); StringCollection scol = new StringCollection(); scol.AddRange(collection); PasteData.DropList = scol; PasteData.PathForDrop = (sender as CloseableTabItem).Path.ParsingName; Thread t = null; t = new Thread(new ParameterizedThreadStart(Explorer.DoMove)); t.SetApartmentState(ApartmentState.STA); t.Start(PasteData); } //} //else //{ // e.Effects = DragDropEffects.Copy; // if (e.Data.GetDataPresent(DataFormats.FileDrop)) // { // DropData PasteData = new DropData(); // String[] collection = (String[])e.Data.GetData(DataFormats.FileDrop); // StringCollection scol = new StringCollection(); // scol.AddRange(collection); // PasteData.DropList = scol; // PasteData.PathForDrop = (sender as CloseableTabItem).Path.ParsingName; // Thread t = null; // t = new Thread(new ParameterizedThreadStart(Explorer.DoCopy)); // t.SetApartmentState(ApartmentState.STA); // t.Start(PasteData); // } //} } } else { e.Effects = DragDropEffects.None; } DropTargetHelper.Drop(e.Data, pt, e.Effects); // attempt at making drag-and-drop tabs a possibility //} //else //{ // if (e.Data.GetDataPresent(typeof(CloseableTabItem))) // { // var tabItemTarget = e.Source as CloseableTabItem; // var tabItemSource = e.Data.GetData(typeof(CloseableTabItem)) as CloseableTabItem; // if (!tabItemTarget.Equals(tabItemSource)) // { // var tabControl = tabItemTarget.Parent as TabControl; // int sourceIndex = tabControl.Items.IndexOf(tabItemSource); // int targetIndex = tabControl.Items.IndexOf(tabItemTarget); // tabControl.Items.Remove(tabItemSource); // tabControl.Items.Insert(targetIndex, tabItemSource); // tabControl.Items.Remove(tabItemTarget); // tabControl.Items.Insert(targetIndex, tabItemTarget); // } // } // else // { // } //} } }
public void Stop() { _stopRequested = true; _log.Debug("Stop requested, sending logout."); _ajaxHelper.Logout(new AjaxCallback(onLogoutSucceed, onLogoutFailed)); _tmr = new Timer {Interval = 1000}; _tmr.Tick += OnTimer; _tmr.Start(); _webSock.Close(); _testMng.Cancel(); TestStaticDataMng.Unregister(_login); }
/// <summary> /// Initializes all data required for champion select. Also retrieves latest GameDTO /// </summary> private async void StartChampSelect() { //Force client to popup once in champion select Client.FocusClient(); //Get champions and sort alphabetically ChampList = new List<ChampionDTO>(Client.PlayerChampions); ChampList.Sort((x, y) => champions.GetChampion(x.ChampionId).displayName.CompareTo(champions.GetChampion(y.ChampionId).displayName)); //Retrieve masteries and runes MyMasteries = Client.LoginPacket.AllSummonerData.MasteryBook; MyRunes = Client.LoginPacket.AllSummonerData.SpellBook; //Put masteries & runes into combo boxes int i = 0; foreach (MasteryBookPageDTO MasteryPage in MyMasteries.BookPages) { string MasteryPageName = MasteryPage.Name; //Stop garbage mastery names if (MasteryPageName.StartsWith("@@")) { MasteryPageName = "Mastery Page " + ++i; } MasteryComboBox.Items.Add(MasteryPageName); if (MasteryPage.Current) MasteryComboBox.SelectedValue = MasteryPageName; } i = 0; foreach (SpellBookPageDTO RunePage in MyRunes.BookPages) { string RunePageName = RunePage.Name; //Stop garbage rune names if (RunePageName.StartsWith("@@")) { RunePageName = "Rune Page " + ++i; } RuneComboBox.Items.Add(RunePageName); if (RunePage.Current) RuneComboBox.SelectedValue = RunePageName; } //Allow runes & masteries to be changed QuickLoad = true; //Signal to the server we are in champion select await Client.PVPNet.SetClientReceivedGameMessage(Client.GameID, "CHAMP_SELECT_CLIENT"); //Retrieve the latest GameDTO GameDTO latestDTO = await Client.PVPNet.GetLatestGameTimerState(Client.GameID, Client.ChampSelectDTO.GameState, Client.ChampSelectDTO.PickTurn); //Find the game config for timers configType = Client.LoginPacket.GameTypeConfigs.Find(x => x.Id == latestDTO.GameTypeConfigId); if (configType == null) //Invalid config... abort! { Client.QuitCurrentGame(); MessageOverlay overlay = new MessageOverlay(); overlay.MessageTextBox.Text = "Invalid Config ID (" + latestDTO.GameTypeConfigId.ToString() + "). Report to Snowl [https://github.com/Snowl/LegendaryClient/issues/new]"; overlay.MessageTitle.Content = "Invalid Config"; Client.OverlayContainer.Content = overlay.Content; Client.OverlayContainer.Visibility = Visibility.Visible; return; } counter = configType.MainPickTimerDuration - 5; //Seems to be a 5 second inconsistancy with riot and what they actually provide CountdownTimer = new System.Windows.Forms.Timer(); CountdownTimer.Tick += new EventHandler(CountdownTimer_Tick); CountdownTimer.Interval = 1000; // 1 second CountdownTimer.Start(); LatestDto = latestDTO; //Get the champions for the other team to ban & sort alpabetically ChampionBanInfoDTO[] ChampsForBan = await Client.PVPNet.GetChampionsForBan(); ChampionsForBan = new List<ChampionBanInfoDTO>(ChampsForBan); ChampionsForBan.Sort((x, y) => champions.GetChampion(x.ChampionId).displayName.CompareTo(champions.GetChampion(y.ChampionId).displayName)); //Join champion select chatroom string JID = Client.GetChatroomJID(latestDTO.RoomName.Replace("@sec", ""), latestDTO.RoomPassword, false); Chatroom = Client.ConfManager.GetRoom(new jabber.JID(JID)); Chatroom.Nickname = Client.LoginPacket.AllSummonerData.Summoner.Name; Chatroom.OnRoomMessage += Chatroom_OnRoomMessage; Chatroom.OnParticipantJoin += Chatroom_OnParticipantJoin; Chatroom.Join(latestDTO.RoomPassword); //Render our champions RenderChamps(false); //Start recieving champ select ChampSelect_OnMessageReceived(this, latestDTO); Client.OnFixChampSelect += ChampSelect_OnMessageReceived; Client.PVPNet.OnMessageReceived += ChampSelect_OnMessageReceived; }
private void Initialize() { StartingLocation = new Vector(0f, 0f, 0f); fObject = new FlyingObject(Parent, ModelManager.modelBank[0].model, 7); fObject.ShaderProgram = GeneralGraphics.SimulatedLighting; var physGui = new Object(); physGui.Location = new Vector(0f, 0f, 0f); PhysicsObject obj = new PhysicsObject(); obj.Velocity = fObject.PhysicalBody.Velocity; obj.ParentObject = physGui; for (int i = 0; i < 8; ++i) { obj.ModulatePhysics(); obj.ApplyNaturalForces(); } var target = new DecimalVector((decimal)physGui.Location.X, (decimal)physGui.Location.Y, (decimal)physGui.Location.Z + 10); Camera.MoveTo(target, 60); timer = new Timer(); timer.Interval = 10; timer.Tick += AnimationStep; timer.Start(); fObject.Start(); }
public void Connect() { _comms.CommPort = SelectedPort; _comms.BaudRate = SelectedBaudRate; // Todo: check the status of this call success/failure if (!_comms.Connect()) { ConnectionState = SessionStates.Disconnected; ApmVersion = "Error"; return; } ConnectionState = SessionStates.Connecting; _connectionAttemptsTimer = new Timer(); _connectionAttemptsTimer.Tick += _connectionAttemptsTimer_Tick; _connectionAttemptsTimer.Interval = 1000; //milliseconds _connectionAttemptsTimer.Start(); }