I want to show Components in a tabs , so first of all create few components. In this project we have three components, First View Component public class AllViewComponent : ViewComponent { private readonly UserManager<ApplicationUser> _userManager; public AllViewComponent(UserManager<ApplicationUser> userManager) { _userManager = userManager; } public async Task<IViewComponentResult> InvokeAsync() { List<StudentViewModel> allUsers = new List<StudentViewModel>(); var items = await _userManager.Users.ToListAsync(); foreach (var item in items) { allUsers.Add(new StudentViewModel {Id=item.Id, EnrollmentNo = item.EnrollmentNo, FatherName = item.FatherName, Name = item.Name, Age = item.Age, Birthdate = item.Birthdate, Address = item.Address, Gender = item.Gender, Email = item.Email }); }
Introduction
First of all, I would like to thank all of the readers who have read my previous articles. What a great support i have got from you people.I really felt great when binding navigator article was displayed on the dotprogramming page. Today we will learn, How to create Shutdown timer in c#Design pattern
Step-1 : Add One timer control onto the winform. Also set two propertyEnabled =True;
Interval=1000
Step-2 : Add Two NumericUpDown control onto the form.
Code Pattern
Step-1 : Handle Timer_Tick Event . Copy this code and paste into your Timer_Tick event.int a = DateTime.Now.Minute;
int b = DateTime.Now.Hour;
int c = Convert.ToInt32 (numericUpDown1.Value);
int d = Convert.ToInt32(numericUpDown2.Value);
if (a == d && b == c)
{
Process.Start("shutdown", "/s /t 0");
}
Note : Add System.Diagnostics namespace for Process class. Here DateTime class use 24 hour time , i want to tell you that your system watch display 8:20 PM.
Here DateTime Class represents Hour and minute. look like
8 pm (System watch) = 20 (According to DateTime class)
Code generate the following output
Comments
Post a Comment