public void EditStyle(Item x) { if (x is DataItem) { DataLineStyleForm.New(this, (DataItem)x); } else if (x is Function1DItem) { FunctionLineStyleForm.New(this, (Function1DItem)x); } else if (x is Function2DItem) { ((Function2DItem)x).Gradient = GradientForm.ShowDialog(); this.Items.Update(x); } }
public static DataLineStyleForm New(MainModel m, DataItem x) { // cleanup Forms List <Item> closedKeys = new List <Item>(); foreach (Item y in Forms.Keys) { if (!Forms[y].Visible) { closedKeys.Add(y); } } foreach (Item y in closedKeys) { Forms.Remove(y); } DataLineStyleForm f = null; Forms.TryGetValue(x, out f); if (f == null) { f = new DataLineStyleForm(m, x); } else { f.Reset(x); } Forms[x] = f; if (f.WindowState == FormWindowState.Minimized) { f.WindowState = FormWindowState.Normal; } f.Show(); f.BringToFront(); return(f); }
private void StyleClick(object sender, EventArgs e) { DataLineStyleForm.New(Model, item); }