PDA

View Full Version : Help



drummernath
08-12-2009, 12:15 PM
is their a alternative to timers because i want a progress bar and some paragraph objects to refresh every 10seconds but with timers it causes the application to crash after a while :huh

this is what needs to happen every 10 seconds...


usedspaceMB = Drive.GetUsedSpace(_SourceDrive);
usedspaceB = usedspaceMB*1024*1024
usedspaceGB = String.GetFormattedSize(usedspaceB, FMTSIZE_AUTOMATIC, true);

freespaceMB = Drive.GetFreeSpace(_SourceDrive);
freespaceB = freespaceMB*1024*1024
freespaceGB = String.GetFormattedSize(freespaceB, FMTSIZE_AUTOMATIC, true);

percentage = usedspaceB/freespaceB*100
Progress.SetCurrentPos("hdpercent", percentage);

driveinfo = Drive.GetInformation(_SourceDrive);
Paragraph.SetText("drive_info", ""..driveinfo.DisplayName.." "..driveinfo.FileSystem.."\r\nUsed: "..usedspaceGB.." | Free: "..freespaceGB.."");

--Processor Info
cpuname = Registry.GetValue(HKEY_LOCAL_MACHINE, "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0", "ProcessorNameString", true);
identifier = Registry.GetValue(HKEY_LOCAL_MACHINE, "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0", "Identifier", true);
cpuusage = CMU.GetCPUsageTotal();
Progress.SetCurrentPos("cpupercent", cpuusage);
Paragraph.SetText("cpuname", ""..cpuname.."\r\n"..identifier.."");

--Memory Info
meminfo = System.GetMemoryInfo();

freevirtualB = meminfo.AvailableVirtual*1024*1024
freevirtualmem = String.GetFormattedSize(freevirtualB, FMTSIZE_AUTOMATIC, true);
totalvirtualB = meminfo.TotalVirtual*1024*1024
totalvirtualmem = String.GetFormattedSize(totalvirtualB, FMTSIZE_AUTOMATIC, true);
freeramB = meminfo.AvailableRAM*1024*1024
freeram = String.GetFormattedSize(freeramB, FMTSIZE_AUTOMATIC, true);
totalramB = meminfo.TotalRAM*1024*1024
totalram = String.GetFormattedSize(totalvirtualB, FMTSIZE_AUTOMATIC, true);

Progress.SetCurrentPos("mempercent", meminfo.MemoryLoad);
Paragraph.SetText("meminfo", "RAM: "..freeram.." of "..totalram.."\r\nVirtual Memory: "..freevirtualmem.." of "..totalvirtualmem.."");

drummernath
08-12-2009, 05:05 PM
hey,

i am designing a pc tuneup utilitie and need some infomation in paragraph objects and some progress bars to update without the use of timers and without causing the application to crash etc..

if so could you provide a example on how to go about doing it

im a newbie to this

thanks :yes