Inheritance: FrameContainerViewModel, IGrid
コード例 #1
0
    public override object Copy(IDictionary <object, object>?shared)
    {
        var styleLibraries = _styleLibraries.CopyShared(shared).ToImmutable();
        var groupLibraries = _groupLibraries.CopyShared(shared).ToImmutable();
        var databases      = _databases.CopyShared(shared).ToImmutable();
        var templates      = _templates.CopyShared(shared).ToImmutable();
        var scripts        = _scripts.CopyShared(shared).ToImmutable();
        var documents      = _documents.CopyShared(shared).ToImmutable();

        var currentStyleLibrary = _currentStyleLibrary.GetCurrentItem(ref _styleLibraries, ref styleLibraries);
        var currentGroupLibrary = _currentGroupLibrary.GetCurrentItem(ref _styleLibraries, ref styleLibraries);
        var currentDatabase     = _currentDatabase.GetCurrentItem(ref _databases, ref databases);
        var currentTemplate     = _currentTemplate.GetCurrentItem(ref _templates, ref templates);
        var currentScript       = _currentScript.GetCurrentItem(ref _scripts, ref scripts);
        var currentDocument     = _currentDocument.GetCurrentItem(ref _documents, ref documents);
        var currentContainer    = _currentContainer switch
        {
            PageContainerViewModel page => page.GetCurrentItem(ref _documents, ref documents, x => x.Pages),
            TemplateContainerViewModel template => template.GetCurrentItem(ref _templates, ref templates),
            _ => default(FrameContainerViewModel?)
        };

        var copy = new ProjectContainerViewModel(ServiceProvider)
        {
            Options             = _options?.CopyShared(shared),
            StyleLibraries      = styleLibraries,
            GroupLibraries      = groupLibraries,
            Databases           = databases,
            Templates           = templates,
            Scripts             = scripts,
            Documents           = documents,
            CurrentStyleLibrary = currentStyleLibrary,
            CurrentGroupLibrary = currentGroupLibrary,
            CurrentDatabase     = currentDatabase,
            CurrentTemplate     = currentTemplate,
            CurrentScript       = currentScript,
            CurrentDocument     = currentDocument,
            CurrentContainer    = currentContainer
        };

        if (_selected is { } && shared is { })
コード例 #2
0
    public override object Copy(IDictionary<object, object>? shared)
    {
        var layers = _layers.CopyShared(shared).ToImmutable();
        var currentLayer = _currentLayer.GetCurrentItem(ref _layers, ref layers);
        var currentShape = _currentShape.GetCurrentItem(ref _layers, ref layers, x => x.Shapes);
        var properties = _properties.CopyShared(shared).ToImmutable();

        var copy = new TemplateContainerViewModel(ServiceProvider)
        {
            Name = Name,
            IsVisible = IsVisible,
            IsExpanded = IsExpanded,
            Layers = layers,
            CurrentLayer = currentLayer,
            WorkingLayer = _workingLayer?.CopyShared(shared),
            HelperLayer = _helperLayer?.CopyShared(shared),
            CurrentShape = currentShape,
            Properties = properties,
            Record = _record,
            Width = Width,
            Height = Height,
            Background = _background?.CopyShared(shared),
            IsGridEnabled = IsGridEnabled,
            IsBorderEnabled = IsBorderEnabled,
            GridOffsetLeft = GridOffsetLeft,
            GridOffsetTop = GridOffsetTop,
            GridOffsetRight = GridOffsetRight,
            GridOffsetBottom = GridOffsetBottom,
            GridCellWidth = GridCellWidth,
            GridCellHeight = GridCellHeight,
            GridStrokeColor = _gridStrokeColor?.CopyShared(shared),
            GridStrokeThickness = GridStrokeThickness
        };

        return copy;
    }