Пример #1
0
        public virtual void KeyDown(object sender, KeyEventArgs e)
        {
#if !PLAYER
            if (e.Key == System.Windows.Input.Key.Escape)
            {
                AbortAndSetDefaultTool();
                e.Handled = true;
            }

            else if (e.Key == System.Windows.Input.Key.Delete)
            {
                try
                {
                    Drawing.DeleteSelection();
                }
                catch (Exception)
                {
                }
            }
            else if (e.Key == System.Windows.Input.Key.A)
            {
                Settings.Instance.AutoLabelPoints = !Settings.Instance.AutoLabelPoints;
                string state = (Settings.Instance.AutoLabelPoints) ? "on." : "off.";
                Drawing.RaiseStatusNotification("Toggling automatic labeling of points " + state);
            }
            else if (e.Key == System.Windows.Input.Key.G)
            {
                Settings.Instance.EnableSnapToGrid = !Settings.Instance.EnableSnapToGrid;
                string state = (Settings.Instance.EnableSnapToGrid) ? "on." : "off.";
                Drawing.RaiseStatusNotification("Toggling constraining to grid " + state);
            }
#endif
        }
Пример #2
0
        public void LoadDrawing(string drawingXml, string fileName)
        {
            XElement xml = null;

            try
            {
                xml = XElement.Parse(drawingXml);
            }
            catch (Exception ex)
            {
                Drawing.RaiseStatusNotification("Invalid file format: " + ex.ToString());
                return;
            }
            LoadDrawing(xml, fileName);
        }
Пример #3
0
 private void mCurrentDrawing_ConstructionStepComplete(object sender, Drawing.ConstructionStepCompleteEventArgs args)
 {
     if (args.ConstructionComplete)
     {
         ConstructionInProgress = false;
         UpdateUndoRedo();
         Drawing.ClearStatus();
     }
     else
     {
         Drawing.RaiseDisplayProperties(Drawing.Behavior.PropertyBag);
         CommandRedo.Enabled = false;
         Drawing.RaiseStatusNotification(Drawing.Behavior.ConstructionHintText(args));
     }
 }
Пример #4
0
        protected void PlotFunction(string function)
        {
            var result = MEFHost.Instance.CompilerService.CompileFunction(Drawing, function);
            Func <double, double> func = result.Function;

            if (func != null)
            {
                var graph = CreateFunctionGraph();
                graph.Drawing      = Drawing;
                graph.FunctionText = function;
                Actions.Add(Drawing, graph);
                Drawing.ClearStatus();
            }
            else
            {
                Drawing.RaiseStatusNotification(result.ToString());
            }
        }
Пример #5
0
        public void ShowOperationDuration(Action code)
        {
            var duration = Utilities.ElapsedTime(code);

            Drawing.RaiseStatusNotification(string.Format("Processed in {0} milliseconds", duration));
        }
Пример #6
0
 public void ZoomOut()
 {
     UnitLength *= 1 / zoomFactor;
     Drawing.RaiseStatusNotification(UnitLength.ToString());
 }