忱 沈 2 years ago
committed by sc
parent
commit
8530d3d750
  1. 1
      EX/Exchange.xaml
  2. 2
      MainWindow.xaml.cs
  3. 37
      ViewModel/ExchangeViewModel.cs
  4. 9
      ViewModel/ViewModelLocator.cs
  5. 1
      formula_manage.csproj

1
EX/Exchange.xaml

@ -5,6 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:formula_manage.EX" xmlns:local="clr-namespace:formula_manage.EX"
mc:Ignorable="d" mc:Ignorable="d"
DataContext="{Binding Source={StaticResource Locator}, Path=Exchange}"
Title="Exchange" Height="720" Width="1280" MinHeight="720" MinWidth="1280" Background="#FFE0E0E0"> Title="Exchange" Height="720" Width="1280" MinHeight="720" MinWidth="1280" Background="#FFE0E0E0">
<Grid> <Grid>
<DataGrid x:Name="gridLog" Margin="5,5,0,5" HorizontalAlignment="Left" Width="245" HeadersVisibility ="Column" Background="White" BorderBrush="White" <DataGrid x:Name="gridLog" Margin="5,5,0,5" HorizontalAlignment="Left" Width="245" HeadersVisibility ="Column" Background="White" BorderBrush="White"

2
MainWindow.xaml.cs

@ -434,8 +434,6 @@ namespace formula_manage
exchange.ShowDialog(); exchange.ShowDialog();
} }
private void print(object sender, RoutedEventArgs e) private void print(object sender, RoutedEventArgs e)
{ {
Print.IsEnabled = false; Print.IsEnabled = false;

37
ViewModel/ExchangeViewModel.cs

@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Threading;
namespace formula_manage.ViewModel
{
public class ExchangeViewModel : ViewModelBase
{
public ExchangeViewModel()
{
CountDown();
}
public void CountDown()
{
DispatcherTimer timer = new DispatcherTimer//初始化循环,每0.5秒调用一次Tick_Event
{
Interval = TimeSpan.FromSeconds(0.5)
};
timer.Tick += Tick_Event;
timer.Start();
//设置定时器
// disTimer.Tick += new EventHandler(DisTimer_Tick);//每一秒执行的方法
// disTimer.Interval = new TimeSpan(10000000); //时间间隔为一秒。
// disTimer.Start();//计时开始
}
void Tick_Event(object sender, EventArgs e)//Tick_Event周期执行事件
{
}
}
}

9
ViewModel/ViewModelLocator.cs

@ -28,6 +28,7 @@ namespace formula_manage.ViewModel
SimpleIoc.Default.Register<MainWindowViewModel>(); SimpleIoc.Default.Register<MainWindowViewModel>();
SimpleIoc.Default.Register<RECIPEViewModel>(); SimpleIoc.Default.Register<RECIPEViewModel>();
SimpleIoc.Default.Register<ExchangeViewModel>();
} }
public MainWindowViewModel Main public MainWindowViewModel Main
@ -46,5 +47,13 @@ namespace formula_manage.ViewModel
} }
} }
public ExchangeViewModel Exchange
{
get
{
return ServiceLocator.Current.GetInstance<ExchangeViewModel>();
}
}
} }
} }

1
formula_manage.csproj

@ -271,6 +271,7 @@
<Compile Include="UserClass\PrintHelper.cs" /> <Compile Include="UserClass\PrintHelper.cs" />
<Compile Include="UserClass\StrToInt.cs" /> <Compile Include="UserClass\StrToInt.cs" />
<Compile Include="UserClass\UserPrint.cs" /> <Compile Include="UserClass\UserPrint.cs" />
<Compile Include="ViewModel\ExchangeViewModel.cs" />
<Compile Include="ViewModel\RECIPEViewModel.cs" /> <Compile Include="ViewModel\RECIPEViewModel.cs" />
<Compile Include="ViewModel\MainWindowViewModel.cs" /> <Compile Include="ViewModel\MainWindowViewModel.cs" />
<Compile Include="ViewModel\ViewModelLocator.cs" /> <Compile Include="ViewModel\ViewModelLocator.cs" />

Loading…
Cancel
Save