Example #1
0
        public void UploadFile(string pathCSVAnomalies, string pathXML, string pathCSVLearn)
        {
            if (sendFileThread != null)
            {
                sendFileThread.Abort();
                sendFileThread = null;
            }
            LearnFile = pathCSVLearn;
            graphModel.DetectAnomaliesAndSetResults(pathCSVAnomalies);

            // upload the CSV file
            fileData = File.ReadAllLines(pathCSVAnomalies).Skip(1).ToArray(); // skip the headlines
            //upload the XML file
            categories = new List <string>();

            XmlDocument doc = new XmlDocument();

            doc.Load(pathXML);
            XmlNode input = doc.GetElementsByTagName("input").Item(0);

            foreach (XmlNode child in input.ChildNodes)
            {
                foreach (XmlNode item in child.ChildNodes)
                {
                    if (item.Name == "name")
                    {
                        categories.Add(item.InnerText);
                    }
                }
            }

            SetMinimumAndMaximum();

            // notify uploaded
            notifyPropertyChanged(this, new CSVAnomaliesFileUploadEventArgs(PropertyChangedEventArgs.InfoVal.FileUpdated, fileData.Length));
            notifyPropertyChanged(this, new XMLFileUploadEventArgs(PropertyChangedEventArgs.InfoVal.FileUpdated, categories));



            Index        = 0;
            sendingSpeed = 1;
            StartThread();
        }