private void run() { var stringToType = keysBox.Text; int delay; int subsequentDelay; if (!Int32.TryParse(delayBox.Text, out delay)) { delay = 0; } if (!Int32.TryParse(subsequentDelayBox.Text, out subsequentDelay)) { subsequentDelay = delay; } Task.Run(async() => { bool firstRun = true; foreach (var character in stringToType) { runButton.Dispatcher.BeginInvoke((Action)(() => { VisualStudioModule.ExecuteCommand("Type", character.ToString()); })); if (firstRun && delay > 0) { await Task.Delay(delay); firstRun = false; } else if (!firstRun && subsequentDelay > 0) { await Task.Delay(subsequentDelay); } } }); }
private void TextView_GotAggregateFocus(object sender, System.EventArgs e) { VisualStudioModule.SetTextView((IWpfTextView)sender); }
/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { ControlWindowCommand.Initialize(this); base.Initialize(); VisualStudioModule.Initialize((DTE)GetService(typeof(DTE))); }