"J. Buelna - Houston, TX" <jbuelna-(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>
> "J. Buelna - Houston, TX" <jbuelna-(E-Mail Removed)> wrote in
> message news:e%(E-Mail Removed)...
>>
>> "cashdeskmac" <(E-Mail Removed)> wrote in message
>> news:9B697FF2-BBB0-41CD-9741-(E-Mail Removed)...
>>>I want to detect when the users computer is going to close down so that I
>>>can
>>> write all unfinished data to a file before closing down. Does anyone
>>> know
>>> how this is done?
>>
>>
>> Hello cashdeskmac,
>>
>> Here's how I've done it in the past.
>>
>> Create a class with a static constructor that will hold a Check.IsSaved
>> property:
>>
>> public Check
>> {
>> static Check() {}
>>
>> private string _isSaved = "";
>> public bool IsSaved
>> {
>> set { _isSaved = value; }
>> get { return _isSaved; }
>> }
>> // other static check values...
>> }
>>
>> Whenever data has changed, change the IsSaved property to false.
>> Whenever a file is saved, change the IsSaved status to true.
>> Finally, check the IsSaved property when the application is about to
>> close and take the appropriate action/inaction.
>>
>> Handlers on component and application events will make this a snap.
>>
>> J. Buelna - Houston, TX
>>
>
>
> I initially intended to make a string property called Check.SaveStatus,
> but instead went with a bool and forgot to change the type of the private
> field. It should be:
>
> private bool _isSaved = "";
>
> J. Buelna - Houston, TX
>
>
Der!!!!!!!!!!!!!!
private bool _isSaved = true; // assume that when the class is
initialized, no data has been entered.
J. Buelna - Houston, TX
|