Exemplo n.º 1
0
 /// <summary>
 /// Получить событие.
 /// </summary>
 /// <param name="sender">Отправитель.</param>
 /// <param name="e">Параметр события.</param>
 /// <param name="channel">Канал.</param>
 public void ReceiveWeakEvent(object sender, IWeakEventChannel channel, object e)
 {
     if (channel?.Id == Shell.IsNarrowViewChangedId)
     {
         UpdateNarrowLayout();
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Получить событие.
 /// </summary>
 /// <param name="sender">Отправитель.</param>
 /// <param name="e">Параметр события.</param>
 /// <param name="channel">Канал.</param>
 public void ReceiveWeakEvent(object sender, IWeakEventChannel channel, object e)
 {
     if (channel?.Id == AppEvents.AppResumeId)
     {
         AppResume?.Invoke(this, e);
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// Получить событие.
 /// </summary>
 /// <param name="sender">Отправитель.</param>
 /// <param name="e">Параметр события.</param>
 /// <param name="channel">Канал.</param>
 public void ReceiveWeakEvent(object sender, IWeakEventChannel channel, object e)
 {
     if (channel?.Id == Shell.IsNarrowViewChangedId)
     {
         StyleChanged?.Invoke(this, EventArgs.Empty);
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Получить событие.
 /// </summary>
 /// <param name="sender">Отправитель.</param>
 /// <param name="e">Параметр события.</param>
 /// <param name="channel">Канал.</param>
 public void ReceiveWeakEvent(object sender, IWeakEventChannel channel, object e)
 {
     if (channel?.Id == AppEvents.AppResumeId)
     {
         AppResume?.Invoke(this, e);
     }
     if (channel?.Id == AppEvents.AppSuspendId)
     {
         OnSuspending(e as SuspendingEventArgs);
     }
 }
 /// <summary>
 /// Получить событие.
 /// </summary>
 /// <param name="sender">Отправитель.</param>
 /// <param name="e">Параметр события.</param>
 /// <param name="channel">Канал.</param>
 void IWeakEventCallback.ReceiveWeakEvent(object sender, IWeakEventChannel channel, object e)
 {
     var l = e as LinkClickEventArgs;
     if (channel?.Id == ViewModelEvents.LinkClickId && l?.Link != null)
     {
         AppHelpers.ActionOnUiThread(async () =>
         {
             await HandleNavigationLinkClick(sender, l);
         }, true);
     }
 }
Exemplo n.º 6
0
 /// <summary>
 /// Получить событие.
 /// </summary>
 /// <param name="sender">Отправитель.</param>
 /// <param name="channel">Канал.</param>
 /// <param name="e">Параметр события.</param>
 public async void ReceiveWeakEvent(object sender, IWeakEventChannel channel, object e)
 {
     var disp = AppHelpers.Dispatcher;
     if (disp == null)
     {
         return;
     }
     await disp.DispatchAsync(() =>
     {
         try
         {
             WeakEventReceived?.Invoke(sender, new WeakEventArgs(e, channel));
         }
         catch (Exception ex)
         {
             DebugHelper.BreakOnError(ex);
         }
     });
 }
Exemplo n.º 7
0
 /// <summary>
 /// Получить событие.
 /// </summary>
 /// <param name="sender">Отправитель.</param>
 /// <param name="e">Параметр события.</param>
 /// <param name="channel">Канал.</param>
 public void ReceiveWeakEvent(object sender, IWeakEventChannel channel, object e)
 {
     if (channel?.Id == Shell.IsNarrowViewChangedId)
     {
         SetContentMargin();
     }
 }
Exemplo n.º 8
0
 static Shell()
 {
     IsNarrowViewChangedId = new Guid("{B87399B2-75DB-4F41-BE66-4B14ACCB295A}");
     IsNarrowViewChanged = new WeakEventChannel(IsNarrowViewChangedId);
     LinkNavigationManager = new LinkNavigationManager();
 }
Exemplo n.º 9
0
 /// <summary>
 /// Конструктор.
 /// </summary>
 /// <param name="channel">Канал.</param>
 public WeakEventCallback(IWeakEventChannel channel)
 {
     this.channel = new WeakReference<IWeakEventChannel>(channel);
     token = channel.AddCallback(this);
 }
Exemplo n.º 10
0
 /// <summary>
 /// Получить событие.
 /// </summary>
 /// <param name="sender">Отправитель.</param>
 /// <param name="e">Параметр события.</param>
 /// <param name="channel">Канал.</param>
 public void ReceiveWeakEvent(object sender, IWeakEventChannel channel, object e)
 {
     if (channel?.Id == Shell.IsNarrowViewChangedId)
     {
         AppHelpers.DispatchAction(() =>
         {
             UpdateAnimationData(null, null, null, null);
             return Task.CompletedTask;
         });
     }
 }
 /// <summary>
 /// Получить событие.
 /// </summary>
 /// <param name="sender">Отправитель.</param>
 /// <param name="e">Параметр события.</param>
 /// <param name="channel">Канал.</param>
 public void ReceiveWeakEvent(object sender, IWeakEventChannel channel, object e)
 {
     if (channel?.Id == AppEvents.AppResumeId)
     {
         AppHelpers.ActionOnUiThread(() =>
         {
             ModelResumed?.Invoke(this, EventArgs.Empty);
             return Task.FromResult(true);
         });
     }
 }
 /// <summary>
 /// Получить событие.
 /// </summary>
 /// <param name="sender">Отправитель.</param>
 /// <param name="e">Параметр события.</param>
 /// <param name="channel">Канал.</param>
 public void ReceiveWeakEvent(object sender, IWeakEventChannel channel, object e)
 {
     if (channel?.Id == Shell.IsNarrowViewChangedId)
     {
         SizeStateChanged();
     }
 }