Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

history images,wallpaper story,desk widget support #2

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 60 additions & 4 deletions BingWallpaper/BingWallpaper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>C:\Users\kyria\Documents\Publish\</PublishUrl>
<PublishUrl>C:\Users\jqpeng\apps\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
Expand All @@ -27,8 +27,8 @@
<TargetCulture>en-US</TargetCulture>
<ProductName>Bing Wallpaper</ProductName>
<PublisherName>Kyriacos Kyriacou</PublisherName>
<ApplicationRevision>1</ApplicationRevision>
<ApplicationVersion>1.1.0.%2a</ApplicationVersion>
<ApplicationRevision>3</ApplicationRevision>
<ApplicationVersion>1.3.2.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>
Expand All @@ -51,6 +51,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisIgnoreGeneratedCode>false</CodeAnalysisIgnoreGeneratedCode>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>bing-icon.ico</ApplicationIcon>
Expand All @@ -74,7 +75,13 @@
<PropertyGroup>
<ApplicationManifest>Properties\app.manifest</ApplicationManifest>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>false</SignAssembly>
</PropertyGroup>
<ItemGroup>
<Reference Include="HtmlAgilityPack, Version=1.8.9.0, Culture=neutral, PublicKeyToken=bd319b19eaf3b43a, processorArchitecture=MSIL">
<HintPath>..\packages\HtmlAgilityPack.1.8.9\lib\Net45\HtmlAgilityPack.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Runtime.Serialization" />
Expand All @@ -89,7 +96,18 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="DeskWidget.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="DeskWidget.Designer.cs">
<DependentUpon>DeskWidget.cs</DependentUpon>
</Compile>
<Compile Include="Helper\HistoryImage.cs" />
<Compile Include="Helper\BingImageProvider.cs" />
<Compile Include="Helper\HttpHelper.cs" />
<Compile Include="Helper\IoliuBingCrawler.cs" />
<Compile Include="Helper\StringExtensions.cs" />
<Compile Include="IWallpaperControl.cs" />
<Compile Include="Program.cs" />
<Compile Include="Helper\Settings.cs" />
<Compile Include="Helper\Wallpaper.cs" />
Expand All @@ -100,6 +118,25 @@
<DependentUpon>MainForm.cs</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Resource.zh-cn.Designer.cs">
<DependentUpon>Resource.zh-cn.resx</DependentUpon>
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
</Compile>
<Compile Include="Resource.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resource.resx</DependentUpon>
</Compile>
<Compile Include="WallpaperStoryForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="WallpaperStoryForm.Designer.cs">
<DependentUpon>WallpaperStoryForm.cs</DependentUpon>
</Compile>
<EmbeddedResource Include="DeskWidget.resx">
<DependentUpon>DeskWidget.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
Expand All @@ -113,6 +150,21 @@
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<EmbeddedResource Include="Resource.zh-cn.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resource.zh-cn.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="Resource.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resource.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="WallpaperStoryForm.resx">
<DependentUpon>WallpaperStoryForm.cs</DependentUpon>
</EmbeddedResource>
<None Include="history.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="packages.config" />
<None Include="Properties\app.manifest" />
</ItemGroup>
<ItemGroup>
Expand All @@ -121,7 +173,7 @@
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.5.2">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.5.2 %28x86 and x64%29</ProductName>
<ProductName>Microsoft .NET Framework 4.5.2 %28x86 x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
Expand All @@ -132,6 +184,10 @@
</ItemGroup>
<ItemGroup>
<Content Include="bing-icon.ico" />
<Content Include="Resources\error.jpg" />
<None Include="Resources\br_next.png" />
<None Include="Resources\sq_br_next.png" />
<None Include="Resources\br_prev.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Expand Down
122 changes: 122 additions & 0 deletions BingWallpaper/DeskWidget.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

85 changes: 85 additions & 0 deletions BingWallpaper/DeskWidget.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using BingWallpaper.Helper;


namespace BingWallpaper
{
public partial class DeskWidget : Form
{
IWallpaperControl wallpaperControl;
public DeskWidget(IWallpaperControl wallpaperControl)
{
this.wallpaperControl = wallpaperControl;
InitializeComponent();
this.wallpaperControl.OnWallpaperChange += WallpaperControl_OnWallpaperChange;

this.btnNext.Click += BtnNext_Click;
this.btnPre.Click += BtnPre_Click;

this.lblLocate.Click += LblLocate_Click;
}

private void LblLocate_Click(object sender, EventArgs e)
{
new WallpaperStoryForm(wallpaperControl.CurrentWallpaper).ShowDialog();
}

private void BtnPre_Click(object sender, EventArgs e)
{
wallpaperControl.PreWallpaper();
}

private void BtnNext_Click(object sender, EventArgs e)
{
wallpaperControl.NextWallpaper();
}

private void WallpaperControl_OnWallpaperChange(HistoryImage paper)
{
if (wallpaperControl.CurrentWallpaper != null) {
// 远眺格斯韦因斯泰因村和格斯韦因斯泰因城堡
var locate = wallpaperControl.CurrentWallpaper.Locate.Split(',').ToList().Last();
if(locate.Length == 0)
{
locate = wallpaperControl.CurrentWallpaper.Title.GetBefore("(");
}
this.lblLocate.Text = locate;
}
}

private void DeskWidget_Load(object sender, EventArgs e)
{
// this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
// 灰色背景,解决白色背景字体毛边问题
this.TransparencyKey = Color.Gray;
this.BackColor = Color.Gray;

//this.lblLocate.BackColor =
//this.btnNext.BackColor = this.btnPre.BackColor =
//Color.FromArgb(50, 50, 50, 50);
this.lblLocate.Parent = this.btnNext.Parent = this.btnPre.Parent = this.panel1;
var screenWidth = SystemInformation.WorkingArea.Width;
var screenHeight = SystemInformation.WorkingArea.Height;
this.StartPosition = FormStartPosition.Manual; //窗体的位置由Location属性决定
this.Location = (Point)new Size(screenWidth - 20 - this.Width, screenHeight - this.Height - 50);

toolTip1.AutoPopDelay = 5000;
toolTip1.InitialDelay = 1000;
toolTip1.ReshowDelay = 500;
// Force the ToolTip text to be displayed whether or not the form is active.
toolTip1.ShowAlways = true;

// Set up the ToolTip text for the Button and Checkbox.
toolTip1.SetToolTip(this.btnNext, "下一个");
toolTip1.SetToolTip(this.btnPre, "上一个");
}
}
}
Loading