📄 form1.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Collections;
namespace MyAprioriAlg
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private bool IsLegalInput(string inputTxt)
{
for (int i = 0; i < inputTxt.Length; i++)
{
if (inputTxt[i] < '0' || inputTxt[i] > '9')
return false;
}
return true;
}
private void button1_Click(object sender, EventArgs e)
{
if (txtMinSupportDegree.Text.ToString().Equals(String.Empty))
{
MessageBox.Show("Please input the MinSupportDegree!");
return;
}
if(!IsLegalInput(txtMinSupportDegree.Text))
{
MessageBox.Show("Wrong Input!");
return;
}
groupBox2.Visible = true;
Apriori apriori = new Apriori(Int32.Parse(txtMinSupportDegree.Text));
List<ItemSet> resultItemSetList=apriori.AprioriAlgrithm();
List<string> listStringSet=new List<string>();
List<string> listStringSupportDegree = new List<string>();
foreach(ItemSet set in resultItemSetList)
{
string strSet = String.Empty;
strSet += "{";
string strSupportDegree = String.Empty;
foreach(string s in set.Item)
{
strSet += s;
strSet += ",";
}
strSupportDegree += set.SupportDegree.ToString();
strSet = strSet.Remove(strSet.Length - 1);
strSet += "}";
listStringSet.Add(strSet);
// listStringSet.Add("---------------");
listStringSupportDegree.Add(strSupportDegree);
// listStringSupportDegree.Add("---------");
}
listBox1.DisplayMember = "ItemSet";
listBox1.DataSource = listStringSet;
listBox2.DisplayMember = "SupportDegree";
listBox2.DataSource = listStringSupportDegree;
}
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -