Create a digital clock with time zone application

Assignment Help Basic Computer Science
Reference no: EM13307888

Create a Digital Clock with time zone application. For this WPF application create a window, which consists of a ComboBox control (to allow time zone selection) at the top, and a Grid area underneath, which contains a Digital Clock (to display time and data). When the user select a time zone (item) in the ComboBox, the program should automatically convert and display current time and date to a new time and date in the selected time zone by calculating and updating the time differences.

To support this program, create a dependency property called Timezone. This dependency property should be associated with a callback method called OnTimezoneChanged, which will be called by WPF whenever the value of the dependency property changes. This method should recalculate new time and date using the time zone currently returned by the Timezone property. Do not use advanced controls like Calendar Control or DatePicker Control.
Program requirements:
A. The default current time and date in a time zone (preferably your local time zone) should be selected by upon startup.
B. The Digital Clock should display the current time and date in the format: HH:MM:SS AM/PM - MM/DD/YYYY
C. The time output should be displayed in a 12-hour display format. The 24-display format is optional.
D. Presents users with at least five (5) different time zone options.
Eastern Time
Central Time: EST-1 hours
Mountain Time: EST - 2 hours
Pacific: EST-3 hours
Hawaii: EST- 6 hours
----------------------------------------------------------------------------------------------
This is what I have so far for the WPF

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Threading;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WpfApplication3
{

public partial class MainWindow : Window
{
public static readonly DependencyProperty Timezone;

public DateTime ZoneProperty
{
get {return (DateTime) GetValue (Timezone);}
set { SetValue(Timezone, value); }
}

string timeFormatString = "hh:mm:ss tt - MM/dd/yyyy";
int tzOffset; // Tracks the Timezone offset in hours
DateTime currentTime; // Tracks current time
DispatcherTimer myTimer;

static MainWindow ()
{
FrameworkPropertyMetadata md = new FrameworkPropertyMetadata();
md.PropertyChangedCallback = OnTimezoneChanged;
Timezone = DependencyProperty.Register(
"Zone", typeof(DateTime), typeof(MainWindow), md);
}

public MainWindow()
{
InitializeComponent();


// Get current time in UTC
currentTime = DateTime.UtcNow;

// Get local time zone and UTC offset
TimeZone localZone = TimeZone.CurrentTimeZone;
tzOffset = localZone.GetUtcOffset(DateTime.Now).Hours;

// Initialize a timer to tick every second.
myTimer = new DispatcherTimer();
myTimer.Interval = new TimeSpan(0, 0, 1);
myTimer.Tick += new EventHandler(dispatcherTimer_Tick);
myTimer.Start();
}

private void zone_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
int zoneTime;

}
// Every timer tick (every second), update the clock.
private void dispatcherTimer_Tick(object source, EventArgs e)
{
currentTime = DateTime.UtcNow.AddHours(tzOffset);
Clock.Content = currentTime.ToString(timeFormatString);
}
static void OnTimezoneChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
{

}

}

<Window x:Class="WpfApplication3.MainWindow"
xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="750">
<StackPanel>
<ComboBox SelectionChanged="zone_SelectionChanged">
<ComboBoxItem Name="East">Eastern Daylight Time</ComboBoxItem>
<ComboBoxItem Name="Central">Central Daylight Time</ComboBoxItem>
<ComboBoxItem Name="Mountain">Mountain Daylight Time</ComboBoxItem>
<ComboBoxItem Name="Pacific">Pacific Standard Time</ComboBoxItem>
<ComboBoxItem Name="Hawaii">Hawaii Standard Time</ComboBoxItem>

</ComboBox>
<Grid>
<Label Height="76" HorizontalAlignment="Center" Name="Clock" VerticalAlignment="Top" Width="700" FontSize="50" HorizontalContentAlignment="Center" Margin="42,74,18,0" Grid.ColumnSpan="3" />
</Grid>
</StackPanel>
</Window>

 

Reference no: EM13307888

Questions Cloud

Determine how high is the image formed by the contacts : The far point of a nearsighted person is 5.1 m from her eyes, and she wears contacts that enable her to see distant objects clearly. How high is the image formed by the contacts
Explain what side effect is the expression contains : Give an example in C++ of an expression whose value depends upon the evaluation order. Show the orders that produce different values and the values they produce. Explain what side effect is the expression contains.
What is probability that two groups of students will differ : The mean score of students on an aptitude test is 72 points with a standard deviation of 8 points. What is the probability that two groups of students, consisting of 28 and 36 students respectively,
Determine the refractive power of her glasses : A woman can read the large print in a newspaper only when it is at a distance of 66 cm or more from her eyes. What should be the refractive power (in diopters) of her glasses
Create a digital clock with time zone application : Create a Digital Clock with time zone application. For this WPF application create a window, which consists of a ComboBox control (to allow time zone selection) at the top, and a Grid area underneath, which contains a Digital Clock (to display tim..
List the different roles in a buying center : Apply the buying center concept to a firm, a nonprofit organization, or a government agency you work for, or are familiar with, for the purchase of new laptop computers for their employees.
Define a class called counter : The only method that can set the counter is the one that sets it to zero. Write a program to test your class definition. (Hint: you need only one instance variable).
Write a method named maxelement : Write a method named maxElement, which returns the largest value in an array that is passed as an argument. The method should use recursion to find the largest element. Demonstrate the method in a program.
Determine the net power output of the engine : The cycle has a thermal efficiency of 35%, and steam changes from saturated vapor at 300 C during the heat addition process. If the mass flow rate of the steam is 2kg/s, determine the net power (kw) output of this engine.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Describe the data normalization process

Describe the data normalization process including its specific steps. Why is it referred to as a "decomposition process?"

  Explain applications of pervasive computing

Which of the applications of pervasive computing do you believe are probable to gain greatest market acceptance over next few years? Why?

  Sketch a normal.probability plot to check the normality

If it is a t test, sketch a normal.probability plot to check the normality of the population.6. State the null and alternative hypothesis.7. Decide on the significance level, alpha.

  Describe ease of finding information on internet

Explain main elements of assignment in the substantive way. Describe the ease of finding information on the Internet.

  Explain data by state of computer-s electrical switches

Differentiate between computer data represented by the state of computer's electrical switches and meaningful information which is displayed to user.

  Explain elements of enterprise information security policy

Write and explain briefly the three kinds of information security policy as described by NIST SP 800-14. Write and explain briefly four elements that must be present in Enterprise Information Security Policy.

  Different kinds of tasks which humans could perform by ai

Intelligence use AI to do different kinds of tasks which only humans could perform. Research Internet and explain how AI works to make bots resemble human intelligence.

  Division of the banana tree travel agency

The Surfing Shoppe lab is a division of the Banana Tree Travel Agency. The small lab has recently expanded to seven computers and is trying to design and layout their network across their two-room facility.

  Let''s try to make inheritance

Let's try to make inheritance a little less abstract and a little bit more concrete. In order to do this, we will model a simple inheritance relationship

  Explain how crc works at the data link layer

What are two reasons errors may occur at the data link layer?

  Analyze the use of gestures in ipads

Analyze the use of gestures in iPads. Address how users feel about gestures. Evaluate how users feel about the user input when it comes to filling out complicated forms on the iPad.

  Code works and does what it is suppose to do

Please make sure the code works and does what it is suppose to do. I keep getting answers on my other assignments that were copy and pasted from god knows where and had nothing to do with the assignment instructions.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd