PageRenderTime 53ms CodeModel.GetById 31ms RepoModel.GetById 0ms app.codeStats 0ms

/source2/VSIP/Cosmos.VS.Windows/InternalUC.xaml.cs

https://bitbucket.org/mvptracker/cosmos
C# | 81 lines | 66 code | 11 blank | 4 comment | 1 complexity | 8338262fbb9820ba493963942ee9cb81 MD5 | raw file
Possible License(s): BSD-2-Clause
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.ComponentModel.Design;
  6. using System.Data;
  7. using System.Linq;
  8. using System.Runtime.InteropServices;
  9. using System.Text;
  10. using System.Threading;
  11. using System.Windows;
  12. using System.Windows.Controls;
  13. using System.Windows.Data;
  14. using System.Windows.Documents;
  15. using System.Windows.Input;
  16. using System.Windows.Media;
  17. using System.Windows.Media.Imaging;
  18. using System.Windows.Navigation;
  19. using System.Windows.Shapes;
  20. using System.Windows.Threading;
  21. using Cosmos.Debug.Common;
  22. using Microsoft.VisualStudio.Shell;
  23. using Microsoft.VisualStudio.Shell.Interop;
  24. namespace Cosmos.VS.Windows {
  25. [Guid("39A8D0A0-26A3-4234-A660-0C4C8BF40FF3")]
  26. public class InternalTW : ToolWindowPane2 {
  27. public InternalTW() {
  28. Caption = "Cosmos Internal";
  29. BitmapResourceID = 301;
  30. BitmapIndex = 1;
  31. mUserControl = new InternalUC();
  32. Content = mUserControl;
  33. }
  34. }
  35. public partial class InternalUC : DebuggerUC {
  36. public InternalUC() {
  37. InitializeComponent();
  38. butnPingVSIP.Click += new RoutedEventHandler(butnPingVSIP_Click);
  39. butnPingDS.Click += new RoutedEventHandler(butnPingDS_Click);
  40. butnClearLog.Click += new RoutedEventHandler(butnClearLog_Click);
  41. }
  42. void Log(string aMsg) {
  43. Log(aMsg, false);
  44. }
  45. void Log(string aMsg, bool aLogTime) {
  46. if (aLogTime) {
  47. aMsg = DateTime.Now.ToString("HH:mm:ss") + ": " + aMsg;
  48. }
  49. lboxLog.SelectedItem = lboxLog.Items.Add(aMsg);
  50. }
  51. void butnClearLog_Click(object sender, RoutedEventArgs e) {
  52. lboxLog.Items.Clear();
  53. }
  54. void butnPingDS_Click(object sender, RoutedEventArgs e) {
  55. Global.PipeUp.SendCommand(Windows2Debugger.PingDebugStub);
  56. }
  57. void butnPingVSIP_Click(object sender, RoutedEventArgs e) {
  58. MessageBox.Show("This only works if there is an active debug session, see comment in code for this event for more details.");
  59. // Note: This will only work if the debugger is active,
  60. // ie Cosmos is booted. This is because the receiving
  61. // pipe is currently part of AD7Process which has a lifespan
  62. // tied to an active debug session.
  63. Global.PipeUp.SendCommand(Windows2Debugger.PingVSIP);
  64. }
  65. protected override void DoUpdate(string aTag) {
  66. string xText = Encoding.UTF8.GetString(mData);
  67. Log(xText, true);
  68. }
  69. }
  70. }