예제 #1
0
        // Singleton pattern
        public static MetatagManager returnInstance()
        {
            if (metatagManager == null)
            {
                metatagManager = new MetatagManager();
            }

            return metatagManager;
        }
예제 #2
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            timer1.Interval = Configuration.PAUSA_STANDARD;

                    start = new WSN();

                    start.start();

                    if (start.getRelevationString() == null)
                    {
               	 		timer1.Enabled = false;
                        MessageBox.Show("No more relevations available.");
                    }

                    MetatagManager metatagManager = new MetatagManager();
                    Metatag metatag = metatagManager.showMetatag();

                    if (metatag.getRoomCode() == "R001" && (metatag.getRadioactivityInterpretation() == "ALERT" || metatag.getTemperatureInterpretation() == "ALERT"))
               			PlaySound(path + @"\GiuliaAllarmeLocale1.wav", IntPtr.Zero, SND_FILENAME | SND_SYNC);
                    else if (metatag.getRoomCode() == "R002" && (metatag.getRadioactivityInterpretation() == "ALERT" || metatag.getTemperatureInterpretation() == "ALERT"))
               			PlaySound(path + @"\GiuliaAllarmeLocale2.wav", IntPtr.Zero, SND_FILENAME | SND_SYNC);

                    // Show a radioactivity metatag
                    if(metatag.getRadioactivityInterpretation() == "ALERT")
                    {
                        StateControl1.Image = imageAlert;
                        Ora1.Text = metatag.GetOra().Substring(0, 5);
                        ValMax1.Text = metatag.getMaximumRadioactivityValue().ToString();
                        Unita1.Text = metatag.getRadioactivityUnits();
                        Fault1.Text = metatag.getTotalFaultsInRadioactivityLevels() + "/5";
                        Ora1.ForeColor = Color.Red;
                        ValMax1.ForeColor = Color.Red;
                        Unita1.ForeColor = Color.Red;
                        Fault1.ForeColor = Color.Red;
                    }
                    else if (metatag.getRadioactivityInterpretation() == "NOALERT")
                    {
                        StateControl1.Image = imageNoAlert;
                        Ora1.Text = metatag.getTime().Substring(0, 5);
                        ValMax1.Text = metatag.getMaximumRadioactivityValue().ToString();
                        Unita1.Text = metatag.getRadioactivityUnits();
                        Fault1.Text = metatag.getTotalFaultsInRadioactivityLevels() + "/5";
                        Ora1.ForeColor = Color.Green;
                        ValMax1.ForeColor = Color.Green;
                        Unita1.ForeColor = Color.Green;
                        Fault1.ForeColor = Color.Green;
                    }

                    // Show a temperature metatag
                    if (metatag.getTemperatureInterpretation() == "ALERT")
                    {
                        StateControl2.Image = imageAlert;
                        Ora2.Text = metatag.geTime().Substring(0, 5);
                        ValMax2.Text = metatag.getMaximumTemperatureValue().ToString();
                        Unita2.Text = metatag.getTemperatureUnits();
                        Fault2.Text = metatag.getTotalFaultsInTemperatureLevels() + "/3";
                        Ora2.ForeColor = Color.Red;
                        ValMax2.ForeColor = Color.Red;
                        Unita2.ForeColor = Color.Red;
                        Fault2.ForeColor = Color.Red;
                    }
                    else if (metatag.getTemperatureInterpretation() == "NOALERT")
                    {
                 		StateControl2.Image = imageNoAlert;
                 		Ora2.Text = metatag.getTime().Substring(0, 5);
                 		ValMax2.Text = metatag.getMaximumTemperatureValue().ToString();
                 		Unita2.Text = metatag.getTemperatureUnits();
                 		Fault2.Text = metatag.getTotalFaultsInTemperatureLevels() + "/3";
                 		Ora2.ForeColor = Color.Green;
                 		ValMax2.ForeColor = Color.Green;
                 		Unita2.ForeColor = Color.Green;
                 		Fault2.ForeColor = Color.Green;
                    }
        }
예제 #3
0
 private void sendRelevationToMetatagManager(Relevation relevation)
 {
     newMetatagManager = new MetatagManager();
             newMetatagManager.setMetatagAttributes(relevation);
 }