private void FillExistHallInfo() { System.Threading.Thread.Sleep(500); if (!ServerHelper.GetInstace().IsConnected) { InfoLogHelper.AppendLog("未连接到服务器,请检查配置和网络"); return; } if (_hallHelper.LocalCurrentHallInfo == null) { _hallHelper.LocalCurrentHallInfo = HallHelper.PublishedHallInfo; } if (_hallHelper.LocalCurrentHallInfo == null)//no hallinfo { return; } this.txtHallName.Text = _hallHelper.LocalCurrentHallInfo.Name; if (_hallHelper.LocalCurrentHallInfo.zoneList != null && _hallHelper.LocalCurrentHallInfo.zoneList.Count() > 0) { foreach (var zoneInfo in _hallHelper.LocalCurrentHallInfo.zoneList) { var index = lbZone.Items.Add(zoneInfo); } lbZone.SelectedIndex = 0; } }
private void LB_MouseDoubleClick(object sender, MouseEventArgs e) { ListBox activeLB = sender as ListBox; Point point = new Point(e.X, e.Y); int index = activeLB.IndexFromPoint(point); if (index < 0) { index = activeLB.Items.Count - 1; } ZoneInfo info = activeLB.SelectedItem as ZoneInfo; if (info != null) { EditZoneNameForm eznf = new EditZoneNameForm(info); var result = eznf.ShowDialog(); if (result == DialogResult.OK) { InfoLogHelper.AppendLog("展区名称已修改"); activeLB.Items.Remove(info); activeLB.Items.Insert(index, info); activeLB.SelectedIndex = index; } } }
private void Edit_Click(object sender, EventArgs e) { _hallHelper.LocalCurrentHallInfo = HallInfoFromUI(); if (lbPoint.SelectedItem == null) { InfoLogHelper.AppendLog("请选择一个展点"); //SetMsg("请选择一个展点"); return; } //_hallHelper PointInfo selectedInfo = lbPoint.SelectedItem as PointInfo; PointConfigForm pcf = new PointConfigForm(); pcf.LocalPath = Application.StartupPath; pcf.PointInfo = selectedInfo; pcf.HallInfo = _hallHelper.LocalCurrentHallInfo; var result = pcf.ShowDialog(); if (result == DialogResult.OK) { var selectedPoint = pcf.PointInfo; lbPoint.Items.Remove(selectedInfo); lbPoint.Items.Add(selectedInfo); lbPoint.SelectedItem = selectedInfo; } }
private void Form1_Load(object sender, EventArgs e) { ConfigHelper.ResolveConfig(Application.StartupPath + "\\config.xml"); ErrorLogHelper.LocalPath = Application.StartupPath; InfoLogHelper.RegisterLog(this); logClearTimer.Elapsed += logClearTimer_Elapsed; ServerHelper.GetInstace(); InitComponents(); _hallHelper = new HallHelper(); _hallHelper.LocalDataPath = Application.StartupPath; try { FillExistHallInfo(); } catch (Exception ex) { Console.WriteLine("get remote hallinfo err:" + ex.Message); } }