Skip to content
This repository has been archived by the owner on Nov 23, 2022. It is now read-only.

Commit

Permalink
페이지 지정 예외 핸들링
Browse files Browse the repository at this point in the history
  • Loading branch information
rollrat committed Apr 30, 2020
1 parent ec160ac commit 2262cf8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
16 changes: 14 additions & 2 deletions GalleryExplorer/CreateNew.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,24 +75,36 @@ private void GallerySelectText_TextChanged(object sender, TextChangedEventArgs e
}
}

public int PageStartsNum;
public int PageStartsNum = 1;
private void PageStarts_TextChanged(object sender, TextChangedEventArgs e)
{
if (!int.TryParse(PageStarts.Text, out PageStartsNum))
{
MessageBox.Show("숫자만 입력해 주세요!", "Gallery Explorer", MessageBoxButton.OK, MessageBoxImage.Error);
PageStarts.Text = "1";
}

if (PageStartsNum > PageEndsNum)
{
MessageBox.Show("시작 페이지는 끝 페이지보다 작아야 합니다!", "Gallery Explorer", MessageBoxButton.OK, MessageBoxImage.Error);
PageStarts.Text = PageEndsNum.ToString();
}
}

public int PageEndsNum;
public int PageEndsNum = 1;
private void PageEnds_TextChanged(object sender, TextChangedEventArgs e)
{
if (!int.TryParse(PageEnds.Text, out PageEndsNum))
{
MessageBox.Show("숫자만 입력해 주세요!", "Gallery Explorer", MessageBoxButton.OK, MessageBoxImage.Error);
PageEnds.Text = "1";
}

if (PageStartsNum > PageEndsNum)
{
MessageBox.Show("끝 페이지는 시작 페이지보다 커야 합니다!", "Gallery Explorer", MessageBoxButton.OK, MessageBoxImage.Error);
PageEnds.Text = PageStartsNum.ToString();
}
}
}
}
6 changes: 2 additions & 4 deletions GalleryExplorer/CreateNewProgress.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,10 @@ public CreateNewProgress(string id, string name, int starts, int ends)

Task.Run(() =>
{
var page_end = ends;

var is_minor = DCGalleryList.Instance.MinorGalleryIds.Contains(id);
var articles = new List<DCInsidePageArticle>();

for (int i = starts; i <= ends; i++)
for (int i = starts, j = 1; i <= ends; i++, j++)
{
string url;
if (is_minor)
Expand All @@ -66,7 +64,7 @@ public CreateNewProgress(string id, string name, int starts, int ends)

articles.AddRange(gall.articles);

Extends.Post(() => Message2.Text = $"작업 중...[{i}/{page_end - starts + 1} | {(100.0 * i / (page_end - starts + 1)).ToString("#0.00")}%]" );
Extends.Post(() => Message2.Text = $"작업 중...[{j}/{ends - starts + 1} | {(100.0 * j / (ends - starts + 1)).ToString("#0.00")}%]" );
}

var overlap = new HashSet<string>();
Expand Down

0 comments on commit 2262cf8

Please sign in to comment.