Exemplo n.º 1
0
        /// <summary>
        /// Selezionata la checklist la costruisce OOP
        /// </summary>
        /// <param name="checkListName"></param>
        /// <returns></returns>
        public static Checklist ReadChecklist(string checkListName)
        {
            FileInfo fi = new FileInfo(Path.Combine(Path.Combine(Directory.GetCurrentDirectory(),CHECKLIST_RELATIVE_PATH) , checkListName + "." + CHECKLIST_FILE_EXTENSION));
            if (!fi.Exists) return null;

            XmlTextReader reader = new XmlTextReader( Path.Combine(Path.Combine(Directory.GetCurrentDirectory(),CHECKLIST_RELATIVE_PATH) , checkListName + "." + CHECKLIST_FILE_EXTENSION));
            Checklist toBeRet = new Checklist();
            toBeRet.Phases = new List<ChecklistPhase>();

            while (reader.Read())
            {
                XmlNodeType nType = reader.NodeType;
                if (nType == XmlNodeType.Element)
                {
                    if (reader.Name == "aircraft")
                    {
                        toBeRet.AircraftIcaoCode = reader.GetAttribute("icao");
                        toBeRet.Vr = reader.GetAttribute("Vr");
                        toBeRet.Vs = reader.GetAttribute("Vs");
                        toBeRet.Vapp = reader.GetAttribute("Vapp");
                        toBeRet.Vf0 = reader.GetAttribute("Vf0");
                        toBeRet.Vldg = reader.GetAttribute("Vldg");
                        toBeRet.Vne = reader.GetAttribute("Vne");
                    }
                    if (reader.Name == "phase")
                    {
                        ChecklistPhase phase = new ChecklistPhase();
                        phase.PhaseName = reader.GetAttribute("desc");
                        phase.Items = new List<ChecklistItem>();
                        toBeRet.Phases.Add(phase);
                    }
                    if (reader.Name == "chklstItem")
                    {
                        ChecklistItem item = new ChecklistItem();
                        item.Description = reader.GetAttribute("desc");
                        item.Value = reader.GetAttribute("value");
                        if (reader.GetAttribute("delay") != null)
                        {
                            item.Delay = int.Parse(reader.GetAttribute("delay"));
                        }
                        toBeRet.Phases[toBeRet.Phases.Count - 1].Items.Add(item);
                    }
                }
            }
            reader.Close();//issue 70
            return toBeRet;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Legge le velocità caratteristiche dell'aereomobile a cui appartiene la checklist
        /// </summary>
        /// <param name="cklst"></param>
        public void ReadAllSpeeds(Checklist cklst)
        {
            backgroundSpeaker = new SpeakingThread(Controller);

            if (cklst == null)
            {
                string s = "Checklist unavailable, select it on config section";
                backgroundSpeaker.AddInSpeakingBuffer(s, s);
                backgroundThread = new Thread(new ThreadStart(backgroundSpeaker.Run));
                backgroundThread.IsBackground = true;//issue 107
                backgroundThread.Start();
                return;
            }


            StringBuilder toBeSpeeked = new StringBuilder();
            toBeSpeeked.Append(CARACTERISTIC_SPEEDS);
            toBeSpeeked.Append(SSML_PAUSE_SHORT);
            toBeSpeeked.Append(string.Format(TEMPLATE_READ_COUPLE, "V rotate" , cklst.Vr));

            backgroundSpeaker.AddInSpeakingBuffer(toBeSpeeked.ToString(), "V rotate: " + cklst.Vr);
            toBeSpeeked = new StringBuilder();

            toBeSpeeked.Append(SSML_PAUSE_SHORT);
            toBeSpeeked.Append(string.Format(TEMPLATE_READ_COUPLE, "approach speed", cklst.Vapp));

            backgroundSpeaker.AddInSpeakingBuffer(toBeSpeeked.ToString(), "approach speed: " + cklst.Vapp);
            toBeSpeeked = new StringBuilder();

            toBeSpeeked.Append(SSML_PAUSE_SHORT);
            toBeSpeeked.Append(string.Format(TEMPLATE_READ_COUPLE, "flaps extension speed", cklst.Vf0));

            backgroundSpeaker.AddInSpeakingBuffer(toBeSpeeked.ToString(), "flaps extension speed: " + cklst.Vf0);
            toBeSpeeked = new StringBuilder();

            toBeSpeeked.Append(SSML_PAUSE_SHORT);
            toBeSpeeked.Append(string.Format(TEMPLATE_READ_COUPLE, "touchdown speed", cklst.Vldg));

            backgroundSpeaker.AddInSpeakingBuffer(toBeSpeeked.ToString(), "touchdown speed: " + cklst.Vldg);
            toBeSpeeked = new StringBuilder();

            toBeSpeeked.Append(SSML_PAUSE_SHORT);
            toBeSpeeked.Append(string.Format(TEMPLATE_READ_COUPLE, "never exceed speed", cklst.Vne));

            backgroundSpeaker.AddInSpeakingBuffer(toBeSpeeked.ToString(), "never exceed speed: " + cklst.Vne);
            toBeSpeeked = new StringBuilder();

            toBeSpeeked.Append(SSML_PAUSE_SHORT);
            toBeSpeeked.Append(string.Format(TEMPLATE_READ_COUPLE, "stall speed", cklst.Vs));

            backgroundSpeaker.AddInSpeakingBuffer(toBeSpeeked.ToString(), "stall speed: " + cklst.Vs);
            toBeSpeeked = new StringBuilder();

            backgroundThread = new Thread(new ThreadStart(backgroundSpeaker.Run));
            backgroundThread.IsBackground = true;//issue 107
            backgroundThread.Start();
        }