示例#1
0
        public MainWindow()
        {
            InitializeComponent();
            _init = true;
            Model = new ClockModel();


            this.DataContext = Model;


            Model.TimeZoneInfos = new ObservableCollection <TimeZoneInfo>(TimeZoneInfo.GetSystemTimeZones().ToList());

            //            clock1
            tZId1.ItemsSource       = Model.TimeZoneInfos;
            tZId1.DisplayMemberPath = "Id";
            tZId1.SelectedValuePath = "Id";
            tZId1.SelectedValue     = Model.Clock1?.TzId;


            //            clock2
            tZId2.ItemsSource       = Model.TimeZoneInfos;
            tZId2.DisplayMemberPath = "Id";
            tZId2.SelectedValuePath = "Id";
            tZId2.SelectedValue     = Model.Clock2?.TzId;

            //            clock3
            tZId3.ItemsSource       = Model.TimeZoneInfos;
            tZId3.DisplayMemberPath = "Id";
            tZId3.SelectedValuePath = "Id";
            tZId3.SelectedValue     = Model.Clock3?.TzId;

            //            clock4
            tZId4.ItemsSource       = Model.TimeZoneInfos;
            tZId4.DisplayMemberPath = "Id";
            tZId4.SelectedValuePath = "Id";
            tZId4.SelectedValue     = Model.Clock4?.TzId;

            //            clock5
            tZId5.ItemsSource       = Model.TimeZoneInfos;
            tZId5.DisplayMemberPath = "Id";
            tZId5.SelectedValuePath = "Id";
            tZId5.SelectedValue     = Model.Clock5?.TzId;

            //            clock6
            tZId6.ItemsSource       = Model.TimeZoneInfos;
            tZId6.DisplayMemberPath = "Id";
            tZId6.SelectedValuePath = "Id";
            tZId6.SelectedValue     = Model.Clock6?.TzId;

            //            clock7
            tZId7.ItemsSource       = Model.TimeZoneInfos;
            tZId7.DisplayMemberPath = "Id";
            tZId7.SelectedValuePath = "Id";
            tZId7.SelectedValue     = Model.Clock7?.TzId;

            //            clock8
            tZId8.ItemsSource       = Model.TimeZoneInfos;
            tZId8.DisplayMemberPath = "Id";
            tZId8.SelectedValuePath = "Id";
            tZId8.SelectedValue     = Model.Clock8?.TzId;

            //            clock9
            tZId9.ItemsSource       = Model.TimeZoneInfos;
            tZId9.DisplayMemberPath = "Id";
            tZId9.SelectedValuePath = "Id";
            tZId9.SelectedValue     = Model.Clock9?.TzId;

            Model.OnRefTimeUpdated += RefTimeChanged;


            DispatcherTimer timer = new DispatcherTimer();

            timer.Interval = TimeSpan.FromSeconds(1);
            timer.Tick    += timer_Tick;
            timer.Start();
            _init = false;
        }
示例#2
0
        public MainWindow()
        {
            InitializeComponent();
            _init = true;
            Model = new ClockModel();

            this.DataContext = Model;

            Model.TimeZoneInfos = new ObservableCollection<TimeZoneInfo>( TimeZoneInfo.GetSystemTimeZones().ToList());

            //            clock1
            tZId1.ItemsSource = Model.TimeZoneInfos;
            tZId1.DisplayMemberPath = "Id";
            tZId1.SelectedValuePath = "Id";
            tZId1.SelectedValue = Model.Clock1?.TzId;

            //            clock2
            tZId2.ItemsSource = Model.TimeZoneInfos;
            tZId2.DisplayMemberPath = "Id";
            tZId2.SelectedValuePath = "Id";
            tZId2.SelectedValue = Model.Clock2?.TzId;

            //            clock3
            tZId3.ItemsSource = Model.TimeZoneInfos;
            tZId3.DisplayMemberPath = "Id";
            tZId3.SelectedValuePath = "Id";
            tZId3.SelectedValue = Model.Clock3?.TzId;

            //            clock4
            tZId4.ItemsSource = Model.TimeZoneInfos;
            tZId4.DisplayMemberPath = "Id";
            tZId4.SelectedValuePath = "Id";
            tZId4.SelectedValue = Model.Clock4?.TzId;

            //            clock5
            tZId5.ItemsSource = Model.TimeZoneInfos;
            tZId5.DisplayMemberPath = "Id";
            tZId5.SelectedValuePath = "Id";
            tZId5.SelectedValue = Model.Clock5?.TzId;

            //            clock6
            tZId6.ItemsSource = Model.TimeZoneInfos;
            tZId6.DisplayMemberPath = "Id";
            tZId6.SelectedValuePath = "Id";
            tZId6.SelectedValue = Model.Clock6?.TzId;

            //            clock7
            tZId7.ItemsSource = Model.TimeZoneInfos;
            tZId7.DisplayMemberPath = "Id";
            tZId7.SelectedValuePath = "Id";
            tZId7.SelectedValue = Model.Clock7?.TzId;

            //            clock8
            tZId8.ItemsSource = Model.TimeZoneInfos;
            tZId8.DisplayMemberPath = "Id";
            tZId8.SelectedValuePath = "Id";
            tZId8.SelectedValue = Model.Clock8?.TzId;

            //            clock9
            tZId9.ItemsSource = Model.TimeZoneInfos;
            tZId9.DisplayMemberPath = "Id";
            tZId9.SelectedValuePath = "Id";
            tZId9.SelectedValue = Model.Clock9?.TzId;

            Model.OnRefTimeUpdated += RefTimeChanged;

            DispatcherTimer timer = new DispatcherTimer();
            timer.Interval = TimeSpan.FromSeconds(1);
            timer.Tick += timer_Tick;
            timer.Start();
            _init = false;
        }