using Aurora; using Aurora.Api; using Aurora.View; using AuroraCAS; using MilUI; using System; using System.Collections.Generic; using System.Linq; using System.Reactive.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Input; using VisionCommon; namespace WeldingCommon.Views { public class UCManualScannerOperationViewModel : NotifyPropertyChangedBase { private readonly Logger Log = new Logger("UCManualScannerOperationViewModel"); // SelectField 관련은 Recipe Menu 로 이동하였음. 해당 ViewModel 에서 삭제 //public ICommand CMD_ShowSelectFieldWindow { get; } private readonly IAuroraEnvironment _Aurora; //private WDSelectScoutField _SelectFieldWindow; public UCScannerMotionViewModel ScannerMotionViewModel { get; } public UCScannerLaserControlViewModel ScannerLaserControlViewModel { get; } public UCManualScannerOperationViewModel(IAuroraEnvironment aurora, string scannerId, bool isUseMarkingOntheFly = false) { _Aurora = aurora; //CMD_ShowSelectFieldWindow = new DelegateCommand(PerformCmdShowSelectFieldWindow, CanShowSelectFieldWindow); ScannerMotionViewModel = new UCScannerMotionViewModel(_Aurora, scannerId); ScannerLaserControlViewModel = new UCScannerLaserControlViewModel(_Aurora, scannerId, isUseMarkingOntheFly); //VisionEnv.AuroraEnv.EventObservable.AsObservable(VisionEventId.SAVE_CHILD_IMAGE_SETTING). // Where(x => x.From == eCamId.CAM1.ToString()).Subscribe(msg => ShowSelectFieldWindow(msg)); } //private bool CanShowSelectFieldWindow(object o) => _SelectFieldWindow == null; //private void PerformCmdShowSelectFieldWindow(object o) //{ // ShowSelectFieldWindow(null); //} //private void ShowSelectFieldWindow(EventMessage msg) { // try { // Application.Current.Dispatcher.Invoke( // new Action(() => { // if (_SelectFieldWindow != null) { // _SelectFieldWindow.Closed -= (sender, _) => { _SelectFieldWindow = null; }; // _SelectFieldWindow.Close(); // _SelectFieldWindow = null; // } // _SelectFieldWindow = new WDSelectScoutField(_Aurora) { // Owner = Application.Current.MainWindow // }; // _SelectFieldWindow.Closed += (sender, _) => { _SelectFieldWindow = null; }; // _SelectFieldWindow.Show(); // })); // } // catch { // } //} // TODO: View 에서 해당 button 이 주석 처리 되어 있음. //private bool CanShowMotionWindow(object o) => _MotionWindow == null; //private void PerformCmdShowMotionWindow(object o) //{ // if (_MotionWindow == null) { // _MotionWindow = new WDSingleAxisControl(_AuroraEnv) { // Owner = Application.Current.MainWindow, // }; // _MotionWindow.Closed += (sender, _) => { _MotionWindow = null; }; // } // _MotionWindow.ShowDialog(); //} } }