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 }); }
In this article, i will use DispatcherTimer class for creating timer control. Using interval property of this class, i will set the increment counter. After set the interval you can call tick event of this class. On tick event you can take current date and time. .
To create a new app in windows phone 8, the steps are listed below:
Create a new project by going through File | New Project | Windows Phone Application - Visual C#. Give a desired project name( World Clock is my app name).
From Solution Explorer, open MainPage.xaml file. (If Solution Explorer window is currently not opened then open it via View>>Other Windows>>Solution Explorer).
Inside Control Panel code fragment, add following code to create world clock app.
Source code (MainPage.xaml)
<TextBlock HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="436" Height="63" x:Name="label1" FontSize="30" Grid.ColumnSpan="2"/>
Code behind
DispatcherTimer t1 = new DispatcherTimer();
t1.Interval = TimeSpan.FromSeconds(1);
t1.Tick += OnTick;
t1.Start();
void OnTick(Object sender, EventArgs args)
{
label1.Text = DateTime.Now.ToString();
}
Comments
Post a Comment