private void listLayerNum_SelectedIndexChanged(object sender, EventArgs e) { if (m_listBoxLayout.SelectedIndex < 0) { return; } LayoutSettingClass curLayoutSettingClass = (LayoutSettingClass)m_listBoxLayout.SelectedItem; LayoutSetting curLayoutSetting = curLayoutSettingClass.Layout; uint enableLayer = curLayoutSetting.nLayer; int curIdx = cbxListLayer.SelectedIndex; int curlayerNum = Convert.ToInt32(listLayerNum.Text); LoadCheckListData(curlayerNum, enableLayer); if (cbxListLayer.Items.Count > 0) { if (curIdx < cbxListLayer.Items.Count) { cbxListLayer.SelectedIndex = curIdx; } else { cbxListLayer.SelectedIndex = 0; } } listBaseLayer.Text = curLayoutSetting.baseLayerIndex.ToString(); }
private LayoutSetting GetLayoutSetting(LayoutSettingClass oldLayoutSettingClass, ref bool isSpecialLayout, ref int SpecialYSpace) { LayoutSetting curLayoutSetting = new LayoutSetting(); curLayoutSetting = oldLayoutSettingClass.Layout; try { LayoutSettingClassList m_LayoutSettingList = new LayoutSettingClassList(); string layoutFilePath = Path.Combine(Application.StartupPath, CoreConst.LayoutFileName); if (File.Exists(layoutFilePath)) { var doc = new XmlDocument(); doc.Load(layoutFilePath); m_LayoutSettingList = (LayoutSettingClassList)PubFunc.SystemConvertFromXml(doc.InnerXml, typeof(LayoutSettingClassList)); foreach (LayoutSettingClass item in m_LayoutSettingList.Items) { if (item.Name == oldLayoutSettingClass.Name) { curLayoutSetting = item.Layout; isSpecialLayout = item.SpecialLayout; SpecialYSpace = item.SpecialYSpace; break; } } } } catch { } return(curLayoutSetting); }
private void m_buttonCopyAs_Click(object sender, EventArgs e) { if (m_listBoxLayout.SelectedIndex < 0) { return; } try { int LayoutIdx = m_listBoxLayout.SelectedIndex; if (LayoutIdx < 0) { return; } LayoutSettingClass Layout = m_LayoutSettingList.Items[LayoutIdx]; if (Layout.Name != "") { List <string> ExistLayout = new List <string>(); foreach (LayoutSettingClass item in m_LayoutSettingList.Items) { ExistLayout.Add(item.Name); } CommonEditForm Form = new CommonEditForm(ExistLayout); Form.Text = ResString.GetResString("Add_Layout"); if (DialogResult.OK == Form.ShowDialog()) { LayoutSettingClass newItem = new LayoutSettingClass(); newItem.Layout = Layout.Layout.Clone(); newItem.SpecialLayout = Layout.SpecialLayout; newItem.SpecialYSpace = Layout.SpecialYSpace; newItem.Name = Form.Input; m_LayoutSettingList.Items.Add(newItem); Bind(); m_listBoxLayout.SelectedIndex = m_listBoxLayout.Items.Count - 1; } } } catch (Exception ex) { MessageBox.Show("Failed to copy layout:" + ex.Message); } }
private void m_buttonRemoveMode_Click(object sender, EventArgs e) { if (m_listBoxLayout.SelectedIndex < 0) { return; } try { LayoutSettingClass Layout = (LayoutSettingClass)m_listBoxLayout.SelectedItem; if (DialogResult.Cancel == MessageBox.Show(string.Format(ResString.GetResString("Confirm_DeleteLayout"), Layout.Name), "", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation)) { return; } if (Layout.Name != "") { //检查当前设置是否被使用 foreach (LayoutSettingClass item in m_LayoutSettingList.Items) { if (item.Name == Layout.Name) { m_LayoutSettingList.Items.Remove(Layout); break; } } Bind(); m_listBoxLayout.SelectedIndex = m_listBoxLayout.Items.Count - 1; if (m_listBoxLayout.Items.Count == 0) { ClearInfo(); } } } catch (Exception ex) { MessageBox.Show("Failed to remove the layout:" + ex.Message); } }
private void m_buttonAddMode_Click(object sender, EventArgs e) { List <string> ExistLayout = new List <string>(); foreach (LayoutSettingClass Layout in m_LayoutSettingList.Items) { ExistLayout.Add(Layout.Name); } CommonEditForm Form = new CommonEditForm(ExistLayout); Form.Text = ResString.GetResString("Add_Layout"); if (DialogResult.OK == Form.ShowDialog()) { LayoutSettingClass layout = new LayoutSettingClass(); layout.Name = Form.Input; m_LayoutSettingList.Items.Add(layout); Bind(); m_listBoxLayout.SelectedIndex = m_listBoxLayout.Items.Count - 1; } }