Reminds the user of a newer version if available
and within the checking frequency.
Namespace: CleanCode.IOAssembly: CleanCode (in CleanCode.dll) Version: 1.2.3.0 (1.2.03)
public bool RemindNewerVersion(
int days,
DateTime lastChecked
)
Public Function RemindNewerVersion ( _
days As Integer, _
lastChecked As DateTime _
) As Boolean
public:
bool RemindNewerVersion(
int days,
DateTime lastChecked
)
Parameters
- days
- Type: System Int32
The frequency to check, in days. Zero indicates
to always check.
- lastChecked
- Type: System DateTime
The last checked date.
Return Value
boolean indicating whether reminder
was done or not.
Similar to
GetNewerVersion(Int32, DateTime), this checks for
the presence of a newer releasing, prompting the user if one
is available.
If you provide an associated change log file, the contents
of that file will also be displayed in the user notification,
rather than just stating generically that version x.x is available.
The file is recognized by the extension
txt with the
same base name as the executable. So if your
application was, for example,
myapp-1-0-0-1.exe then the
change log must be named
myapp-1-0-0-1.txt.
If you are using directories (e.g.
myapp-1-0-0-1)
the change log name and location will be exactly the same
(e.g.
myapp-1-0-0-1.txt) and adjacent to--not contained
within--the
myapp-1-0-0-1 directory.
Here is an example detailing the use of this method:
UpdateCheck updateCheck = new UpdateCheck(
Assembly.GetExecutingAssembly(), REPOSITORY, PROG_PATTERN);
DateTime lastUpdateCheck = Properties.Settings.Default.UpdateChecked;
if (updateCheck.RemindNewerVersion(
UPDATE_REMINDER_FREQUENCY, lastUpdateCheck))
{
Properties.Settings.Default.UpdateChecked = DateTime.Now.Date;
}
UpdateCheck updateCheck = new UpdateCheck(
Assembly.GetExecutingAssembly(), REPOSITORY, PROG_PATTERN);
DateTime lastUpdateCheck = Properties.Settings.Default.UpdateChecked;
if (updateCheck.RemindNewerVersion(
UPDATE_REMINDER_FREQUENCY, lastUpdateCheck))
{
Properties.Settings.Default.UpdateChecked = DateTime.Now.Date;
}
This sample illustrates a use case where the calling program wishes
to notify the user every 2 days, rather than every time the
application is launched. The last time checked is stored
in a user's persistent settings.