Пример #1
0
        /// <summary>
        /// Initializes View portion of port and moves it to current ViewModel handler
        /// </summary>
        /// <param name="Port"></param>
        protected void SetActivePort(EditPort Port)
        {
            System.Diagnostics.Debug.Assert(this.Ports.Contains(Port));

            System.ComponentModel.ICollectionView collection = System.Windows.Data.CollectionViewSource.GetDefaultView(this.Ports);
            if (collection != null)
                collection.MoveCurrentTo(Port);
        }
Пример #2
0
        /// <summary>
        /// Creates or focus existing EditPort
        /// </summary>
        /// <param name="ActivePort">Port to display</param>
        protected void DisplayListing(EditPort ActivePort)
        {
            System.Diagnostics.Debug.WriteLine("Displaying");
            // Find port in list of ports
            var focusPort = this.Ports.FirstOrDefault(LogicR => LogicR.Equals( ActivePort ));

            // If port does not exist, add it to the list
            if (focusPort == null)
            {
                focusPort = ActivePort;
                this.Ports.Add(focusPort);
            }
            this.SetActivePort(focusPort);
        }