55 lines
1.4 KiB
C#
55 lines
1.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.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;
|
|
using System.Windows.Threading;
|
|
|
|
namespace charger_gui
|
|
{
|
|
/// <summary>
|
|
/// Логика взаимодействия для MainWindow.xaml
|
|
/// </summary>
|
|
public partial class MainWindow : Window
|
|
{
|
|
private UpdateWorker worker;
|
|
private DispatcherTimer updateTimer;
|
|
MainWindowViewModel model;
|
|
|
|
public MainWindow()
|
|
{
|
|
InitializeComponent();
|
|
model = new MainWindowViewModel();
|
|
DataContext = model;
|
|
worker = new UpdateWorker(model);
|
|
updateTimer = new DispatcherTimer();
|
|
updateTimer.Tick += OnTimer;
|
|
updateTimer.Interval = TimeSpan.FromMilliseconds(50);
|
|
updateTimer.Start();
|
|
}
|
|
|
|
private void OnTimer(object sender, EventArgs e)
|
|
{
|
|
model.OnPropertyChanged("IAcc");
|
|
model.OnPropertyChanged("UAcc");
|
|
model.OnPropertyChanged("ILamp");
|
|
model.OnPropertyChanged("ULamp");
|
|
model.OnPropertyChanged("ConnectionStatus");
|
|
}
|
|
|
|
private void Ports_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
{
|
|
worker.SetPort(Ports.SelectedItem.ToString());
|
|
}
|
|
}
|
|
}
|