protected override int AddNewData()
        {
            m_levelLayout = DataManager.Generate<LevelLayout>();
            //m_levelLayout.Name = m_textBox_name.Text;
            m_levelLayout.Priority = m_integerUpDown_priority.Value.Value;
            m_levelLayout.Data.Clear();
            m_levelLayout.Data.AddRange(CreateDataFromControls());
            //m_levelLayout.X = m_doubleUpDown_x.Value.Value;
            //m_levelLayout.Y = m_doubleUpDown_y.Value.Value;

            DataManager.LevelLayouts.Add(m_levelLayout);

            return m_levelLayout.Id;
        }
        public UserControl_LevelLayoutDataEditor(LevelLayout levelLayout)
            : base("Level Layout", true)
        {
            m_levelLayout = levelLayout;

            if (DataIsNull())
            {
                throw new ArgumentNullException("levelLayout");
            }
            else
            {
                m_textBlock_id.Text = m_levelLayout.Id.ToString();
                //m_textBox_name.Text = m_levelLayout.Name;
                m_integerUpDown_priority.Value = m_levelLayout.Priority;
                CreateControlsFromData(m_levelLayout.Data);
                //m_doubleUpDown_x.Value = m_levelLayout.X;
                //m_doubleUpDown_x.Value = m_levelLayout.Y;
            }
        }
        private void CreateLevelLayoutControl(LevelLayout levelLayout)
        {
            var animationFrame = levelLayout.EntityInstanceDefinition.GetFirstAnimationFrameDefinition();
            FrameworkElement levelLayoutControl =
                (animationFrame != null)
                ? CreateLevelLayoutControlWithAnimationFrame(animationFrame)
                : CreateLevelLayoutControlWithoutAnimationFrame();

            var y = levelLayout.Y;
            var x = levelLayout.X;

            var movableLevelLayoutControl = m_canvas.AddMovableElement(levelLayoutControl, y, x);
            movableLevelLayoutControl.Tag = levelLayout;

            Binding binding_y =
                new Binding("Y")
                {
                    Source = levelLayout,
                    Mode = BindingMode.TwoWay
                };
            movableLevelLayoutControl.SetBinding(Canvas.TopProperty, binding_y);

            Binding binding_x =
                new Binding("X")
                {
                    Source = levelLayout,
                    Mode = BindingMode.TwoWay
                };
            movableLevelLayoutControl.SetBinding(Canvas.LeftProperty, binding_x);
        }
 private LevelLayout AddTemporaryLevelLayout(EntityInstanceDefinition entityInstanceDefinition, double x, double y)
 {
     var levelLayout =
         new LevelLayout()
         {
             Id = c_temporaryId,
             EntityInstanceDefinition = entityInstanceDefinition,
             Level = m_level,
             Priority = 0,
             X = x,
             Y = y
         };
     m_levelLayouts.Add(levelLayout);
     return levelLayout;
 }