82 lines
2.4 KiB
C#
82 lines
2.4 KiB
C#
|
using AnQing.Commons;
|
|||
|
using AnQing.View;
|
|||
|
using AnQing.ViewModel;
|
|||
|
using MvCamCtrl.NET;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
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 AnQing
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// MainWindow.xaml 的交互逻辑
|
|||
|
/// </summary>
|
|||
|
public partial class MainWindow : Window
|
|||
|
{
|
|||
|
public MianWindowViewModel mianWindowViewModel;
|
|||
|
public MainWindow()
|
|||
|
{
|
|||
|
InitializeComponent();
|
|||
|
mianWindowViewModel = new MianWindowViewModel();
|
|||
|
this.DataContext = mianWindowViewModel;
|
|||
|
Common.EnsureFolderExists("ImageList");
|
|||
|
}
|
|||
|
|
|||
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
|||
|
{
|
|||
|
Common.main = this;
|
|||
|
}
|
|||
|
|
|||
|
private void Button_Click(object sender, RoutedEventArgs e)
|
|||
|
{
|
|||
|
if (Common.historycontrol == null)
|
|||
|
Common.historycontrol = new History();
|
|||
|
|
|||
|
MenuView.Children.Add(Common.historycontrol);
|
|||
|
MenuView.Visibility = Visibility.Visible;
|
|||
|
}
|
|||
|
|
|||
|
private void Button_Click_1(object sender, RoutedEventArgs e)
|
|||
|
{
|
|||
|
if (Common.setupview == null)
|
|||
|
Common.setupview = new SetUpView();
|
|||
|
|
|||
|
MenuView.Children.Add(Common.setupview);
|
|||
|
MenuView.Visibility = Visibility.Visible;
|
|||
|
}
|
|||
|
|
|||
|
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
|||
|
{
|
|||
|
// 如果是重复运行导致的关闭,则不执行任何关闭逻辑
|
|||
|
if (App.IsDuplicateInstance)
|
|||
|
{
|
|||
|
e.Cancel = true; // 取消关闭事件
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
//// ch:关闭设备 | en:Close Device
|
|||
|
mianWindowViewModel.m_MyCamera.MV_CC_CloseDevice_NET();
|
|||
|
mianWindowViewModel.m_MyCamera.MV_CC_DestroyDevice_NET();
|
|||
|
}
|
|||
|
|
|||
|
private void Button_Click_2(object sender, RoutedEventArgs e)
|
|||
|
{
|
|||
|
ImageSetUp ImageSetUp = new ImageSetUp(mianWindowViewModel.ReaderImagePath_Temp);
|
|||
|
|
|||
|
MenuView.Children.Add(ImageSetUp);
|
|||
|
MenuView.Visibility = Visibility.Visible;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|