Esempio n. 1
0
        /// <summary>
        /// Constructor</summary>
        /// <param name="parent">Parent target dialog view model</param>
        public FindTargetsViewModel(TargetDialogViewModel parent)
        {
            m_parent = parent;

            Title = "Find Targets".Localize();
            ToggleScanCommand = new DelegateCommand(ToggleScan);
            AddAllFoundTargetsCommand = new DelegateCommand(AddAllFoundTargets, CanAddAllFoundTargets, false);

            FoundTargets = new ObservableCollection<TargetViewModel>();
            FoundTargets.CollectionChanged += (s, e) => CommandManager.InvalidateRequerySuggested();
            m_foundTargetCv = CollectionViewSource.GetDefaultView(FoundTargets);
        }
Esempio n. 2
0
        /// <summary>
        /// Constructor</summary>
        /// <param name="parent">Parent target dialog view model</param>
        public FindTargetsViewModel(TargetDialogViewModel parent)
        {
            m_parent = parent;

            Title                     = "Find Targets".Localize();
            ToggleScanCommand         = new DelegateCommand(ToggleScan);
            AddAllFoundTargetsCommand = new DelegateCommand(AddAllFoundTargets, CanAddAllFoundTargets, false);

            FoundTargets = new ObservableCollection <TargetViewModel>();
            FoundTargets.CollectionChanged += (s, e) => CommandManager.InvalidateRequerySuggested();
            m_foundTargetCv = CollectionViewSource.GetDefaultView(FoundTargets);
        }
Esempio n. 3
0
        /// <summary>
        /// Show target dialog</summary>
        /// <returns>Nullable Boolean signifying how window was closed by user</returns>
        public bool? ShowTargetDialog()
        {
            var tvm = new TargetDialogViewModel(m_targets, m_protocols.GetValues<IProtocol>());
            bool? result = DialogUtils.ShowDialogWithViewModel<TargetDialog>(tvm);

            if (result.HasValue && result.Value)
            {
                m_targets.Clear();
                m_targets.AddRange(tvm.Targets);
            }

            return result;
        }