listener: add Dispose method
This commit is contained in:
parent
b73bb1215a
commit
496c4662a2
|
@ -95,7 +95,6 @@ namespace SparkleLib {
|
|||
public abstract void Connect ();
|
||||
public abstract void Announce (SparkleAnnouncement announcent);
|
||||
public abstract void AlsoListenTo (string folder_identifier);
|
||||
public abstract void Dispose ();
|
||||
public abstract bool IsConnected { get; }
|
||||
|
||||
|
||||
|
@ -104,11 +103,11 @@ namespace SparkleLib {
|
|||
protected List<SparkleAnnouncement> queue_down = new List<SparkleAnnouncement> ();
|
||||
protected bool is_connecting;
|
||||
protected string server;
|
||||
protected Timer reconnect_timer = new Timer { Interval = 60 * 1000};
|
||||
protected Timer reconnect_timer = new Timer { Interval = 60 * 1000, Enabled = true };
|
||||
|
||||
public SparkleListenerBase (string server, string folder_identifier, NotificationServerType type) {
|
||||
this.reconnect_timer.Elapsed += delegate {
|
||||
if (!IsConnected && !IsConnecting)
|
||||
if (!IsConnected && !this.is_connecting)
|
||||
Reconnect ();
|
||||
};
|
||||
|
||||
|
@ -185,6 +184,12 @@ namespace SparkleLib {
|
|||
}
|
||||
|
||||
|
||||
public virtual void Dispose ()
|
||||
{
|
||||
this.reconnect_timer.Dispose ();
|
||||
}
|
||||
|
||||
|
||||
public string Server {
|
||||
get {
|
||||
return this.server;
|
||||
|
|
|
@ -137,6 +137,7 @@ namespace SparkleLib {
|
|||
{
|
||||
this.thread.Abort ();
|
||||
this.thread.Join ();
|
||||
base.Dispose ();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ namespace SparkleShare {
|
|||
|
||||
Font = NSFontManager.SharedFontManager.FontWithFamily
|
||||
("Lucida Grande", NSFontTraitMask.Condensed, 0, 13);
|
||||
|
||||
|
||||
OpenLogs = new List <SparkleLog> ();
|
||||
StatusIcon = new SparkleStatusIcon ();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue