Skip to content

Commit

Permalink
更新了样式
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaotianff committed Mar 25, 2019
1 parent 1f370b8 commit d0f1db0
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 12 deletions.
5 changes: 2 additions & 3 deletions CSharpCrawler/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,16 @@ public partial class MainWindow : Window
FetchResource resourcePage = new FetchResource();
FetchDynamicResource dynamicResourcePage = new FetchDynamicResource();
FetchResourceWithDOM fetchResourceWithDOM = new FetchResourceWithDOM();
Setting setting;
Setting setting = new Setting();
Basic basic = new Basic();
InvokeWebAPI invokeWeb = new InvokeWebAPI();
FetchFile fetchFile = new FetchFile();

public MainWindow()
{
InitializeComponent();
setting = new Setting(this);

InitializeCommands();

Application.Current.MainWindow = this;
}

Expand Down
Binary file modified CSharpCrawler/ScreenShots/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions CSharpCrawler/Style/WindowStyle.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,14 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Window}">
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" x:Name="WindowBorder">
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" x:Name="WindowBorder" Background="{TemplateBinding Background}">
<!-- Background="{TemplateBinding Background}"-->
<Border.Background>
<!--<Border.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFFFF9F9" Offset="0"/>
<GradientStop Color="#FFA49B96" Offset="1"/>
</LinearGradientBrush>
</Border.Background>
</Border.Background>-->

<Grid x:Name="LayoutRoot">
<Grid.RowDefinitions>
Expand Down
2 changes: 1 addition & 1 deletion CSharpCrawler/Views/FetchFile.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private async void btn_Donwload_Click(object sender, RoutedEventArgs e)
HttpHeader httpHeader = WebUtil.GetHeader(url);
if (httpHeader.StatusCode != System.Net.HttpStatusCode.OK)
{
ShowStatusText($"{url} is not available");
ShowStatusText($"{url} is not available\r\n");
return;
}

Expand Down
2 changes: 1 addition & 1 deletion CSharpCrawler/Views/Setting.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<Separator></Separator>
<Label Content="主题"></Label>
<WrapPanel Name="GlobalSettingPanel">
<Border Width="100" Height="100" Margin="10" CornerRadius="10" Cursor="Hand">
<Border Width="100" Height="100" Margin="10" CornerRadius="10" Cursor="Hand" MouseDown="DefaultTheme_MouseDown">
<Border.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFFFF9F9" Offset="0"/>
Expand Down
23 changes: 19 additions & 4 deletions CSharpCrawler/Views/Setting.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,13 @@ namespace CSharpCrawler.Views
public partial class Setting : Page
{
string defaultImgPath = Environment.CurrentDirectory + "\\User Data\\Theme\\Default.jpg";
private readonly MainWindow mainWindow;
private GlobalDataUtil globalData = GlobalDataUtil.GetInstance();
private int ignoreCount = 0;

public Setting(MainWindow mainWindow)
public Setting()
{
InitializeComponent();

this.mainWindow = mainWindow;
InitTheme();
InitCfg();
}
Expand All @@ -44,7 +42,7 @@ private void InitTheme()
ImageBrush imageBrush = new ImageBrush();
imageBrush.ImageSource = new BitmapImage(new Uri(defaultImgPath,UriKind.Absolute));
border.Background = imageBrush;
border.MouseDown += (a, b) => { mainWindow.Background = new ImageBrush() { ImageSource = new BitmapImage(new Uri(defaultImgPath,UriKind.Absolute)) }; };
border.MouseDown += (a, b) => { Application.Current.MainWindow.Background = new ImageBrush() { ImageSource = new BitmapImage(new Uri(defaultImgPath,UriKind.Absolute)) }; };
}

private void InitCfg()
Expand Down Expand Up @@ -85,6 +83,23 @@ private void cbox_UrlCheck_Unchecked(object sender, RoutedEventArgs e)
globalData.CrawlerConfig.UrlConfig.IgnoreUrlCheck = false;
}

private void DefaultTheme_MouseDown(object sender, MouseButtonEventArgs e)
{
LinearGradientBrush gradientBrush = new LinearGradientBrush();
gradientBrush.EndPoint = new Point(0.5, 1);
gradientBrush.StartPoint = new Point(0.5, 0);
GradientStop color1 = new GradientStop();
color1.Color = (Color)(ColorConverter.ConvertFromString("#FFFFF9F9"));
color1.Offset = 0;
GradientStop color2 = new GradientStop();
color2.Color = (Color)(ColorConverter.ConvertFromString("#FFA49B96"));
color2.Offset = 1;
gradientBrush.GradientStops.Add(color1);
gradientBrush.GradientStops.Add(color2);
Application.Current.MainWindow.Background = gradientBrush;
}
#endregion


}
}
Binary file modified CSharpCrawler/bin/x64/Debug/User Data/Theme/Default.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d0f1db0

Please sign in to comment.