コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NetworkConnectionStateTrigger"/> class.
        /// </summary>
        public NetworkConnectionStateTrigger()
        {
            var weakEvent =
                new WeakEventListener <NetworkConnectionStateTrigger, object>(this)
            {
                OnEventAction  = (instance, source) => NetworkInformation_NetworkStatusChanged(source),
                OnDetachAction = (instance, weakEventListener) => NetworkInformation.NetworkStatusChanged -= weakEventListener.OnEvent
            };

            NetworkInformation.NetworkStatusChanged += weakEvent.OnEvent;
            UpdateState();
        }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OrientationStateTrigger"/> class.
 /// </summary>
 public OrientationStateTrigger()
 {
     if (!Windows.ApplicationModel.DesignMode.DesignModeEnabled)
     {
         var weakEvent =
             new WeakEventListener <OrientationStateTrigger, DisplayInformation, object>(this)
         {
             OnEventAction  = (instance, source, eventArgs) => OrientationStateTrigger_OrientationChanged(source, eventArgs),
             OnDetachAction = (instance, weakEventListener) => DisplayInformation.GetForCurrentView().OrientationChanged -= weakEventListener.OnEvent
         };
         DisplayInformation.GetForCurrentView().OrientationChanged += weakEvent.OnEvent;
     }
 }
コード例 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UserInteractionModeTrigger"/> class.
 /// </summary>
 public UserInteractionModeTrigger()
 {
     if (!Windows.ApplicationModel.DesignMode.DesignModeEnabled)
     {
         var weakEvent =
             new WeakEventListener <UserInteractionModeTrigger, object, WindowSizeChangedEventArgs>(this)
         {
             OnEventAction  = (instance, source, eventArgs) => UserInteractionModeTrigger_SizeChanged(source, eventArgs),
             OnDetachAction = (instance, weakEventListener) => Window.Current.SizeChanged -= weakEventListener.OnEvent
         };
         Window.Current.SizeChanged += weakEvent.OnEvent;
         UpdateTrigger(InteractionMode);
     }
 }