میخوام سر ساعت مشخصی در روز یک تابع رو اجرا کنم
استفاده از تایمر بنظرم اشتباه هست چون نه دقت مورد نظررو داره و هم بارگذاری نامطلوبی انجام میده!
راه دیگه ای هست؟
میخوام سر ساعت مشخصی در روز یک تابع رو اجرا کنم
استفاده از تایمر بنظرم اشتباه هست چون نه دقت مورد نظررو داره و هم بارگذاری نامطلوبی انجام میده!
راه دیگه ای هست؟
Task Scheduler Library For .NET
http://www.codeproject.com/csharp/ta...lerlibrary.asp
از طریق فرمان AT هم می تونی این کار رو انجام بدی..
سلام
میشه در مورد AT Command بیشتر توضیح بدید؟
ممنون
The AT command schedules commands and programs to run on a computer at
a specified time and date. The Schedule service must be running to use
the AT command.
AT [\\computername] [ [id] [/DELETE] | /DELETE [/YES]]
AT [\\computername] time [/INTERACTIVE]
[ /EVERY:date[,...] | /NEXT:date[,...]] "command"
\\computername Specifies a remote computer. Commands are scheduled on the
local computer if this parameter is omitted.
id Is an identification number assigned to a scheduled
command.
/delete Cancels a scheduled command. If id is omitted, all the
scheduled commands on the computer are canceled.
/yes Used with cancel all jobs command when no further
confirmation is desired.
time Specifies the time when command is to run.
/interactive Allows the job to interact with the desktop of the user
who is logged on at the time the job runs.
/every:date[,...] Runs the command on each specified day(s) of the week or
month. If date is omitted, the current day of the month
is assumed.
/next:date[,...] Runs the specified command on the next occurrence of the
day (for example, next Thursday). If date is omitted, the
current day of the month is assumed.
"command" Is the Windows NT command, or batch program to be run.
میشه از TimerCallBack استفاده کرد
قفل مخفی تلگرام، واتس اپ و همه برنامه ها - قفل حرفه ای برای دستگاه اندرویدی شما - با امکان مخفی شدن و جلوگیری از Unisntall شدن
--آموزش ایجاد برنامه های چند زبانه در WPF
-BeRMOoDA File Encrypter-open source-using WPF, C# and MVVM Pattern
-نمونه برنامه ساده و کامل با الگوی MVVM برای کار با دیتابیس با استفاده از Entity Framework در WPF
-WPFMessageBox فارسی/انگلیسی - با قابلیت تغییر Skin
می شه کامل توضیح بدین مثلا در یک ساعت مشخص در روز که کاربر مشخص می کنه از یک سری از فایلها که کاربر مشخص می کنه برای مثلا یک ماه Backup گرفته بشهنوشته شده توسط bermooda
چطوری از TimerCallBack استفاده کنیم
برنامه من ساده تر از اینه که با Task Scheduler انجام بدم!
یک برنامه هست که همیشه up هست (مثلا بصورت دستی اجرا میکنیم) و فقط میخوام ساعت 10 صبح یه کاری انجام بده. همین.
روش ساده تری برای این هست؟
به نظر من اگه برنامت کوچیکه از Thread.Sleep استفاده کن. یعنی اول اون تکه کد رو توی یه Thread بزار بعد تا زمان موعود، Sleepش کن.
منظورت چیه تا زمان موعود؟ مشکل اون زمان موعود هستش!
مگه اینکه بشه گفت تا ساعت 10 صبح sleep باش!
میشه؟
long remaining;
remaining = DateTime.Parse("10:00").Ticks - DateTime.Now.Ticks;
if(remaining < 0)
remaining = DateTime.Parse("10:00").AddDays(1).Ticks - DateTime.Now.Ticks;
System.Threading.Thread.Sleep(remaining);