Exemplo n.º 1
0
        /// <summary>
        /// 将配置信息读到类里
        /// </summary>
        /// <param name="AFileName"></param>
        /// <param name="AXmlNodeName"></param>
        /// <returns></returns>
        protected bool ReadXml(string AFileName)
        {
            bool flag = true;

            if (IListServiceConfigInfo == null)
            {
                IListServiceConfigInfo = new List <ServiceConfigInfo>();
            }
            else
            {
                IListServiceConfigInfo.Clear();
            }


            if (File.Exists(AFileName))
            {
                try
                {
                    XmlDocument xdoc = new XmlDocument();
                    xdoc.Load(AFileName);
                    XmlNodeList lstXmlNodeList = xdoc.SelectNodes("PMStatisticsTime/StatisticsName");
                    foreach (XmlNode xnode in lstXmlNodeList)
                    {
                        if (xnode != null)
                        {
                            ServiceConfigInfo serviceConfigInfo = new ServiceConfigInfo();
                            serviceConfigInfo.StatistcsName = xnode.Attributes["name"].Value ?? StatisticsConstDefine.QMStatisticsName;
                            serviceConfigInfo.IsStart       = xnode.Attributes["IsActive"].Value == "1";
                            serviceConfigInfo.StartTime     = BasicMethod.DateTimeParse(xnode.Attributes["StartTime"].Value, new DateTime(DateTime.Today.Year, 1, 1));
                            if (IListServiceConfigInfo == null)
                            {
                                IListServiceConfigInfo = new List <ServiceConfigInfo>();
                            }
                            IListServiceConfigInfo.Add(serviceConfigInfo);
                        }
                    }
                }
                catch (Exception e)
                {
                    FileLog.WriteInfo("ReadXml()", e.Message.ToString());
                    return(false);
                }
            }
            else
            {
                return(false);
            }
            return(flag);
        }
Exemplo n.º 2
0
 private void button2_Click(object sender, EventArgs e)
 {
     int[] result = BasicMethod.K_Means_Clustering(dataframe, label1);
 }