Torna al Thread
public Form1()
{
InitializeComponent();
}
private MemoryMappedFile mmf;
private void Form1_Load(object sender, EventArgs e)
{
try
{
mmf = MemoryMappedFile.OpenExisting("COMMTEST");
timer1.Start();
}
catch
{
MessageBox.Show("Applicazione principale non avviata", string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void timer1_Tick(object sender, EventArgs e)
{
Mutex mutex = Mutex.OpenExisting("testmutex");
//mutex.WaitOne();
using (MemoryMappedViewStream stream = mmf.CreateViewStream(1, 0))
{
BinaryReader reader = new BinaryReader(stream);
double val = reader.ReadDouble();
label1.Text = string.Format("{0}", val);
}
}