예제 #1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="SurveyPath"></param>
        public SurveyViewModel(string SurveyPath)
        {
            _DataPath = SurveyPath;
            _Survey = new Survey();
            _Survey.LoadData(SurveyPath);

            //Set Timer for the Clock
            Tmr_MsgDanke = new DispatcherTimer();
            Tmr_MsgDanke.Interval = TimeSpan.FromSeconds(6);
            Tmr_MsgDanke.Tick += Cbk_TimerDanke;
        }
예제 #2
0
        public static void SaveSurveyXML(string DataPath, Survey Survey)
        {
            //Create Xml
            var xmlfromLINQ = new XElement("Survey");
            xmlfromLINQ.Add(new XElement("Question", Survey.Question));             //Add Question
            for (int x = 0; x < Survey.CountAnswer; x++)                          //Add Answers
            {
                var Aux = new XElement("Answer", Survey.Answers[x].Text);
                Aux.Add(new XAttribute("results", Survey.Answers[x].Count));
                xmlfromLINQ.Add(Aux);
            }

            xmlfromLINQ.Save(DataPath);    //Save format
        }
예제 #3
0
        public static void ReadSurveyXML(string DataPath, Survey Survey)
        {
            //Load Xml file with the Points Info
            XElement xmlSuervey = XElement.Load(DataPath);

            //Load Question
            string strQuestion = xmlSuervey.Element("Question").Value; //Add Question
            Survey.SetQuestion(strQuestion);
            xmlSuervey.Element("Question").Remove();

            //Load Answers
            foreach (XElement xele in xmlSuervey.Elements())
                Survey.SetAnswer(xele.Value, xele.Attribute("results").Value);
        }