update to v0.1.2
This commit is contained in:
parent
ddd2ea9eb5
commit
ea448c9fe1
16 changed files with 1072 additions and 6773 deletions
|
@ -24,6 +24,12 @@ public class PopUp : Form
|
|||
|
||||
private List<string> urls;
|
||||
|
||||
private char[] poptypearr;
|
||||
|
||||
private Utils Utils;
|
||||
|
||||
private char lastchar = 'n';
|
||||
|
||||
private IContainer components;
|
||||
|
||||
private AxWindowsMediaPlayer axWindowsMediaPlayer1;
|
||||
|
@ -36,27 +42,44 @@ public class PopUp : Form
|
|||
|
||||
public PopUp(string url)
|
||||
{
|
||||
Utils = new Utils();
|
||||
urls = new List<string>();
|
||||
InitializeComponent();
|
||||
if (ConfigurationManager.AppSettings["Clickthroughpop"] == "True")
|
||||
string poptypestr = "nnnn";
|
||||
if (ConfigurationManager.AppSettings["PopType"] != null)
|
||||
{
|
||||
poptypestr = ConfigurationManager.AppSettings["PopType"];
|
||||
}
|
||||
poptypearr = poptypestr.ToCharArray();
|
||||
if (poptypearr[0] == 's')
|
||||
{
|
||||
base.Opacity = 0.5;
|
||||
}
|
||||
if (poptypearr[1] == 't')
|
||||
{
|
||||
uint initialStyle = GetWindowLong(base.Handle, -20);
|
||||
SetWindowLong(base.Handle, -20, initialStyle | 0x80000 | 0x20);
|
||||
}
|
||||
run_url = url;
|
||||
switch (run_url.Substring(run_url.Length - 3, 3))
|
||||
else if (poptypearr[1] == 'c')
|
||||
{
|
||||
base.Click += clickable;
|
||||
axWindowsMediaPlayer1.ClickEvent += AxWindowsMediaPlayer1_ClickEvent;
|
||||
}
|
||||
if (poptypearr[2] == 'm' && poptypearr[3] != 'n')
|
||||
{
|
||||
Timer timer = new Timer();
|
||||
timer.Interval = (int)TimeSpan.FromSeconds(2.0).TotalMilliseconds;
|
||||
timer.Tick += popup_tick2;
|
||||
timer.Start();
|
||||
}
|
||||
if (Utils.IsWebPage(url))
|
||||
{
|
||||
case "com":
|
||||
case ".uk":
|
||||
case "org":
|
||||
Process.Start(new ProcessStartInfo
|
||||
{
|
||||
FileName = url,
|
||||
UseShellExecute = true
|
||||
});
|
||||
Close();
|
||||
break;
|
||||
}
|
||||
tmr = new Timer();
|
||||
tmr.Tick += popup_tick;
|
||||
|
@ -73,20 +96,42 @@ public class PopUp : Form
|
|||
}
|
||||
}
|
||||
|
||||
private void AxWindowsMediaPlayer1_ClickEvent(object sender, _WMPOCXEvents_ClickEvent e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
public void add_url(string url)
|
||||
{
|
||||
urls.Add(url);
|
||||
}
|
||||
|
||||
public void clickable(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
public void popup_tick2(object sender, EventArgs e)
|
||||
{
|
||||
Random random = new Random();
|
||||
int screenWidth = Screen.PrimaryScreen.Bounds.Width;
|
||||
int screenHeight = Screen.PrimaryScreen.Bounds.Height;
|
||||
int randomX = random.Next(0, screenWidth - base.Width);
|
||||
int randomY = random.Next(0, screenHeight - base.Height);
|
||||
base.Location = new Point(randomX, randomY);
|
||||
}
|
||||
|
||||
public void popup_tick(object sender, EventArgs e)
|
||||
{
|
||||
if (urls.Count > 0)
|
||||
{
|
||||
run_url = urls[0];
|
||||
urls.RemoveAt(0);
|
||||
axWindowsMediaPlayer1.Visible = true;
|
||||
axWindowsMediaPlayer1.URL = run_url;
|
||||
axWindowsMediaPlayer1.Ctlenabled = false;
|
||||
axWindowsMediaPlayer1.uiMode = "None";
|
||||
axWindowsMediaPlayer1.stretchToFit = true;
|
||||
axWindowsMediaPlayer1.settings.autoStart = true;
|
||||
axWindowsMediaPlayer1.settings.setMode("loop", varfMode: true);
|
||||
}
|
||||
|
@ -98,16 +143,24 @@ public class PopUp : Form
|
|||
|
||||
private void PopUp_Load(object sender, EventArgs e)
|
||||
{
|
||||
Random random = new Random();
|
||||
int screenWidth = Screen.PrimaryScreen.Bounds.Width;
|
||||
int screenHeight = Screen.PrimaryScreen.Bounds.Height;
|
||||
int randomX = random.Next(0, screenWidth - base.Width);
|
||||
int randomY = random.Next(0, screenHeight - base.Height);
|
||||
base.StartPosition = FormStartPosition.Manual;
|
||||
base.Location = new Point(randomX, randomY);
|
||||
if (poptypearr[3] == 'f')
|
||||
{
|
||||
base.WindowState = FormWindowState.Maximized;
|
||||
}
|
||||
else
|
||||
{
|
||||
Random random = new Random();
|
||||
int screenWidth = Screen.PrimaryScreen.Bounds.Width;
|
||||
int screenHeight = Screen.PrimaryScreen.Bounds.Height;
|
||||
int randomX = random.Next(0, screenWidth - base.Width);
|
||||
int randomY = random.Next(0, screenHeight - base.Height);
|
||||
base.StartPosition = FormStartPosition.Manual;
|
||||
base.Location = new Point(randomX, randomY);
|
||||
}
|
||||
axWindowsMediaPlayer1.URL = run_url;
|
||||
axWindowsMediaPlayer1.Ctlenabled = false;
|
||||
axWindowsMediaPlayer1.uiMode = "None";
|
||||
axWindowsMediaPlayer1.stretchToFit = true;
|
||||
axWindowsMediaPlayer1.settings.autoStart = true;
|
||||
axWindowsMediaPlayer1.settings.setMode("loop", varfMode: true);
|
||||
tmr.Start();
|
||||
|
@ -133,7 +186,6 @@ public class PopUp : Form
|
|||
this.axWindowsMediaPlayer1.Location = new System.Drawing.Point(0, 0);
|
||||
this.axWindowsMediaPlayer1.Name = "axWindowsMediaPlayer1";
|
||||
this.axWindowsMediaPlayer1.OcxState = (System.Windows.Forms.AxHost.State)resources.GetObject("axWindowsMediaPlayer1.OcxState");
|
||||
this.axWindowsMediaPlayer1.Size = new System.Drawing.Size(800, 450);
|
||||
this.axWindowsMediaPlayer1.TabIndex = 0;
|
||||
base.AutoScaleDimensions = new System.Drawing.SizeF(7f, 15f);
|
||||
base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue