[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnetlib/System/Timers ElapsedEventArgs.cs,NO
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnetlib/System/Timers ElapsedEventArgs.cs,NONE,1.1 ElapsedEventHandler.cs,NONE,1.1 Makefile,NONE,1.1 Timer.cs,NONE,1.1 TimersDescriptionAttribute.cs,NONE,1.1 |
Date: |
Sat, 24 May 2003 01:16:54 -0400 |
Update of /cvsroot/dotgnu-pnet/pnetlib/System/Timers
In directory subversions:/tmp/cvs-serv3209/System/Timers
Added Files:
ElapsedEventArgs.cs ElapsedEventHandler.cs Makefile Timer.cs
TimersDescriptionAttribute.cs
Log Message:
Implement missing classes from the "System.Timers" and "System.Web"
namespaces in the "System" assembly.
--- NEW FILE ---
/*
* ElapsedEventArgs.cs - Implementation of the
* "System.Timers.ElapsedEventArgs" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.Timers
{
#if !ECMA_COMPAT
public class ElapsedEventArgs : EventArgs
{
// Internal state.
private DateTime signalTime;
// Constructor.
internal ElapsedEventArgs(DateTime signalTime)
{
this.signalTime = signalTime;
}
// Get this object's properties.
public DateTime SignalTime
{
get
{
return signalTime;
}
}
}; // class ElapsedEventArgs
#endif // !ECMA_COMPAT
}; // namespace System.Timers
--- NEW FILE ---
/*
* ElapsedEventHandler.cs - Implementation of the
* "System.Timers.ElapsedEventHandler" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.Timers
{
#if !ECMA_COMPAT
[Serializable]
public delegate void ElapsedEventHandler(Object sender, ElapsedEventArgs e);
#endif // !ECMA_COMPAT
}; // namespace System.Timers
--- NEW FILE ---
all:
(cd ..;make)
(cd ..;make phase-two)
--- NEW FILE ---
/*
* Timer.cs - Implementation of the
* "System.Timers.Timer" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.Timers
{
#if !ECMA_COMPAT
using System.Threading;
using System.ComponentModel;
// Don't use this class. Use "System.Threading.Timer" instead.
public class Timer : Component, ISupportInitialize
{
// Internal state.
private bool autoReset;
private bool enabled;
private double interval;
private ISynchronizeInvoke synchronizingObject;
private System.Threading.Timer timer;
// Constructors.
public Timer()
{
this.autoReset = true;
this.enabled = false;
this.interval = 100.0;
this.synchronizingObject = null;
}
public Timer(double interval)
: this()
{
Interval = interval;
}
// Get or set this object's properties.
public bool AutoReset
{
get
{
return autoReset;
}
set
{
autoReset = value;
}
}
public bool Enabled
{
get
{
return enabled;
}
set
{
if(enabled != value)
{
enabled = value;
if(value)
{
ActivateTimer();
}
else
{
if(timer != null)
{
timer.Dispose();
timer = null;
}
}
}
}
}
public double Interval
{
get
{
return interval;
}
set
{
if(value < 0.0)
{
throw new ArgumentException
(S._("Arg_NonNegative"));
}
interval = value;
}
}
public override ISite Site
{
get
{
return base.Site;
}
set
{
base.Site = value;
}
}
public ISynchronizeInvoke SynchronizingObject
{
get
{
return synchronizingObject;
}
set
{
synchronizingObject = value;
}
}
// Begin initialization.
public virtual void BeginInit() {}
// Close the timer.
public void Close()
{
Dispose(true);
}
// End initialization.
public virtual void EndInit() {}
// Start the timer.
public void Start()
{
Enabled = true;
}
// Stop the timer.
public void Stop()
{
Enabled = false;
}
// Event that is raised when the timer elapses.
public event ElapsedEventHandler Elapsed;
// Dispose of this timer.
protected override void Dispose(bool disposing)
{
if(timer != null)
{
timer.Dispose();
timer = null;
}
}
// Handle expiry of the timer.
private static void TimerExpired(Object state)
{
Timer timer = (Timer)state;
if(!(timer.autoReset))
{
timer.timer = null;
}
if(timer.Elapsed != null)
{
timer.Elapsed(timer, new
ElapsedEventArgs(DateTime.Now));
}
}
// Activate the timer.
private void ActivateTimer()
{
long due = (long)interval;
long period = (autoReset ? due : -1);
timer = new System.Threading.Timer
(new TimerCallback(TimerExpired), this,
due, period);
}
}; // class Timer
#endif // !ECMA_COMPAT
}; // namespace System.Timers
--- NEW FILE ---
/*
* TimersDescriptionAttribute.cs - Implementation of the
* "System.IO.TimersDescriptionAttribute" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.Timers
{
#if !ECMA_COMPAT
using System.ComponentModel;
[AttributeUsage(AttributeTargets.All)]
public class TimersDescriptionAttribute : DescriptionAttribute
{
// Constructor.
public TimersDescriptionAttribute(String description)
: base(description) {}
// Get the description.
public override String Description
{
get
{
return base.Description;
}
}
}; // class TimersDescriptionAttribute
#endif // !ECMA_COMPAT
}; // namespace System.Timers
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnetlib/System/Timers ElapsedEventArgs.cs,NONE,1.1 ElapsedEventHandler.cs,NONE,1.1 Makefile,NONE,1.1 Timer.cs,NONE,1.1 TimersDescriptionAttribute.cs,NONE,1.1,
Rhys Weatherley <address@hidden> <=
- Prev by Date:
[Dotgnu-pnet-commits] CVS: pnetlib/System/Web AspNetHostingPermission.cs,NONE,1.1 AspNetHostingPermissionAttribute.cs,NONE,1.1 AspNetHostingPermissionLevel.cs,NONE,1.1 Makefile,NONE,1.1
- Next by Date:
[Dotgnu-pnet-commits] CVS: pnetlib ChangeLog,1.917,1.918
- Previous by thread:
[Dotgnu-pnet-commits] CVS: pnetlib/System/Web AspNetHostingPermission.cs,NONE,1.1 AspNetHostingPermissionAttribute.cs,NONE,1.1 AspNetHostingPermissionLevel.cs,NONE,1.1 Makefile,NONE,1.1
- Next by thread:
[Dotgnu-pnet-commits] CVS: pnetlib ChangeLog,1.917,1.918
- Index(es):