private void WeSayListBox_Click(object sender, EventArgs e) { if (UserClick != null) { UserClick.Invoke(sender, e); } }
/// <summary> /// 图书有效点击次数 /// </summary> /// <param name="SiteID"></param> /// <returns></returns> public List <BookClick> GetBookClick(int SiteID) { ReadLogDAL dal = new ReadLogDAL(); List <UserClick> userClick = dal.GetUserClickList(SiteID); List <UserClick> tempList = new List <UserClick>(); UserClick temp = new UserClick(); foreach (UserClick uc in userClick) { if (temp.BookID > 0) { if (temp.BookID == uc.BookID) { if (temp.UserID == uc.UserID) { TimeSpan ts = uc.ReadTime.Date - temp.ReadTime.Date; if (ts.Days >= 28) { tempList.Add(uc); temp.ReadTime = temp.ReadTime.AddDays(28); } } else { temp.UserID = uc.UserID; temp.ReadTime = uc.ReadTime; tempList.Add(uc); } } else { temp.BookID = uc.BookID; temp.UserID = uc.UserID; temp.ReadTime = uc.ReadTime; tempList.Add(uc); } } else { temp.BookID = uc.BookID; temp.UserID = uc.UserID; temp.ReadTime = uc.ReadTime; tempList.Add(uc); } } var q = from t in tempList group t by t.BookID into g select new BookClick { BookID = g.Key, ClickCount = g.Count() }; List <BookClick> bookClick = q.OrderByDescending(s => s.ClickCount).ThenBy(s => s.BookID).ToList(); return(bookClick); }
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); } }
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); } }
public ICharacterController(int index, string racing, Vector3 pos) { string path = "Prefabs/" + racing; character = Object.Instantiate(Resources.Load(path, typeof(GameObject))) as GameObject; character.name = racing + index.ToString(); character.transform.position = pos; race = racing; onBoat = false; place = "from"; movescript = character.AddComponent(typeof(MoveController)) as MoveController; userclick = character.AddComponent(typeof(UserClick)) as UserClick; userclick.setController(this); }
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)); } }
/// <summary> /// 图书点击次数详情列表 /// </summary> /// <param name="SiteID"></param> /// <param name="BookID"></param> /// <returns></returns> public List <UserClick> GetBookClickList(int SiteID, int BookID) { ReadLogDAL dal = new ReadLogDAL(); List <UserClick> userClick = dal.GetUserClickList(SiteID, BookID); List <UserClick> tempList = new List <UserClick>(); UserClick temp = new UserClick(); foreach (UserClick uc in userClick) { if (!string.IsNullOrEmpty(temp.UserID)) { if (temp.UserID == uc.UserID) { TimeSpan ts = uc.ReadTime.Date - temp.ReadTime.Date; if (ts.Days >= 28) { tempList.Add(uc); temp.ReadTime = temp.ReadTime.AddDays(28); } } else { temp.UserID = uc.UserID; temp.ReadTime = uc.ReadTime; tempList.Add(uc); } } else { temp.UserID = uc.UserID; temp.ReadTime = uc.ReadTime; tempList.Add(uc); } } return(tempList); }
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 }
private void User_OnClick(object sender, RoutedEventArgs e) { UserClick?.Invoke(); }
private void WeiboTextBlock_UserClick(object sender, WeiboUserClickEventArgs e) { UserClick?.Invoke(this, e); }