none
How to initiate a button click of another page in a method from another cs file? RRS feed

  • Question

  • I have a cs file for Drag drop Element. In the Method after the drop is completed (OnManipulationCompleted) I would like to initiate/trigger the 3 button clicks from another WPF page which has 3 buttons within the OnManipulationCompleted method 

    namespace KinectDemos
    {
        public class DragDropElementController : IKinectManipulatableController
        {
            private ManipulatableModel _inputModel;
            private KinectRegion _kinectRegion;
            private DragDropElement _dragDropElement;
            private bool _disposedValue;
    
            public DragDropElementController(IInputModel inputModel, KinectRegion kinectRegion)
            {
                _inputModel = inputModel as ManipulatableModel;
                _kinectRegion = kinectRegion;
                _dragDropElement = _inputModel.Element as DragDropElement;
    
                _inputModel.ManipulationStarted += OnManipulationStarted;
                _inputModel.ManipulationUpdated += OnManipulationUpdated;
                _inputModel.ManipulationCompleted += OnManipulationCompleted;
            }
    
            private void OnManipulationCompleted(object sender,
                KinectManipulationCompletedEventArgs kinectManipulationCompletedEventArgs)
            {**HERE I WOULD LIKE TO INITIATE THE BUTTON CLICKS**
            }

    The Other Wpf page which has these buttons having function for three buttons .After each button drop it would navigate to another page.

    Public partial class Beauty : Usercontrol
    {
        Public void Tip_Click (object sender, RoutedEventArgs e)
        { 
        Afterdrop page1 = new Afterdrop
        this.content = page1;
        }
    
        Public void Tricks_Click (object sender, RoutedEventArgs e)
        { 
        Afterdrop2 page2 = new Afterdrop2
        this.content = page2;
        }
    
        Public void Invent_Click (object sender, RoutedEventArgs e)
        { 
        Afterdrop3 page3 = new Afterdrop3
        this.content = page3;
        }
    
    
    }

    How do I implement this?

    Friday, August 19, 2016 1:45 PM

All replies

  • Not really a Kinect question but anyhow.

    I don't think you should mess with the DragDropElementController class.

    You should have a different class(say BeautyController for simplicity) that receives OnCompleted events from DragDropElementController and deals with the Beauty control,meaning you should add an event to which BeautyController hooks to. It's then , BeautyController's job to manage which click is to be executed, which is totally unrelated to Kinect stuff.

    That way Kinect WPF stuff are in one place and Kinect-Independent stuff in their own little bubble.

    This is the quick and dirty way to make it work. There are many better suited solutions, but like I said, not really the point of this forum.

    Friday, August 19, 2016 6:51 PM