add visual feedback

This commit is contained in:
clowwindy
2015-01-12 02:44:24 +08:00
parent e878b41519
commit de0f752cc8
4 changed files with 38 additions and 5 deletions
+25 -1
View File
@@ -387,7 +387,26 @@ namespace Shadowsocks.View
var success = controller.AddServerBySSURL(result.Text);
if (success)
{
ShowConfigForm();
float minX = Int32.MaxValue, minY = Int32.MaxValue, maxX = 0, maxY = 0;
foreach (ResultPoint point in result.ResultPoints)
{
minX = Math.Min(minX, point.X);
minY = Math.Min(minY, point.Y);
maxX = Math.Max(maxX, point.X);
maxY = Math.Max(maxY, point.Y);
}
// make it 20% larger
float margin = (maxX - minX) * 0.20f;
minX -= margin;
maxX += margin;
minY -= margin;
maxY += margin;
QRCodeSplashForm splash = new QRCodeSplashForm();
splash.FormClosed += splash_FormClosed;
splash.Location = new Point((int)minX, (int)minY);
splash.Size = new Size((int)maxX - (int)minX, (int)maxY - (int)minY);
splash.Show();
return;
}
}
@@ -395,6 +414,11 @@ namespace Shadowsocks.View
}
}
void splash_FormClosed(object sender, FormClosedEventArgs e)
{
ShowConfigForm();
}
private void AutoStartupItem_Click(object sender, EventArgs e) {
AutoStartupItem.Checked = !AutoStartupItem.Checked;
if (!AutoStartup.Set(AutoStartupItem.Checked)) {