Skip to content

Commit

Permalink
#3: xffish 反馈:在平板win8.1 上有这样的定位问题。
Browse files Browse the repository at this point in the history
Additionally, perform a clean on code.
  • Loading branch information
HeddaZ committed Jul 3, 2015
1 parent dfb1b5d commit 367e4d5
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 61 deletions.
17 changes: 0 additions & 17 deletions Shadowin/Implement/SwGlobal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,12 @@

namespace Shadowin.Implement
{
/// <summary>
/// Shadowin全局服务类
/// </summary>
public class SwGlobal : Global
{
/// <summary>
/// 标题
/// </summary>
public static string Title = "Shadowin 影窗浏览器";

#region 属性

/// <summary>
/// Url
/// </summary>
public static string Url
{
get
Expand All @@ -28,9 +19,6 @@ public static string Url
}
}

/// <summary>
/// 刷新时间间隔
/// </summary>
public static int RefreshInterval
{
get
Expand Down Expand Up @@ -215,11 +203,6 @@ public static string ExitHotKeyKey

#region 方法

/// <summary>
/// 获取配置参数的值
/// </summary>
/// <param name="name">参数名称</param>
/// <returns></returns>
public static string GetConfiguration(string name)
{
Plusal.Shared.Configuration configuration = new Plusal.Shared.Configuration(Enumeration.ConfigurationElement.AppSettings);
Expand Down
5 changes: 1 addition & 4 deletions Shadowin/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,11 @@ namespace Shadowin
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
bool allowStart;
Mutex mutex = new Mutex(true, SwGlobal.Title, out allowStart);
Mutex mutex = new Mutex(true, SwGlobal.Title, out allowStart); //单实例互斥
if (allowStart)
{
try
Expand Down
7 changes: 4 additions & 3 deletions Shadowin/Shadowin.Designer.cs

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

55 changes: 18 additions & 37 deletions Shadowin/Shadowin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@

namespace Shadowin
{
/// <summary>
/// 主窗体
/// </summary>
public partial class Shadowin : Form
{
private const int SizeDifference = 15;
Expand All @@ -24,7 +21,7 @@ public partial class Shadowin : Form
#region 属性

/// <summary>
/// Sw热键管理器
/// 热键管理器
/// </summary>
private HotKeyManager SwHotKeyManager
{
Expand All @@ -33,7 +30,7 @@ private HotKeyManager SwHotKeyManager
}

/// <summary>
/// 允许刷新
/// 允许自动刷新
/// </summary>
private bool RefreshEnabled
{
Expand All @@ -43,20 +40,12 @@ private bool RefreshEnabled

#endregion

/// <summary>
/// 创建主窗体
/// </summary>
public Shadowin()
{
InitializeComponent();

//初始化
this.Initialize();
}

/// <summary>
/// 销毁
/// </summary>
~Shadowin()
{
this.Close();
Expand All @@ -82,9 +71,6 @@ private void Shadowin_FormClosing(object sender, FormClosingEventArgs e)

#region 初始化

/// <summary>
/// 初始化
/// </summary>
private void Initialize()
{
#region 热键
Expand Down Expand Up @@ -253,30 +239,40 @@ private void timer1_Tick(object sender, EventArgs e)
{
this.LoadUrl();
}

private void Shadowin_VisibleChanged(object sender, EventArgs e)
{
if (this.Visible)
{
this.Shadowin_SizeChanged(sender, e);
this.LoadUrl();
}
else
{
//后台歇息
webBrowser1.Url = BlankUrl;
}
//刷新定时器

timer1.Enabled = this.Visible && this.RefreshEnabled;
}
private void LoadUrl()
{
if (webBrowser1.Url == null || webBrowser1.Url.Equals(BlankUrl))
{
webBrowser1.Url = new Uri(SwGlobal.Url);
}
else
{
webBrowser1.Refresh(WebBrowserRefreshOption.Completely);
}
}

/// <summary>
/// 重新定位
/// </summary>
private void Shadowin_SizeChanged(object sender, EventArgs e)
{
//重新定位
this.Left = Screen.PrimaryScreen.WorkingArea.Width - this.Width;
this.Top = Screen.PrimaryScreen.WorkingArea.Bottom - this.Height;

this.pictureBox1.Left = this.Width - this.pictureBox1.Width - 16 - 5;
this.pictureBox1.Top = this.Height - this.pictureBox1.Height - 5;
}

private void pictureBox1_Click(object sender, EventArgs e)
Expand All @@ -295,20 +291,5 @@ private void pictureBox1_Click(object sender, EventArgs e)
Process.Start("iexplore.exe", "https://github.com/heddaz");
}
}

/// <summary>
/// 加载Url
/// </summary>
private void LoadUrl()
{
if (webBrowser1.Url == null || webBrowser1.Url.Equals(BlankUrl))
{
webBrowser1.Url = new Uri(SwGlobal.Url);
}
else
{
webBrowser1.Refresh(WebBrowserRefreshOption.Completely);
}
}
}
}

0 comments on commit 367e4d5

Please sign in to comment.