Example #1
0
        /// <summary>
        /// Handles the copy code event.
        /// </summary>
        /// <param name="view">The view.</param>
        /// <param name="args">The <see cref="OxyInputEventArgs"/> instance containing the event data.</param>
        private static void HandleCopyCode(IPlotView view, OxyInputEventArgs args)
        {
            args.Handled = true;
            var code = view.ActualModel.ToCode();

            view.SetClipboardText(code);
        }
Example #2
0
        /// <summary>
        /// Handles the copy text report event.
        /// </summary>
        /// <param name="view">The view.</param>
        /// <param name="args">The <see cref="OxyInputEventArgs"/> instance containing the event data.</param>
        private static void HandleCopyTextReport(IPlotView view, OxyInputEventArgs args)
        {
            args.Handled = true;
            var text = view.ActualModel.CreateTextReport();

            view.SetClipboardText(text);
        }
Example #3
0
 /// <summary>
 /// Pans the view by the key in the specified vector.
 /// </summary>
 /// <param name="view">The view.</param>
 /// <param name="args">The <see cref="OxyInputEventArgs" /> instance containing the event data.</param>
 /// <param name="dx">The horizontal delta (percentage of plot area width).</param>
 /// <param name="dy">The vertical delta (percentage of plot area height).</param>
 private static void HandlePan(IPlotView view, OxyInputEventArgs args, double dx, double dy)
 {
     args.Handled = true;
     dx          *= view.ActualModel.PlotArea.Width;
     dy          *= view.ActualModel.PlotArea.Height;
     view.ActualModel.PanAllAxes(dx, dy);
     view.InvalidatePlot(false);
 }
Example #4
0
        /// <summary>
        /// Handles a command triggered by an input gesture.
        /// </summary>
        /// <param name="command">The command.</param>
        /// <param name="view">The plot view.</param>
        /// <param name="args">The <see cref="OxyInputEventArgs" /> instance containing the event data.</param>
        /// <returns><c>true</c> if the command was handled.</returns>
        protected virtual bool HandleCommand(IViewCommand command, IView view, OxyInputEventArgs args)
        {
            if (command == null)
            {
                return(false);
            }

            command.Execute(view, this, args);
            return(args.Handled);
        }
Example #5
0
        /// <summary>
        /// Handles a command triggered by an input gesture.
        /// </summary>
        /// <param name="command">The command.</param>
        /// <param name="view">The plot view.</param>
        /// <param name="args">The <see cref="OxyInputEventArgs" /> instance containing the event data.</param>
        /// <returns><c>true</c> if the command was handled.</returns>
        protected virtual bool HandleCommand(IViewCommand command, IView view, OxyInputEventArgs args)
        {
            if (command == null)
            {
                return false;
            }

            command.Execute(view, this, args);
            return args.Handled;
        }
Example #6
0
 /// <summary>
 /// Handles the specified gesture.
 /// </summary>
 /// <param name="view">The plot view.</param>
 /// <param name="gesture">The gesture.</param>
 /// <param name="args">The <see cref="OxyInputEventArgs" /> instance containing the event data.</param>
 /// <returns><c>true</c> if the event was handled.</returns>
 public bool HandleGesture(IView view, OxyInputGesture gesture, OxyInputEventArgs args)
 {
     var command = this.GetCommand(gesture);
     return this.HandleCommand(command, view, args);
 }
Example #7
0
 /// <summary>
 /// Zooms the view by the key in the specified factor.
 /// </summary>
 /// <param name="view">The view.</param>
 /// <param name="args">The <see cref="OxyInputEventArgs" /> instance containing the event data.</param>
 /// <param name="delta">The zoom factor (positive zoom in, negative zoom out).</param>
 private static void HandleZoomCenter(IPlotView view, OxyInputEventArgs args, double delta)
 {
     args.Handled = true;
     view.ActualModel.ZoomAllAxes(1 + (delta * 0.12));
     view.InvalidatePlot(false);
 }
Example #8
0
 /// <summary>
 /// Handles the reset event.
 /// </summary>
 /// <param name="view">The view to reset.</param>
 /// <param name="args">The <see cref="OxyInputEventArgs" /> instance containing the event data.</param>
 private static void HandleReset(IPlotView view, OxyInputEventArgs args)
 {
     args.Handled = true;
     view.ActualModel.ResetAllAxes();
     view.InvalidatePlot(false);
 }
Example #9
0
 /// <summary>
 /// Pans the view by the key in the specified vector.
 /// </summary>
 /// <param name="view">The view.</param>
 /// <param name="args">The <see cref="OxyInputEventArgs" /> instance containing the event data.</param>
 /// <param name="dx">The horizontal delta (percentage of plot area width).</param>
 /// <param name="dy">The vertical delta (percentage of plot area height).</param>
 private static void HandlePan(IPlotView view, OxyInputEventArgs args, double dx, double dy)
 {
     args.Handled = true;
     dx *= view.ActualModel.PlotArea.Width;
     dy *= view.ActualModel.PlotArea.Height;
     view.ActualModel.PanAllAxes(dx, dy);
     view.InvalidatePlot(false);
 }
Example #10
0
 /// <summary>
 /// Handles the copy text report event.
 /// </summary>
 /// <param name="view">The view.</param>
 /// <param name="args">The <see cref="OxyInputEventArgs"/> instance containing the event data.</param>
 private static void HandleCopyTextReport(IPlotView view, OxyInputEventArgs args)
 {
     args.Handled = true;
     var text = view.ActualModel.CreateTextReport();
     view.SetClipboardText(text);
 }
Example #11
0
 /// <summary>
 /// Handles the copy code event.
 /// </summary>
 /// <param name="view">The view.</param>
 /// <param name="args">The <see cref="OxyInputEventArgs"/> instance containing the event data.</param>
 private static void HandleCopyCode(IPlotView view, OxyInputEventArgs args)
 {
     args.Handled = true;
     var code = view.ActualModel.ToCode();
     view.SetClipboardText(code);
 }
Example #12
0
 /// <summary>
 /// Executes the command on the specified plot.
 /// </summary>
 /// <param name="view">The plot view.</param>
 /// <param name="controller">The plot controller.</param>
 /// <param name="args">The <see cref="OxyInputEventArgs" /> instance containing the event data.</param>
 public void Execute(IView view, IController controller, OxyInputEventArgs args)
 {
     this.handler(view, controller, (T)args);
 }
Example #13
0
 /// <summary>
 /// Zooms the view by the key in the specified factor.
 /// </summary>
 /// <param name="view">The view.</param>
 /// <param name="args">The <see cref="OxyInputEventArgs" /> instance containing the event data.</param>
 /// <param name="delta">The zoom factor (positive zoom in, negative zoom out).</param>
 private static void HandleZoomCenter(IPlotView view, OxyInputEventArgs args, double delta)
 {
     args.Handled = true;
     view.ActualModel.ZoomAllAxes(1 + (delta * 0.12));
     view.InvalidatePlot(false);
 }
Example #14
0
 /// <summary>
 /// Handles the reset event.
 /// </summary>
 /// <param name="view">The view to reset.</param>
 /// <param name="args">The <see cref="OxyInputEventArgs" /> instance containing the event data.</param>
 private static void HandleReset(IPlotView view, OxyInputEventArgs args)
 {
     args.Handled = true;
     view.ActualModel.ResetAllAxes();
     view.InvalidatePlot(false);
 }
Example #15
0
        /// <summary>
        /// Handles the specified gesture.
        /// </summary>
        /// <param name="view">The plot view.</param>
        /// <param name="gesture">The gesture.</param>
        /// <param name="args">The <see cref="OxyInputEventArgs" /> instance containing the event data.</param>
        /// <returns><c>true</c> if the event was handled.</returns>
        public virtual bool HandleGesture(IView view, OxyInputGesture gesture, OxyInputEventArgs args)
        {
            var command = this.GetCommand(gesture);

            return(this.HandleCommand(command, view, args));
        }