Beispiel #1
0
        private void OutputService_LineWritten(object sender, WriteLineEventArgs e)
        {
            var clientUpdate = new ClientUpdate();

            clientUpdate.OutputLines = new[] { e.Line };
            PushUpdate(clientUpdate);
        }
Beispiel #2
0
        private void SelectedEntities_CollectionChanged(object sender, EventArgs e)
        {
            var selectedEntities = Workspace.SelectedEntities.ToList();
            var clientUpdate     = new ClientUpdate();

            // prepare selected drawing
            clientUpdate.SelectedEntitiesDrawing = new ClientDrawing(null);
            var fallBackColor = Workspace.SettingsService.GetValue <CadColor>(DisplaySettingsNames.BackgroundColor).GetAutoContrastingColor();

            foreach (var entity in selectedEntities)
            {
                foreach (var primitive in entity.GetPrimitives())
                {
                    AddPrimitiveToDrawing(clientUpdate.SelectedEntitiesDrawing, primitive, fallBackColor);
                }
            }

            // update property pane
            ClientPropertyPane propertyPane;

            if (selectedEntities.Count == 0)
            {
                // nothing selected; send emtpy set to clear ui
                propertyPane = new ClientPropertyPane();
            }
            else
            {
                // only get properties common to all entities
                propertyPane = new ClientPropertyPane(Workspace.GetPropertyPaneValues());
            }

            clientUpdate.PropertyPane = propertyPane;

            PushUpdate(clientUpdate);
        }
Beispiel #3
0
        private void SettingsService_SettingChanged(object sender, SettingChangedEventArgs e)
        {
            var clientUpdate = new ClientUpdate();

            clientUpdate.Settings = GetSettings();
            PushUpdate(clientUpdate);
        }
Beispiel #4
0
        private void InputService_PromptChanged(object sender, PromptChangedEventArgs e)
        {
            var clientUpdate = new ClientUpdate();

            clientUpdate.Prompt = e.Prompt;
            PushUpdate(clientUpdate);
        }
Beispiel #5
0
        private void _workspace_WorkspaceChanged(object sender, WorkspaceChangeEventArgs e)
        {
            var doUpdate     = false;
            var clientUpdate = new ClientUpdate();

            if (e.IsDirtyChange)
            {
                doUpdate             = true;
                clientUpdate.IsDirty = true;
            }

            if (e.IsActiveViewPortChange)
            {
                doUpdate = true;
                clientUpdate.Transform = GetDisplayTransform();
            }

            if (e.IsDrawingChange)
            {
                doUpdate             = true;
                clientUpdate.Drawing = GetDrawing();
            }

            if (doUpdate)
            {
                PushUpdate(clientUpdate);
            }
        }
Beispiel #6
0
        private void _dim_SelectionRectangleUpdated(object sender, SelectionState?e)
        {
            var clientUpdate = new ClientUpdate();

            clientUpdate.SelectionState = e;
            PushUpdate(clientUpdate);
        }
Beispiel #7
0
        private void _dim_HotPointsUpdated(object sender, IEnumerable <Point> e)
        {
            var clientUpdate = new ClientUpdate();

            clientUpdate.HotPoints = e.Select(p => new ClientPoint(p)).ToArray();
            PushUpdate(clientUpdate);
        }
Beispiel #8
0
        private void _dim_CursorStateUpdated(object sender, CursorState e)
        {
            var clientUpdate = new ClientUpdate();

            clientUpdate.CursorState = e;
            PushUpdate(clientUpdate);
        }
Beispiel #9
0
 private void _dim_CurrentSnapPointUpdated(object sender, TransformedSnapPoint?e)
 {
     if (e.HasValue)
     {
         var clientUpdate = new ClientUpdate();
         clientUpdate.TransformedSnapPoint = e;
         PushUpdate(clientUpdate);
     }
 }
Beispiel #10
0
        public void Resize(double width, double height)
        {
            _dim.Resize(width, height);
            var clientUpdate = new ClientUpdate()
            {
                Transform = GetDisplayTransform(),
            };

            PushUpdate(clientUpdate);
        }
Beispiel #11
0
        private void _dim_RubberBandPrimitivesChanged(object sender, IEnumerable <IPrimitive> primitives)
        {
            var clientUpdate = new ClientUpdate();

            clientUpdate.RubberBandDrawing = new ClientDrawing(null);
            var fallBackColor = Workspace.SettingsService.GetValue <CadColor>(DisplaySettingsNames.BackgroundColor).GetAutoContrastingColor();

            foreach (var primitive in primitives)
            {
                AddPrimitiveToDrawing(clientUpdate.RubberBandDrawing, primitive, fallBackColor);
            }

            PushUpdate(clientUpdate);
        }
Beispiel #12
0
        public void Ready(double width, double height)
        {
            _dim.Resize(width, height);
            var clientUpdate = new ClientUpdate()
            {
                Drawing   = GetDrawing(),
                Settings  = GetSettings(),
                Transform = GetDisplayTransform(),
            };

            PushUpdate(clientUpdate);
            if (!_readyEventFired)
            {
                _readyEventFired = true;
                IsReady?.Invoke(this, new EventArgs());
            }
        }
Beispiel #13
0
 private void PushUpdate(ClientUpdate clientUpdate)
 {
     var _ = _jsonRpc.NotifyAsync("ClientUpdate", clientUpdate);
 }