From 28fa043b3228d1426a83531802d25db8b3e656c4 Mon Sep 17 00:00:00 2001 From: David Sparer Date: Tue, 20 Sep 2016 10:35:20 -0600 Subject: [PATCH] Added support to the SessionChangedEventArgs to allow providing which session changed --- .../Putty/AbstractPuttySessionsProvider.cs | 18 +++++++----------- .../Config/Putty/SessionChangedEventArgs.cs | 7 +++++++ 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/mRemoteV1/Config/Putty/AbstractPuttySessionsProvider.cs b/mRemoteV1/Config/Putty/AbstractPuttySessionsProvider.cs index 416157092..d4cb19ea8 100644 --- a/mRemoteV1/Config/Putty/AbstractPuttySessionsProvider.cs +++ b/mRemoteV1/Config/Putty/AbstractPuttySessionsProvider.cs @@ -14,7 +14,7 @@ namespace mRemoteNG.Config.Putty #region Public Methods public abstract string[] GetSessionNames(bool raw = false); public abstract PuttySessionInfo GetSession(string sessionName); - + public virtual IEnumerable GetSessions() { foreach (var sessionName in GetSessionNames(true)) @@ -26,22 +26,18 @@ namespace mRemoteNG.Config.Putty } return RootInfo.Children.OfType(); } - + public virtual void StartWatcher() { } - + public virtual void StopWatcher() { } #endregion - - #region Public Events + public delegate void SessionChangedEventHandler(object sender, SessionChangedEventArgs e); public event SessionChangedEventHandler SessionChanged; - #endregion - - #region Protected Methods - protected virtual void RaiseSessionChangedEvent(SessionChangedEventArgs e) + + protected virtual void RaiseSessionChangedEvent(SessionChangedEventArgs args) { - SessionChanged?.Invoke(this, new SessionChangedEventArgs()); + SessionChanged?.Invoke(this, args); } - #endregion } } \ No newline at end of file diff --git a/mRemoteV1/Config/Putty/SessionChangedEventArgs.cs b/mRemoteV1/Config/Putty/SessionChangedEventArgs.cs index cbccee048..31270e3c6 100644 --- a/mRemoteV1/Config/Putty/SessionChangedEventArgs.cs +++ b/mRemoteV1/Config/Putty/SessionChangedEventArgs.cs @@ -1,9 +1,16 @@ using System; +using mRemoteNG.Connection; namespace mRemoteNG.Config.Putty { public class SessionChangedEventArgs : EventArgs { + public PuttySessionInfo Session { get; set; } + + public SessionChangedEventArgs(PuttySessionInfo sessionChanged = null) + { + Session = sessionChanged; + } } } \ No newline at end of file