public static void DeletLoaclKemuAndHoursData(InputMode Inputmode)//用于从ComBox显示的文本中删除本地存储数据中科目和时间 { string Geshi = " | "; List <string> OldeKemuHours = new List <string>(); using (StreamReader sr = new StreamReader(System.Windows.Forms.Application.StartupPath + "\\app.xml", Encoding.UTF8)) { while (sr.EndOfStream == false) { string str = sr.ReadLine(); string str1 = str; str1 = str1.Remove(0, 2); str1 = str1.Remove(str1.IndexOf("*")) + str1.Remove(0, 11); string str2 = ""; if (Inputmode.Cbshow.Text.Remove(1) == " ") { str2 = " " + Inputmode.Cbshow.Text.Remove(Inputmode.Cbshow.Text.IndexOf(" "), Geshi.Length - (Inputmode.Cbshow.Text.Remove(Inputmode.Cbshow.Text.IndexOf(" ")).Length - 2)); } else { str2 = Inputmode.Cbshow.Text.Remove(Inputmode.Cbshow.Text.IndexOf(" "), Geshi.Length - (Inputmode.Cbshow.Text.Remove(Inputmode.Cbshow.Text.IndexOf(" ")).Length - 2)); } if (str1 == str2) { continue; } OldeKemuHours.Add(str); } } File.Delete(System.Windows.Forms.Application.StartupPath + "\\app.xml"); using (StreamWriter sw = new StreamWriter(System.Windows.Forms.Application.StartupPath + "\\app.xml", false, Encoding.UTF8)) { for (int q = 0; q < OldeKemuHours.Count; q++) { sw.WriteLine(OldeKemuHours[q]); } } }
private void MenuItem_Click(object sender, RoutedEventArgs e) { InputMode Plugin = new InputMode(); Plugin.ShowDialog(); }