2026-01-26 18:56:53 +09:00

70 lines
2.2 KiB
C#

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;
using VisionCommon;
using VisionUI.Camera;
using VisionUI;
using WeldingCommon.Recipes;
namespace WeldingCommon.Views
{
/// <summary>
/// Interaction logic for UCCommonAutoRun2.xaml
/// </summary>
public partial class UCCommonAutoRun2 : UserControl
{
public UCCommonAutoRun2()
{
InitializeComponent();
CreateAutoRunCameraView();
}
private void CreateAutoRunCameraView()
{
if (gridCommonAutoRunCameraView.Children.Count == 0) {
var fovInfo = VisionRecipeManager.GetFovInfos().FirstOrDefault();
if (fovInfo != null) {
var cameraView = IpViewManager.CreateCameraView(fovInfo, eDisplayType.Machine_A);
gridCommonAutoRunCameraView.Children.Add(cameraView);
}
}
}
private void WindowsFormsHost_Loaded(object sender, RoutedEventArgs e)
{
var autoPage = WeldingRecipeManager.GetWeldingPage().ScannerCanvasCtrlAutoPage;
autoPage.Canvas.CommandScaleToFit();
autoPage.Dock = System.Windows.Forms.DockStyle.Left;
windowsFormsHost.Child = autoPage;
}
private void UserControl_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
{
bool isVisible = (bool)e.NewValue;
if (isVisible == true) {
var autoPage = WeldingRecipeManager.GetWeldingPage().ScannerCanvasCtrlAutoPage;
autoPage.Canvas.CommandScaleToFit();
autoPage.Dock = System.Windows.Forms.DockStyle.Left;
windowsFormsHost.Child = autoPage;
// Camera Live
CameraUcManager.Instance.StartLiveAll(eDisplayType.Machine_A);
} else {
CameraUcManager.Instance.StopLiveAll();
}
}
}
}