private void MoveOption_RemoveAction(object sender, EventArgs e) { MoveOptionControl moc = (MoveOptionControl)sender; ResourceManager.Map.Segments[_current].Options.RemoveAt(moc.MoveId); UpdateView(); }
private void MoveOption_GoToAction(object sender, Utils.IdEventArgs e) { MoveOptionControl moc = (MoveOptionControl)sender; if (ResourceManager.Map.Segments.Count <= e.Id) { do { ResourceManager.Map.Segments.Add(new Segment()); } while (ResourceManager.Map.Segments.Count <= e.Id); } _current = e.Id; UpdateView(); }
private void UpdateView() { ContentTextBox.Text = ResourceManager.Map.Segments[_current].Content; //PictureBox.ImageLocation = ResourceManager.Map.Segments[_current].ImageName; if (ResourceManager.Map.Segments[_current].ImageName == null || ResourceManager.Map.Segments[_current].ImageName == String.Empty) { PictureBox.Hide(); } else { PictureBox.Image = Utils.ImageHandler.Base64ToImage(ResourceManager.Map.Segments[_current].ImageName); PictureBox.Show(); } SegmentNumericUpDown.Value = _current; if (ResourceManager.Map.Segments[_current].IsSpecial && ResourceManager.Map.Segments[_current].Options.Count != 1) { OptionsPanel.BackColor = System.Drawing.Color.Red; } else { OptionsPanel.BackColor = System.Drawing.Color.White; } OptionsPanel.Controls.Clear(); for (Int32 i = 0; i < ResourceManager.Map.Segments[_current].Options.Count; ++i) { MoveOptionControl moc = new MoveOptionControl(_current, i); moc.GoToAction += new EventHandler <Utils.IdEventArgs>(MoveOption_GoToAction); moc.RemoveAction += new EventHandler(MoveOption_RemoveAction); moc.Location = new System.Drawing.Point(0, 10 + i * moc.Height + moc.Margin.Top); OptionsPanel.Controls.Add(moc); } }