protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            // TODO: maybe remove this 2 lines
              reorderListBoxSprites.ItemsSource = editorViewModel.Sprites;
              reorderListBoxSprites.SelectedItem = editorViewModel.SelectedSprite;

              // TODO: do this somewhere else
              if (AddNewBrick.SelectedBrick != null)
              {
            Sprite selectedSprite = editorViewModel.SelectedSprite;
            DataObject newScriptBrick = AddNewBrick.SelectedBrick;

            ((ScriptBrickCollection)reorderListBoxScriptBricks.ItemsSource).AddScriptBrick(newScriptBrick, firstVisibleScriptBrickIndex, lastVisibleScriptBrickIndex);

            if (newScriptBrick is LoopBeginBrick)
            {
              LoopEndBrick brick = new LoopEndBrick(((LoopBeginBrick)newScriptBrick).Sprite);
              brick.LoopBeginBrick = (LoopBeginBrick) newScriptBrick;
              ((LoopBeginBrick)newScriptBrick).LoopEndBrick = brick;
              ((ScriptBrickCollection)reorderListBoxScriptBricks.ItemsSource).AddScriptBrick(brick, firstVisibleScriptBrickIndex, lastVisibleScriptBrickIndex + 1);
            }

            reorderListBoxScriptBricks.UpdateLayout();
            reorderListBoxScriptBricks.ScrollIntoView(reorderListBoxScriptBricks.ItemContainerGenerator.ContainerFromItem(newScriptBrick));
            AddNewBrick.SelectedBrick = null;
              }
        }
Esempio n. 2
0
 public void CopyReference(LoopEndBrick copiedFrom, Sprite parent)
 {
     if (copiedFrom.loopBeginBrickReference != null)
         loopBeginBrickReference = copiedFrom.loopBeginBrickReference.Copy(parent) as LoopBeginBrickRef;
 }
Esempio n. 3
0
 internal override void LoadFromXML(XElement xRoot)
 {
     reference = xRoot.Attribute("reference").Value;
     loopEndBrick = XPathHelper.getElement(reference, sprite) as LoopEndBrick;
 }
Esempio n. 4
0
        public override DataObject Copy(Sprite parent)
        {
            var newBrick = new LoopEndBrick(parent);

            return newBrick;
        }