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

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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