Пример #1
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="TilingController" /> class.
        /// </summary>
        /// <param name="tiling">The tiling.</param>
        /// <param name="view">The view.</param>
        /// <exception cref="System.ArgumentNullException">
        /// </exception>
        /// <exception cref="System.InvalidOperationException"></exception>
        public TilingController([NotNull] Tiling tiling, [NotNull] IView view)
            : base(view)
        {
            if (tiling == null) throw new ArgumentNullException(nameof(tiling));

            _tiling = tiling;

            IResourceManager resourceManager = DependencyManger.GetResourceManager(StyleManager);
            _resourceManager = resourceManager;

            resourceManager.Add(SolidColourStyle.Transparent);
            resourceManager.Add(SolidColourStyle.White);
            resourceManager.Add(SolidColourStyle.Black);
            resourceManager.Add(SolidColourStyle.Gray);
            resourceManager.Add(SolidColourStyle.CornflowerBlue);
            resourceManager.Add(TransparentBlue);

            _tiles = _tiling.GetTiles(view.ViewBounds, Enumerable.Empty<TileBase>());

            _styleManagerChangedHandler = _styleManager_Changed;
            StyleManager.StylesChanged += _styleManagerChangedHandler;

            Tools = new Tool[]
            {
                EditLine = new EditLineTool(this, _tolerance),
                SplitLine = new SplitLineTool(this, _tolerance)
            };

            view.ViewBoundsChanged += View_ViewBoundsChanged;
        }
 /// <summary>
 ///     Initializes a new instance of the <see cref="CurrentToolChangedEventArgs" /> class.
 /// </summary>
 /// <param name="oldTool">The old tool.</param>
 /// <param name="newTool">The new tool.</param>
 public CurrentToolChangedEventArgs([CanBeNull] Tool oldTool, [CanBeNull] Tool newTool)
 {
     OldTool = oldTool;
     NewTool = newTool;
 }