Ejemplo n.º 1
0
 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);
     }
 }
Ejemplo n.º 2
0
 private void StyleClick(object sender, EventArgs e)
 {
     if (dimensions == Dimensions.One)
     {
         style.Name = name.Text;
         FunctionLineStyleForm.New(Model, style);
     }
     else if (dimensions == Dimensions.Two)
     {
         Gradient = GradientForm.ShowDialog();
         Model.Items.Update(f);
     }
     else
     {
         Debug.Fail("No Style for Color function");
     }
 }
        public static FunctionLineStyleForm New(MainModel m, Function1DItem 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);
            }

            FunctionLineStyleForm f = null;

            Forms.TryGetValue(x, out f);
            if (f == null)
            {
                f = new FunctionLineStyleForm(m, x);
            }
            else
            {
                f.Reset(x);
            }
            Forms[x] = f;
            if (f.WindowState == FormWindowState.Minimized)
            {
                f.WindowState = FormWindowState.Normal;
            }
            f.Show();
            f.BringToFront();
            return(f);
        }