TriggerOptionClicked() public method

Raise the option clicked event.
public TriggerOptionClicked ( string option, bool usesTouch ) : void
option string The option that was selected.
usesTouch bool Touch is used to trigger the event.
return void
示例#1
0
 public void AutoClick(NotificationEventArgs o, object eventArgs)
 {
     if (o == null) return;
     var usesTouch = false;
     var touchEvent = eventArgs as TouchEventArgs;
     if (touchEvent != null)
     {
         usesTouch = true;
         touchEvent.Handled = true;
     }
     else
     {
         var routedEvent = eventArgs as RoutedEventArgs;
         if (routedEvent != null) routedEvent.Handled = true;
     }
     o.TriggerOptionClicked(o.AutoClickText, usesTouch);
     Remove(o);
 }
示例#2
0
        void AppStateNewNotification(NotificationEventArgs e)
        {
            Notification = e;
            e.OnStarting();          
            if (e.AutoClickInSeconds > 0)
            {
                e.Duration = TimeSpan.FromSeconds(e.AutoClickInSeconds + 1);

                var _timer = new DispatcherTimer(TimeSpan.FromSeconds(1), DispatcherPriority.Normal, (sender, args) =>
                {
                    e.AutoClickInSeconds--;
                    e.AutoClickUpdate();
                    if (e.AutoClickInSeconds > 0) return;
                    var timer = sender as DispatcherTimer;
                    timer.Stop();
                    if (e.AutoClickInSeconds > int.MinValue) e.TriggerOptionClicked(e.AutoClickText, false);
                }, Application.Current.Dispatcher);

                _timer.Start();
            }
            switch (e.Style)
            {
                case NotificationStyle.Popup:
                    AddPopup(e);
                    break;
                case NotificationStyle.FreeText:
                    Execute.OnUIThread(() =>
                    {
                        var tb = new TextBlock
                        {
                            Tag = e.Id,
                            Text = e.Text,
                            HorizontalAlignment = e.HorizontalAlignment,
                            VerticalAlignment = e.VerticalAlignment,
                            Background = e.Background,
                            Foreground = e.Foreground,
                            FontSize = e.FontSize,
                            Padding = e.Padding,
                            Margin = e.Margin,
                            FontFamily = e.FontFamily,
                            TextAlignment = e.TextAlignment
                        };
                        tb.MouseDown += (es, s) => e.TriggerClick();
                        tb.TextWrapping = TextWrapping.Wrap;

                        if (e.Size != null)
                        {
                            tb.Width = e.Size.Width;
                            tb.Height = e.Size.Height;
                        }
                        _view.bFreeText.Children.Add(tb);
                        var dt = new DispatcherTimer {Interval = e.Duration};
                        dt.Tick += (es, s) =>
                        {
                            if (_view.bFreeText.Children.Contains(tb))
                            {
                                _view.bFreeText.Children.Remove(tb);
                            }
                            dt.Stop();
                            dt = null;
                        };
                        dt.Start();
                    });
                    break;
            }
        }