示例#1
0
 private void btnKMeans_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (this.ActiveDataForm != null && !this.ActiveDataForm.IsBusy)
     {
         var targetform  = this.ActiveDataForm;
         var targettable = targetform.GetDataTable();
         ConfigForm.KMeansForm configform = new ConfigForm.KMeansForm(targettable.GetColumnsList(false, typeof(string), typeof(DateTime), typeof(bool)), targettable.RowCount);
         if (configform.ShowDialog() == DialogResult.OK)
         {
             try
             {
                 MdiForm.MdiKMeansResultForm   resultform = new MdiForm.MdiKMeansResultForm(targetform);
                 Protocol.Structure.WaitObject wt         = new Protocol.Structure.WaitObject();
                 targetform.DoMethod("K均值聚类", (ThreadPool) =>
                 {
                     resultform.Result = Kernel.BusinessLogicOperation.DataMiningOperation.KMeans(ThreadPool, targettable, configform.SelectedColumns, configform.MaxCount, configform.StartClustNum, configform.EndClustNum, configform.Avg, configform.Stdev, wt, configform.InitialMode, configform.MethodMode, configform.MaxThread);
                 }, wt, () =>
                 {
                     this.Invoke(new Action(() =>
                     {
                         resultform.ShowResult();
                         resultform.Show();
                     }));
                 });
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.Message);
             }
         }
     }
 }
 private void btnKMeans_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (this.ActiveDataForm != null && !this.ActiveDataForm.IsBusy)
     {
         var targetform = this.ActiveDataForm;
         var targettable = targetform.GetDataTable();
         ConfigForm.KMeansForm configform = new ConfigForm.KMeansForm(targettable.GetColumnsList(false, typeof(string), typeof(DateTime), typeof(bool)), targettable.RowCount);
         if (configform.ShowDialog() == DialogResult.OK)
         {
             try
             {
                 MdiForm.MdiKMeansResultForm resultform = new MdiForm.MdiKMeansResultForm(targetform);
                 Protocol.Structure.WaitObject wt = new Protocol.Structure.WaitObject();
                 targetform.DoMethod("K均值聚类", (ThreadPool) =>
                 {
                     resultform.Result = Kernel.BusinessLogicOperation.DataMiningOperation.KMeans(ThreadPool,targettable, configform.SelectedColumns, configform.MaxCount, configform.StartClustNum, configform.EndClustNum, configform.Avg, configform.Stdev, wt, configform.InitialMode, configform.MethodMode, configform.MaxThread);
                 }, wt, () =>
                 {
                     this.Invoke(new Action(() =>
                     {
                         resultform.ShowResult();
                         resultform.Show();
                     }));
                 });
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.Message);
             }
         }
     }
 }