void ShowListenDialog (RemoteDebuggerStartInfo dsi)
		{
			string message = GetListenMessage (dsi);
			
			Gtk.Application.Invoke (delegate {
				if (VirtualMachine != null || Exited)
					return;
				
				dialog = new Gtk.Dialog () {
					Title = "Waiting for debugger"
				};
				
				var label = new Gtk.Alignment (0.5f, 0.5f, 1f, 1f) {
					Child = new Gtk.Label (message),
					BorderWidth = 12
				};
				dialog.VBox.PackStart (label);
				label.ShowAll ();	
				
				dialog.AddButton ("Cancel", Gtk.ResponseType.Cancel);
				
				int response = MonoDevelop.Ide.MessageService.ShowCustomDialog (dialog);
				
				if (response != (int) Gtk.ResponseType.Ok) {
					EndSession ();
				}
				dialog = null;
			});
		}
        void ShowListenDialog(RemoteDebuggerStartInfo dsi)
        {
            string message = GetListenMessage(dsi);

            Gtk.Application.Invoke(delegate {
                if (VirtualMachine != null || Exited)
                {
                    return;
                }

                dialog = new Gtk.Dialog()
                {
                    Title = "Waiting for debugger"
                };

                var label = new Gtk.Alignment(0.5f, 0.5f, 1f, 1f)
                {
                    Child       = new Gtk.Label(message),
                    BorderWidth = 12
                };
                dialog.VBox.PackStart(label);
                label.ShowAll();

                dialog.AddButton("Cancel", Gtk.ResponseType.Cancel);

                int response = MonoDevelop.Ide.MessageService.ShowCustomDialog(dialog);

                if (response != (int)Gtk.ResponseType.Ok)
                {
                    EndSession();
                }
                dialog = null;
            });
        }
		/// <summary>Starts the debugger listening for a connection over TCP/IP</summary>
		protected void StartListening (RemoteDebuggerStartInfo dsi)
		{
			appName = dsi.AppName;
			RegisterUserAssemblies (dsi.UserAssemblyNames);
			
			IPEndPoint dbgEP = new IPEndPoint (dsi.Address, dsi.DebugPort);
			IPEndPoint conEP = dsi.RedirectOutput? new IPEndPoint (dsi.Address, dsi.OutputPort) : null;
			
			if (!String.IsNullOrEmpty (dsi.LogMessage))
				LogWriter (false, dsi.LogMessage + "\n");
			
			OnConnecting (VirtualMachineManager.BeginListen (dbgEP, conEP, HandleCallbackErrors (ListenCallback)));
			ShowListenDialog (dsi);
		}
        /// <summary>Starts the debugger listening for a connection over TCP/IP</summary>
        protected void StartListening(RemoteDebuggerStartInfo dsi)
        {
            appName = dsi.AppName;
            RegisterUserAssemblies(dsi.UserAssemblyNames);

            IPEndPoint dbgEP = new IPEndPoint(dsi.Address, dsi.DebugPort);
            IPEndPoint conEP = dsi.RedirectOutput? new IPEndPoint(dsi.Address, dsi.OutputPort) : null;

            if (!String.IsNullOrEmpty(dsi.LogMessage))
            {
                LogWriter(false, dsi.LogMessage + "\n");
            }

            OnConnecting(VirtualMachineManager.BeginListen(dbgEP, conEP, HandleCallbackErrors(ListenCallback)));
            ShowListenDialog(dsi);
        }
		protected override string GetListenMessage (RemoteDebuggerStartInfo dsi)
		{
			return string.Format ("Waiting for debugger to connect on {0}:{1}...", dsi.Address, dsi.DebugPort);
		}
 protected virtual string GetListenMessage(RemoteDebuggerStartInfo dsi)
 {
     return(GettextCatalog.GetString("Waiting for debugger to connect..."));
 }
        void PreConnectionInit(RemoteDebuggerStartInfo dsi, out IPEndPoint dbgEP, out IPEndPoint conEP)
        {
            if (appName != null)
                throw new InvalidOperationException ("Cannot initialize connection more than once");

            appName = dsi.AppName;
            RegisterUserAssemblies (dsi.UserAssemblyNames);

            dbgEP = new IPEndPoint (dsi.Address, dsi.DebugPort);
            conEP = dsi.RedirectOutput? new IPEndPoint (dsi.Address, dsi.OutputPort) : null;

            if (!String.IsNullOrEmpty (dsi.LogMessage))
                LogWriter (false, dsi.LogMessage + "\n");
        }
        /// <summary>Starts the debugger listening for a connection over TCP/IP</summary>
        protected void StartListening(RemoteDebuggerStartInfo dsi)
        {
            IPEndPoint dbgEP, conEP;
            PreConnectionInit (dsi, out dbgEP, out conEP);

            var callback = HandleConnectionCallbackErrors (ListenCallback);
            OnConnecting (VirtualMachineManager.BeginListen (dbgEP, conEP, callback));
            ShowConnectingDialog (dsi);
        }
        /// <summary>Starts the debugger connecting to a remote IP</summary>
        protected void StartConnecting(RemoteDebuggerStartInfo dsi, int maxAttempts, int timeBetweenAttempts)
        {
            if (timeBetweenAttempts < 0 || timeBetweenAttempts > 10000)
                throw new ArgumentException ("timeBetweenAttempts");

            IPEndPoint dbgEP, conEP;
            PreConnectionInit (dsi, out dbgEP, out conEP);

            var callback = HandleConnectionCallbackErrors (ConnectCallback);

            retryConnection = () => {
                if (maxAttempts == 1 || Exited) {
                    return false;
                }
                if (maxAttempts > 1)
                    maxAttempts--;
                try {
                    if (timeBetweenAttempts > 0)
                        System.Threading.Thread.Sleep (timeBetweenAttempts);

                    OnConnecting (VirtualMachineManager.BeginConnect (dbgEP, conEP, callback));
                } catch (Exception ex2) {
                    retryConnection = null;
                    OnConnectionError (ex2);
                    return false;
                }
                return true;
            };

            ShowConnectingDialog (dsi);

            OnConnecting (VirtualMachineManager.BeginConnect (dbgEP, conEP, callback));
        }
 //[Obsolete]
 protected virtual string GetListenMessage(RemoteDebuggerStartInfo dsi)
 {
     return GettextCatalog.GetString ("Waiting for debugger to connect...");
 }
 protected virtual string GetConnectingMessage(RemoteDebuggerStartInfo dsi)
 {
     //ignore the Obsolete warning
     #pragma warning disable 0612
     return GetListenMessage (dsi);
     #pragma warning restore 0612
 }
		protected virtual string GetListenMessage (RemoteDebuggerStartInfo dsi)
		{
			return DefaultListenMessage;
		}