public void Add(IMapCommand command)
 {
     if (!IsEqual(command))
     {
         _stack.Push(command);
     }
 }
        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;
            }
        }
        private bool IsEqual(IMapCommand comamnd)
        {
            if (IsEmpty)
                return false;

            var current = _stack.Peek();
            return current.Equals(comamnd);
        }
Example #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;
                }
            }
        }
Example #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();
            }
        }
Example #6
0
 public CloningMapCommand(IInvoke invoke, IMapCommand inner)
 {
     this.inner  = inner;
     this.invoke = invoke;
 }
        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;
            }
        }
Example #8
0
 public void AddUndoCommand(IMapCommand command)
 {
     _redo.Clear();
     _undo.Add(command);
 }
Example #9
0
 public void AddRedoCommand(IMapCommand command)
 {
     _redo.Add(command);
 }
Example #10
0
 /// <summary>
 /// 履歴にCommandを追加
 /// </summary>
 /// <param name="command"></param>
 public void AddHistory(IMapCommand command)
 {
     _memento.AddUndoCommand(command);
 }