Do I have to manage reference counts of ApplicationView like MultipleViews sample? RRS feed

  • 質問

  • I dived into MultipleViews sample,then I found managing reference counts at ViewData.cs.

    It seems like quite complex...

    Do I have to manage like this?

    Dose ApplicationView.Consolidated event happens many times?

    Why it use lock instead of calling dispatcher.RunAsync? Calling dispatcher.RunAsync and accessing member value from lambda inside it guarantees just one thread access to member value without lock.

    Why it checks refCount before calling FinalizeRelease? StartViewInUse may be called after ApplicationView.Consolidated was called?

    For me it looks like unnecessarily complex...


    2013年12月28日 18:44


  • which sample are you using?

    are you doing windows 8 development or windows 8.1?

    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    2013年12月28日 19:09
  • Sorry,I'm doing 8.1 sample.


    2013年12月29日 2:02
  • ahh the multi window sample. yes i agree looks horrible complicated. you can strip much of the code but there is some nice functionality in that refcount so i would first try to build an app your self with multi window support that does the bare minium to get it working. then try to understand the sample.

    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    2013年12月30日 9:55
  • My code worked with striped code,but when refcount is needed?

    This question is equal to when VisibilityChanged event is called concurrently?

    I don't understand who can access CoreApplicationView and when VisibilityChanged is called.I'll investigate them...


    2014年1月3日 6:30