private void CheckBox_Unchecked(object sender, RoutedEventArgs e) { CheckBox checkBox = sender as CheckBox; LBModel model = checkBox.DataContext as LBModel; WriteXmlHelper.saveModel(model); }
private void btnOk_Click(object sender, RoutedEventArgs e) { var runTime = tbKeepTime.Text; foreach (LBMsg msg in lBModel.ListLBMsg) { msg.KeepTime = Convert.ToInt16(runTime); LightBoxHelper.updateModelLBMsg(msg); } WriteXmlHelper.saveModel(lBModel); Close(); }
public static void nowModelDown() { if (modelIndex >= listModel.Count - 1) { return; } var nextModel = listModel[modelIndex + 1]; var nextModelIndex = nextModel.sortIndex; var nowModel = listModel[modelIndex]; nextModel.sortIndex = nowModel.sortIndex; nowModel.sortIndex = nextModelIndex; listModel.Sort(); modelIndex = listModel.IndexOf(nowModel); WriteXmlHelper.saveModel(nextModel); WriteXmlHelper.saveModel(nowModel); }
public static void nowModelUp() { if (modelIndex == 0) { return; } var previousModel = listModel[modelIndex - 1]; var previousModelIndex = previousModel.sortIndex; var nowModel = listModel[modelIndex]; previousModel.sortIndex = nowModel.sortIndex; nowModel.sortIndex = previousModelIndex; listModel.Sort(); modelIndex = listModel.IndexOf(nowModel); WriteXmlHelper.saveModel(previousModel); WriteXmlHelper.saveModel(nowModel); }
/// <summary> /// 从文件中读取所有模式 /// </summary> public static void initModels() { listModel = FindModels(FindModelNames()); listModel.Sort(); for (int i = 0; i < listModel.Count; i++) { LBModel model = listModel[i]; if (model.sortIndex != i) { model.sortIndex = i; WriteXmlHelper.saveModel(model); } } if (listModel.Count > 0) { setModelSelected(listModel[0]); } }
private void btnFirstId_Click(object sender, RoutedEventArgs e) { WidFirstId wid = new WidFirstId(minId); wid.ShowDialog(); if (wid.DialogResult == true) { foreach (LBModel model in LightBoxHelper.listModel) { refreshModelId(wid.newId, model); WriteXmlHelper.saveModel(model); } refreshModelId(wid.newId, LightBoxHelper.SelectedModel); foreach (LightBox box in lightBoxes) { box.refreshId(); } minId = lBModel.getMinId(); } }
private void btnOk_Click(object sender, RoutedEventArgs e) { int waitMinute = comboBoxMinute.SelectedIndex; int waitSecond = comboBoxSeconds.SelectedIndex; bool runAll = (bool)(cbRunAll.IsChecked); if (lBModel.MWaitTime.WaitMM != waitMinute || lBModel.MWaitTime.WaitSS != waitSecond) { lBModel.MWaitTime.WaitMM = waitMinute; lBModel.MWaitTime.WaitSS = waitSecond; WriteXmlHelper.saveModel(lBModel); } lBModel.runAll = runAll; string newName = txtName.Text; string oldName = lBModel.ModelName; LightBoxHelper.updateModel(lBModel); WriteXmlHelper.saveModel(lBModel); if (!newName.Equals(oldName)) { if (string.IsNullOrEmpty(newName)) { MessageBox.Show("模式名称不能为空"); return; } if (LightBoxHelper.modelNameIsHaved(newName)) { MessageBox.Show("模式名称已存在"); return; } LightBoxHelper.modelRename(oldName, newName); lBModel.ModelName = newName; } DialogResult = true; }
private void Window_Closed(object sender, EventArgs e) { WriteXmlHelper.saveModel(LightBoxHelper.SelectedModel); }