Ejemplo n.º 1
0
 public void Add(IMapCommand command)
 {
     if (!IsEqual(command))
     {
         _stack.Push(command);
     }
 }
Ejemplo n.º 2
0
        private static void ConfigureDitto()
        {
            try
            {
                var container = new DestinationConfigurationContainer(null, new TestConfigurationFactory());


                container.Map <BenchDestinationProps.Int1>().From <BenchSourceProps.Int1>();
                container.Map <BenchDestinationProps.Int2>().From <BenchSourceProps.Int2>();
                container.Map <BenchDestinationProps>().From <BenchSourceProps>();


                var bindable = container.ToBinding();
                bindable.Bind();
                bindable.Assert();
                var contextualizer = new TestContextualizer();
                var cacher         = new CacheInitializer(contextualizer);
                bindable.Accept(cacher);
                dittoMapCommand = bindable.CreateCommand(typeof(BenchSourceProps), typeof(BenchDestinationProps));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                throw;
            }
        }
Ejemplo n.º 3
0
        private bool IsEqual(IMapCommand comamnd)
        {
            if (IsEmpty)
                return false;

            var current = _stack.Peek();
            return current.Equals(comamnd);
        }
Ejemplo n.º 4
0
        private void ToolbarButton_Click(object sender, RoutedEventArgs e)
        {
            IMapCommand cmd = (sender as ToolbarButton).DataContext as IMapCommand;

            if (cmd != null)
            {
                cmd.Click();
                if (cmd is IMapTool)
                {
                    ResetPreviousToolButton();
                    _previousToolbarButton           = sender as ToolbarButton;
                    _previousToolbarButton.IsActived = true;
                }
            }
        }
Ejemplo n.º 5
0
        private void SetMapToolByCurrentType()
        {
            IMapCommand cmd = MapToolFactory.GetMapTool(_currentToolType);

            if (!(cmd is IMapTool))
            {
                return;
            }
            if (_currentMapTool != null)
            {
                (_currentMapTool as IMapToolInternal).Deactive();
            }
            _currentMapTool = cmd as IMapTool;
            if (_currentMapTool == null)
            {
                _currentToolType = enumMapTools.None;
            }
            else
            {
                (_currentMapTool as IMapToolInternal).Active();
            }
        }
Ejemplo n.º 6
0
 public CloningMapCommand(IInvoke invoke, IMapCommand inner)
 {
     this.inner  = inner;
     this.invoke = invoke;
 }
Ejemplo n.º 7
0
        private static void ConfigureDitto()
        {
            try
            {

                var container = new DestinationConfigurationContainer(null, new TestConfigurationFactory());

                container.Map<BenchDestinationProps.Int1>().From<BenchSourceProps.Int1>();
                container.Map<BenchDestinationProps.Int2>().From<BenchSourceProps.Int2>();
                container.Map<BenchDestinationProps>().From<BenchSourceProps>();

                var bindable = container.ToBinding();
                bindable.Bind();
                bindable.Assert();
                var contextualizer = new TestContextualizer();
                var cacher = new CacheInitializer(contextualizer);
                bindable.Accept(cacher);
                dittoMapCommand = bindable.CreateCommand(typeof (BenchSourceProps), typeof (BenchDestinationProps));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                throw;
            }
        }
Ejemplo n.º 8
0
 public void AddUndoCommand(IMapCommand command)
 {
     _redo.Clear();
     _undo.Add(command);
 }
Ejemplo n.º 9
0
 public void AddRedoCommand(IMapCommand command)
 {
     _redo.Add(command);
 }
Ejemplo n.º 10
0
 /// <summary>
 /// 履歴にCommandを追加
 /// </summary>
 /// <param name="command"></param>
 public void AddHistory(IMapCommand command)
 {
     _memento.AddUndoCommand(command);
 }