Example #1
0
 private void WeSayListBox_Click(object sender, EventArgs e)
 {
     if (UserClick != null)
     {
         UserClick.Invoke(sender, e);
     }
 }
Example #2
0
 void picPB_Click(object sender, EventArgs e)
 {
     if (Control.ModifierKeys == Keys.Control)      // Проверяем нажата ли клавиша Ctrl
     {
         AdminClick?.Invoke(this, EventArgs.Empty); // если да - вызываем событие AdminClick
     }
     else                                           // иначе - UserClick
     {
         UserClick?.Invoke(this, EventArgs.Empty);
     }
 }
Example #3
0
 private void OnSelectedValueChanged(String s)
 {
     try
     {
         SelectedIndex = int.Parse(s);
     }
     catch (Exception e)
     {
         SelectedIndex = 0;                  // Shouldn't happen, but set to first item if it does
     }
     if (UserClick != null)
     {
         UserClick.Invoke(this, null);
     }
 }
Example #4
0
        private void Grid_Tapped(object sender, TappedRoutedEventArgs e)
        {
            var context = (e.OriginalSource as FrameworkElement).DataContext;

            e.Handled = true;
            if (context is UserModel)
            {
                UserClick?.Invoke(this, new WeiboUserClickEventArgs((context as UserModel).ID));
            }
            else if (context is MessageModel)
            {
                ItemClick?.Invoke(this, new WeiboItemClickEventArgs(context as MessageModel));
            }
            else if (context is CommentModel)
            {
                Comment?.Invoke(this, new WeiboActionEventArgs((e.OriginalSource as FrameworkElement).DataContext as CommentModel));
            }
        }
Example #5
0
 private void Grid_Tapped(object sender, TappedRoutedEventArgs e)
 {
     UserClick?.Invoke(this, new Events.WeiboUserClickEventArgs(((sender as FrameworkElement).DataContext as UserModel).ID));
 }
        private async void richTextBlock_Tapped(object sender, TappedRoutedEventArgs e)
        {
            if (e.OriginalSource is TextBlock)
            {
                var text = (e.OriginalSource as TextBlock).Text;
                if (CheckIsTopic(text))
                {
                    e.Handled = true;
                    TopicClick?.Invoke(this, new WeiboTopicClickEventArgs(text.Replace("#", "")));
                }
                else if (CheckIsUserName(text))
                {
                    e.Handled = true;
                    UserClick?.Invoke(this, new WeiboUserClickEventArgs(text.Replace("@", "")));
                }
                else if ((e.OriginalSource as TextBlock).Tag != null)
                {
                    e.Handled = true;
                    try
                    {
                        var item = (await Core.Api.ShortUrl.Info((e.OriginalSource as TextBlock).Tag.ToString())).Urls.FirstOrDefault();
                        switch (item.Type)
                        {
                        case 39:
                        {
                            var picid = item.AnnotationList?.FirstOrDefault()?.Item?.PicIds?.FirstOrDefault();
                            if (!string.IsNullOrEmpty(picid))
                            {
                                var items = new List <ImageModel> {
                                    new ImageModel($"http://ww1.sinaimg.cn/large/{picid}.jpg")
                                };                                                                                                      //TODO: better way to get image url
                                await new ImageViewDialog(items).ShowAsync();
                            }
                            else if (item.AnnotationList?.FirstOrDefault()?.Item?.ObjectType == "video")
                            {
                                if (item.AnnotationList?.FirstOrDefault()?.Item?.OriginalUrl != null)
                                {
                                    await new WeiboVideoPlayer(item?.UrlLong, item.AnnotationList?.FirstOrDefault().Item.OriginalUrl).ShowAsync();
                                }
                                else if (item.AnnotationList?.FirstOrDefault()?.Item?.Stream?.Url != null)
                                {
                                    await new WeiboVideoPlayer(item?.UrlLong, item.AnnotationList?.FirstOrDefault()?.Item?.Stream?.Url).ShowAsync();
                                }
                                else
                                {
                                    await Launcher.LaunchUriAsync(new Uri(item.UrlLong));
                                }
                            }
                            else
                            {
                                await Launcher.LaunchUriAsync(new Uri(item.UrlLong));
                            }
                        }
                        break;

                        default:
                            await Launcher.LaunchUriAsync(new Uri(item.UrlLong));

                            break;
                        }
                    }
                    catch
                    {
                        await Launcher.LaunchUriAsync(new Uri((e.OriginalSource as TextBlock).Tag.ToString()));
                    }
                }
            }
        }
 public void InvokeUserClicked(string userName)
 {
     UserClick?.Invoke(userName);
 }
 internal void ClickEvent(object sender, Control_Subject c)
 {
     UserClick?.Invoke(sender, c); // execute event
 }
Example #9
0
 private void User_OnClick(object sender, RoutedEventArgs e)
 {
     UserClick?.Invoke();
 }
Example #10
0
 private void WeiboTextBlock_UserClick(object sender, WeiboUserClickEventArgs e)
 {
     UserClick?.Invoke(this, e);
 }