예제 #1
0
    protected void LoadItem(ProjectVectorItem item)
    {
      this.SuspendLayout();
      m_CurrentItem = item;

      grpSpecie.Visible = grpTextValue.Visible = grpCalculation.Visible = pnlBlank.Visible = false;

      if (item == null)
      {
        pnlBlank.Visible = true;
      }
      else if (item.GetType() == typeof(ProjectSpecie))
      {
        grpSpecie.Visible = true;
        //UpdateTemps();
        chkIdeal.Checked = ((ProjectSpecie)item).Ideal;
        chkIdeal.Enabled = ((ProjectSpecie)item).Phase == Phase.Gas;
        grpSpecie.Text = item.Name;
        switch (((ProjectSpecie)item).Phase)
        {
          case Phase.Gas:
            grpSpecie.Text += " (Gas)"; break;
          case Phase.Liquid:
            grpSpecie.Text += " (Liquid)"; break;
          case Phase.Solid:
            grpSpecie.Text += " (Solid)"; break;
        }
      }
      else if (item.GetType() == typeof(ProjectCalculation))
      {
        grpCalculation.Visible = true;
        txtCalculation.Text = item.Value;
        txtCalcDesc.Text = ((ProjectCalculation)item).Desc;
        txtCalcSymbol.Text = item.Name;
      }
      else if (item.GetType() == typeof(ProjectText))
      {
        grpTextValue.Visible = true;
        txtText.Text = item.Value;
        this.grpTextValue.Text = "Label";
      }
      else if (item.GetType() == typeof(ProjectPage))
      {
        grpTextValue.Visible = true;
        txtText.Text = item.Value;
        this.grpTextValue.Text = "Page Break Label";
      }
      else if (item.GetType() == typeof(ProjectAttribute))
      {
        grpAttribute.Visible = true;
        txtAttributeName.Text = item.Name;
        txtAttDimension.Text = ((ProjectAttribute)item).Cnv;
        txtAttParent.Text = ((ProjectAttribute)item).Parent;
        comboAttributeType.SelectedIndex = (int)((ProjectAttribute)item).AttributeType;
      }
      this.ResumeLayout();
    }
예제 #2
0
    private int SimpleComparison(ProjectVectorItem i1, ProjectVectorItem i2)
    {
      if (i1.GetType() == i2.GetType())
        return i1.CompareTo(i2);

      return SpecieOrder.IndexOf(i1.GetType()).CompareTo(SpecieOrder.IndexOf(i2.GetType()));
    }