/// <summary> /// 从配置文件加载之前的配置 /// </summary> private void Load_LocalConfig() { tbx_head.Text = Properties.Settings.Default.FrameHead; tbx_end.Text = Properties.Settings.Default.FrameEnd; var typeArr = new string[] { "不启用", "按位置", "按内容" }; var arr = Properties.Settings.Default.Conditions.Split('|'); foreach (var config in arr) { if (config == "") { continue; } var confArr = config.Split('$'); var conf = new ConditionConfigItem(); conf.Type = Convert.ToInt32(confArr[0]); conf.Condition = confArr[1]; var colorOrder = Convert.ToInt32(confArr[2]); conf.Color = CustomColor.ColorArr[colorOrder]; conf.Content = $@"{typeArr[conf.Type]},{conf.Condition},{CustomColor.ColorNames[colorOrder]}"; lsbx_cond.Items.Add(conf); } }
/// <summary> /// 添加条件按钮事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Btn_AddCond_Click(object sender, RoutedEventArgs e) { if (tbx_cond.Text != "" && combx_color.SelectedIndex != -1 && combx_type.SelectedIndex != -1) { var condItem = new ConditionConfigItem(); condItem.Content = $@"{combx_type.Text},{combx_color.Text},{tbx_cond.Text}"; condItem.Type = combx_type.SelectedIndex; condItem.Color = CustomColor.ColorTable[combx_color.SelectedIndex].Color; condItem.Condition = tbx_cond.Text; lsbx_cond.Items.Add(condItem); lsbx_cond.SelectedIndex = -1; combx_color.SelectedIndex = -1; combx_type.SelectedIndex = -1; tbx_cond.Text = ""; UpdateConditionConfig(); } }