Esempio n. 1
0
        /// <summary>
        /// Handles the <see cref="Selector.SelectionChanged"/> event for the "Entity Class" <see
        /// cref="ListView"/>.</summary>
        /// <param name="sender">
        /// The <see cref="Object"/> where the event handler is attached.</param>
        /// <param name="args">
        /// A <see cref="SelectionChangedEventArgs"/> object containing event data.</param>
        /// <remarks>
        /// <b>OnEntitySelected</b> updates all dialog controls to reflect the selected item in the
        /// "Entity Class" list view.</remarks>

        private void OnEntitySelected(object sender, SelectionChangedEventArgs args)
        {
            args.Handled = true;

            // clear data display
            this._tileBuffer.Clear();
            EntityInfo.Clear();
            PropertyList.ShowEntityClass(null);

            // retrieve selected item, if any
            EntityClass entityClass = EntityList.SelectedItem as EntityClass;

            if (entityClass == null)
            {
                return;
            }

            // set new frame index range
            FrameScrollBar.Minimum     = 0;
            FrameScrollBar.Maximum     = Math.Max(entityClass.FrameCount - 1, 0);
            FrameScrollBar.SmallChange = 1;

            // show first or specified frame
            int value = (entityClass == this._entityClass ? this._frameOffset : 0);

            // change index, or redraw manually if unchanged
            if (FrameScrollBar.Value != value)
            {
                FrameScrollBar.Value = value;
            }
            else
            {
                ShowFrame(entityClass, value);
            }

            // show entity class properties
            PropertyList.ShowEntityClass(entityClass);

            // show associated informational text
            EntityInfo.Text = String.Join(Environment.NewLine, entityClass.Paragraphs);
        }
Esempio n. 2
0
        private void UpdateEntityInformation_EditorThread(CInspectorSceneComponentViewModel sceneComponentRoot, List <CInspectorEntityComponentViewModel> entityComponents, CInspectorEntityViewModel entity)
        {
            SceneComponents.Clear();
            EntityComponents.Clear();
            EntityInfo.Clear();

            if (sceneComponentRoot != null)
            {
                SceneComponents.Add(sceneComponentRoot);
            }

            if (entityComponents != null)
            {
                EntityComponents = new ObservableCollection <CInspectorEntityComponentViewModel>(entityComponents);
            }

            if (entity != null)
            {
                EntityInfo.Add(entity);
            }
        }