/// <summary>
        /// Performs an interaction between user and interaction area.
        /// </summary>
        /// <param name="args">An interaction event args.</param>
        protected override void PerformInteraction(InteractionEventArgs args)
        {
            // set rectangle of annotation
            InteractiveObject.SetRectangle(
                args.Location.X - _initialSize.Width / 2, args.Location.Y - _initialSize.Height / 2,
                args.Location.X + _initialSize.Width / 2, args.Location.Y + _initialSize.Height / 2);

            // mark that the user interacted with annotation
            args.InteractionOccured(true);

            // if any mouse button is clicked
            if (args.Action == InteractionAreaAction.Click)
            {
                // finish building of annotation
                args.InteractionFinished = true;
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Handles the Interaction event of the OfficeDocumentInteractionController.
 /// </summary>
 private void _officeDocumentInteractionController_Interaction(object sender, InteractionEventArgs e)
 {
     // if mouse is double clicked
     if (e.MouseClickCount == 2)
     {
         // find visual editor
         OfficeDocumentVisualEditor visualEditor = CompositeInteractionController.FindInteractionController <OfficeDocumentVisualEditor>(e.InteractionController);
         // if visual editor is found and has charts
         if (visualEditor != null && visualEditor.HasCharts)
         {
             // create document editor
             using (DocxDocumentEditor editor = visualEditor.CreateDocumentEditor())
             {
                 // if document has chart(s) and don't have text
                 if (editor.Charts.Length > 0 && string.IsNullOrEmpty(editor.Body.Text.Trim('\n')))
                 {
                     // open chart editor form
                     ShowChartForm(visualEditor);
                     e.InteractionOccured(false);
                 }
             }
         }
     }
 }