using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.IO;
using System.Windows.Forms;
namespace BolitaAnotador
{
public partial class Form1 : Form
{
private Timer timer;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
pictureBox1.BackgroundImageLayout = ImageLayout.Stretch;
GraphicsPath path = new GraphicsPath();
path.AddEllipse(0, 0, this.Width, this.Height);
Region region = new Region(path);
this.Region = region;
//timer to handle the time when the window wil be closed
timer = new Timer();
timer.Interval = 1 * 1000; //1 seconds
timer.Tick += new EventHandler(TimerFunction);
timer.Start();
}
private void TimerFunction(object sender, EventArgs e)
{
timer.Stop();
CreateAndWriteMessage();
Close();
}
private void CreateAndWriteMessage()
{
String currentPath = System.IO.Path.GetDirectoryName(Application.ExecutablePath) + "\\" +"anotador.txt";
String nameApplication = System.AppDomain.CurrentDomain.FriendlyName + "\r\n" ;
if (!File.Exists(currentPath))
{
File.WriteAllText(currentPath, nameApplication);
return;
}
File.AppendAllText(currentPath, nameApplication);
}
}
}