| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- using MvCamCtrl.NET;
- using Prism.Commands;
- using Prism.Mvvm;
- using Prism.Services.Dialogs;
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Linq;
- using TeamAAS_VP.Enums;
- using TeamAAS_VP.Models;
- using TeamAAS_VP.Resources.Languages;
- namespace TeamAAS_VP.ViewModels.Setting
- {
- public class SelectCameraBrandViewModel : BindableBase, IDialogAware
- {
- private CameraBrand _CameraBrand;
- /// <summary>
- /// 相机品牌
- /// </summary>
- public CameraBrand CameraBrand
- {
- get { return _CameraBrand; }
- set { SetProperty(ref _CameraBrand, value); }
- }
- private DelegateCommand _ConfirmCommand;
- public DelegateCommand ConfirmCommand =>
- _ConfirmCommand ?? (_ConfirmCommand = new DelegateCommand(ExecuteConfirmCommand));
- void ExecuteConfirmCommand()
- {
- IDialogParameters parameters = new DialogParameters();
- parameters.Add("CameraBrand", CameraBrand);
- RequestClose?.Invoke(new DialogResult(ButtonResult.OK, parameters));
- }
- private DelegateCommand _CancelCommand;
- public DelegateCommand CancelCommand =>
- _CancelCommand ?? (_CancelCommand = new DelegateCommand(ExecuteCancelCommand));
- void ExecuteCancelCommand()
- {
- IDialogParameters parameters = new DialogParameters();
- parameters.Add("CameraBrand", CameraBrand);
- RequestClose?.Invoke(new DialogResult(ButtonResult.Cancel, parameters));
- }
- public SelectCameraBrandViewModel()
- {
- }
- public string Title { get; set; } = "Select Camera Brand";
- public event Action<IDialogResult> RequestClose;
- public bool CanCloseDialog()
- {
- return true;
- }
- public void OnDialogClosed()
- {
- }
- public void OnDialogOpened(IDialogParameters parameters)
- {
- Title = Lang.添加相机;
- if (parameters.TryGetValue<CameraBrand>("CameraBrand",out CameraBrand brand))
- {
- CameraBrand = brand;
- }
- else
- {
- CameraBrand = CameraBrand.HikRobot_MVS;
- }
- }
- }
- }
|