Пример #1
0
		private void FetchPageCompleted(object sender, BaseEventArgs e)
		{
			IsLoading = false;
			if (e.Error != null)
			{
				LilyToast toast = new LilyToast();
				toast.ShowNetworkError();
				return;
			}
			LilyBBS.API.Page page = e.Result as LilyBBS.API.Page;
			prevStart = page.PrevStart;
			foreach (var i in page.HeaderList)
				itemsSource.Add(i);
		}
Пример #2
0
		private void FetchTopicCompleted(object sender, BaseEventArgs e)
		{
			IsLoading = false;
			if (e.Error != null)
			{
				LilyToast toast = new LilyToast();
				toast.ShowNetworkError();
				return;
			}
			/*
			 * HTMLAgilityPack fails often!
			 */
			try
			{
				Topic t = e.Result as Topic;
				NextStart = t.nextStart;
				foreach (var i in t.PostList)
					items.Add(i);
			}
			catch (Exception exc)
			{
				
			}
		}
Пример #3
0
		private void LoadMoreButton_Click(object sender, RoutedEventArgs e)
		{
			if (NextStart == null)
			{
				LilyToast toast = new LilyToast("再也没有了");
				toast.Show();
				return;
			}
			LoadMore(board, pid, NextStart);
		}
Пример #4
0
		private void ShowError()
		{
			LilyToast toast = new LilyToast();
			toast.ShowNetworkError();
		}
Пример #5
0
		static void OnBodyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
		{
			StackPanel panel = (obj as PostControl).BodyPanel;
			panel.Children.Clear();
			string text = args.NewValue as string;
			try
			{

				var lines = text.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
				string i;
				int prevLen = MAX_LINE_CHARS + 1;
				TextBlock block = buildTextBlock();
				foreach (var line in lines)
				{
					i = line.Trim();
					if (i.Length == 0) continue;
					if (isPicture(i))
					{
						addTextBlock(panel, block);
						block = buildTextBlock();
						prevLen = 0;
						var img = buildImage(i);
						panel.Children.Add(img);
					}
					else if (isUrl(i))
					{
						HyperlinkButton link = new HyperlinkButton();
						link.HorizontalAlignment = HorizontalAlignment.Left;
						link.Margin = new Thickness(0, 3, 0, 3);
						link.TargetName = "_blank";
						link.Content = i;
						link.NavigateUri = new Uri(i);
						panel.Children.Add(link);
					}
					else
					{
						/*
						if (prevLen > MAX_LINE_CHARS)
							block.Text = block.Text + i;
						else
							block.Text = block.Text + "\n" + i;
						 */
						if (block.Text.Length > 0)
							block.Text = block.Text + "\n" + i;
						else
							block.Text = block.Text + i;
						prevLen = i.Length;
						// Defect: next line might be appended to previous block
						if (block.ActualHeight > MAX_HEIGHT) //|| block.ActualWidth > MAX_HEIGHT*8)
						{
							addTextBlock(panel, block);
							block = buildTextBlock();
							prevLen = 0;
						}
					}
				}
				addTextBlock(panel, block);
			}
			catch (Exception exc)
			{
				LilyToast toast = new LilyToast();
				toast.ShowContentError();
			}
		}
Пример #6
0
		private void ShowError(LongListSelector content, TextBlock error)
		{
			content.Visibility = Visibility.Collapsed;
			error.Visibility = Visibility.Visible;
			LilyToast toast = new LilyToast();
			toast.Message = (app.Resources["NetworkErrorMessage"] as NetworkErrorMessage).Message;
			toast.Show();
		}
Пример #7
0
 private void SearchBoardButton_Click(object sender, RoutedEventArgs e)
 {
     String inputText = SearchTextBox.Text;
     String boardName = null;
     List<String> boardList = BoardManager.GetBoardList();
     foreach (String board in boardList)
     {
         if (String.Compare(inputText, board, StringComparison.OrdinalIgnoreCase) == 0)
             boardName = board;
     }
     if (boardName == null)
     {
         LilyToast toast = new LilyToast();
         toast.ShowInputBoardError();
     }
     else
     {
         gotoBoard(boardName);
     }
 }