I\'m having difficulty figuring this out. I\'m fairly new to programming and am
ID: 3533346 • Letter: I
Question
I'm having difficulty figuring this out. I'm fairly new to programming and am struggling a bit with understanding.
Create a Digital Clock with time zone application.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
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.
Explanation / Answer
namespace WpfApplication2 { /// <summary> /// Interaction logic for TimeZoneDemo.xaml /// </summary> public partial class TimeZoneDemo : Window { private ObservableCollection<TimeZone> timeZones; public TimeZoneDemo() { InitializeComponent(); timeZones = new ObservableCollection<TimeZone>(); ReadOnlyCollection<TimeZoneInfo> tzCollection = TimeZoneInfo.GetSystemTimeZones(); foreach (TimeZoneInfo tz in tzCollection) { timeZones.Add(new TimeZone() { TimeZoneId = tz.Id.ToString(), Title = tz.DisplayName }); } cmbTimeZone.ItemsSource = timeZones; txtDate.Text = DateTime.Now.ToString("D", CultureInfo.GetCultureInfo("en-US"));//ru-RU } private void cmbTimeZone_SelectionChanged(object sender, SelectionChangedEventArgs e) { } } public class TimeZone { public string TimeZoneId { get; set; } public string Title { get; set; } } }
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.