Seek by clicking on video progress bar (2 Viewers)

osre

Retired Team Member
  • Premium Supporter
  • December 14, 2014
    775
    387
    Home Country
    Germany Germany
    As my next contribution I wanted to look into seeking by clicking on the video progress bar.
    As far as I seen it, the progress bar is defined by each skin in MediaStyles.xml (like line 141 und 302 in Titanium).
    I looked a bit through the code, but it looks like that ProgressBar and non of its base classes (Control, FrameworkElemet, UIElement) have a MouseClick or MouseDown/Up event, only MouseEnter/Leave/Move).
    In WPF MouseDown/Up events are implemented in UIElement.
    But somehow I can not even find, how clicking a button is implemented!?
     

    morpheus_xx

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    Mouse click is only implemented in buttons using a CommandStencil.
    I recently added very basic touch support and in ApolloOne skin I also stumbled upon missing mouse events.
    So a proper implementation similar to WPF would be very welcome!
     

    osre

    Retired Team Member
  • Premium Supporter
  • December 14, 2014
    775
    387
    Home Country
    Germany Germany
    Ok, I think I start with mouse events then.
    Can I subscribe to events in XAML just like in WPF, or would it look like the commands for buttons?[DOUBLEPOST=1419708160][/DOUBLEPOST]One more question: Should I use the FireEvent() method like used for MouseEnter/Leave in Framework element, or individual events like in WPF.
    Individual events would mean to implement the event bubbling, ... for all of them.
    But the FireEvent has no sender and no original source like in WPF.
    Cloning the RoutedEvents from WPF might get quite a challenge.
     
    Last edited:

    morpheus_xx

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    I am not at home till Monday and don't know this special part too well. I hope to be able to help you understanding the differences between WPF and MPF. In general I tried to make MPF and xaml more compatible recently.
     

    osre

    Retired Team Member
  • Premium Supporter
  • December 14, 2014
    775
    387
    Home Country
    Germany Germany
    I'll look into WPF RoutingEvents in the meantime. May be I can implement something similar. The MPF FireEvent is a good beginning already. Only the firing of the individual events on every object and some parameters are missing.
     

    morpheus_xx

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    I think there are already some kind of routed events and different strategies. We have triggers that react on Screen.Show event. But I guess the implementation might not be completed yet.
     

    osre

    Retired Team Member
  • Premium Supporter
  • December 14, 2014
    775
    387
    Home Country
    Germany Germany
    I have a basic prototype of the event management done.
    Registering events, tunneling bubbeling, class handlers, ... all done.
    Now I'm working on the XAML integration.
    There is already a basic framework for handling events. There is the method
    "static Delegate parser_GetEventHandler(IParserContext context, MethodInfo signature, string value)" in XamlLodaer.cs:101.
    The problem is, that there is no code behind file, like in WPF.
    Where should this method look for the event handler ?
    I thought about an markup extension like "{Command ...}", where you can bind it to the model like:
    XML:
    <Border MouseDown="{EventHandler Source={StaticResource Model},Path=MyMouseDownEventHandler}">...

    Code:
    public void MyMouseDownEventHandler(object source, MouseButtonEventArgs e)
    {
    ...
    }

    Any other Idea?
    Or to which class should an event be bound by default (instead of the code behind class as in WPF)?
     

    morpheus_xx

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    Thanks for your work (y) I'm trying to catchup the recent changes soon.

    We already have one custom control to capture mouse events: UserInputCapture. We use it only for DVD fullscreen playback, where mouse moves need to be forwared to DVDNavigator DirectShow filter.

    I'd like to keep the same structure, maybe it fits generally
     

    osre

    Retired Team Member
  • Premium Supporter
  • December 14, 2014
    775
    387
    Home Country
    Germany Germany
    I looked at it, and find it kind a strange.
    If I understand it correctly, ICommandStencil is more or less a wrapped delegate.
    The UserInputCapture forwards some event like actions (like OnMouseMove) to this stencil if, where it has a specific property for, which is setable from XAML.
    My approach would not need any special programming.
    You simply define an event handler as usual, and assign it in XAML like a property. But since there is no code behind class, I would have done it like an Binding (or like the CommandExtension).
    To do so I would create the EventHandlerExtension, which would be a subclass of CommandBaseMarkupExtension.
    I'll implement it and post a patch, you can then decide if you like it or not.[DOUBLEPOST=1419877757][/DOUBLEPOST]To be honest, my EventHandlerExtension can be replaced by CommandStencilExtension.
     

    Users who are viewing this thread

    Top Bottom