Ejemplo n.º 1
0
 private void MoveAlphabetBy(int steps)
 {
     if (steps > 0)
     {
         for (var i = 0; i < steps; i++)
         {
             var firstLetterInner = InnerLetterViews.First();
             var firstLetterOuter = OuterLetterViews.First();
             InnerLetterViews.Remove(firstLetterInner);
             OuterLetterViews.Remove(firstLetterOuter);
             InnerLetterViews.Add(firstLetterInner);
             OuterLetterViews.Add(firstLetterOuter);
         }
     }
     else
     {
         for (var i = 0; i > steps; i--)
         {
             var lastLetterInner = InnerLetterViews.Last();
             var lastLetterOuter = OuterLetterViews.Last();
             InnerLetterViews.Remove(lastLetterInner);
             OuterLetterViews.Remove(lastLetterOuter);
             InnerLetterViews.Insert(0, lastLetterInner);
             OuterLetterViews.Insert(0, lastLetterOuter);
         }
     }
 }
Ejemplo n.º 2
0
        public override void Handle(LetterTranslation translation)
        {
            Grid.UpdateLayout();

            LetterView fromView, toView;

            if (translation.Direction == SignalDirection.In)
            {
                fromView = InnerLetterViews.First(vm => vm.Letter == translation.Input).GetView() as LetterView;
                toView   = OuterLetterViews.First(vm => vm.Letter == translation.Result).GetView() as LetterView;
            }
            else
            {
                fromView = OuterLetterViews.First(vm => vm.Letter == translation.Input).GetView() as LetterView;
                toView   = InnerLetterViews.First(vm => vm.Letter == translation.Result).GetView() as LetterView;
            }

            ConnectionDrawer.Draw(fromView, toView, translation.Direction);
        }