示例#1
0
        private void SetEditableViewModels()
        {
            // clear all
            if (EditAggregateViewModel != null)
            {
                EditAggregateViewModel.Dispose();
            }
            EditAggregateViewModel = null;

            if (EditArcViewModel != null)
            {
                EditArcViewModel.Dispose();
            }
            EditArcViewModel = null;

            if (EditCircleViewModel != null)
            {
                EditCircleViewModel.Dispose();
            }
            EditCircleViewModel = null;

            if (EditEllipseViewModel != null)
            {
                EditEllipseViewModel.Dispose();
            }
            EditEllipseViewModel = null;

            if (EditLineViewModel != null)
            {
                EditLineViewModel.Dispose();
            }
            EditLineViewModel = null;

            if (EditLocationViewModel != null)
            {
                EditLocationViewModel.Dispose();
            }
            EditLocationViewModel = null;

            if (EditTextViewModel != null)
            {
                EditTextViewModel.Dispose();
            }
            EditTextViewModel = null;

            if (IsEditingEnabled && workspace.SelectedEntities.Count == 1)
            {
                SetEditableViewModel(workspace.SelectedEntities.First());
            }
        }
示例#2
0
        private void SetEditableViewModel(Entity entity)
        {
            switch (entity.Kind)
            {
            case EntityKind.Aggregate:
                EditAggregateViewModel = new EditAggregateViewModel(workspace, (AggregateEntity)entity);
                break;

            case EntityKind.Arc:
                EditArcViewModel = new EditArcViewModel(workspace, (Arc)entity);
                break;

            case EntityKind.Circle:
                EditCircleViewModel = new EditCircleViewModel(workspace, (Circle)entity);
                break;

            case EntityKind.Ellipse:
                EditEllipseViewModel = new EditEllipseViewModel(workspace, (Ellipse)entity);
                break;

            case EntityKind.Line:
                EditLineViewModel = new EditLineViewModel(workspace, (Line)entity);
                break;

            case EntityKind.Location:
                EditLocationViewModel = new EditLocationViewModel(workspace, (Location)entity);
                break;

            case EntityKind.Polyline:
                // TODO: is the list of points editable?
                break;

            case EntityKind.Text:
                EditTextViewModel = new EditTextViewModel(workspace, (Text)entity);
                break;

            default:
                break;
            }
        }