Esempio n. 1
0
 void frm_ReactionAdded(FrmReaction form, SimpleReaction reaction)
 {
     if (form == ActiveMdiChild)
         UpdateUsedSpecies();
     TreeNode newNode = new TreeNode(reaction.ToString());
     newNode.Tag = reaction;
     ((TreeNode)form.Tag).Nodes.Add(newNode);
 }
Esempio n. 2
0
 void frm_ReactionChanged(FrmReaction form, SimpleReaction reaction)
 {
     TreeNode frmNode = (TreeNode)form.Tag;
     TreeNode n = FindTreeNode(form, reaction);
     if (n != null)
         n.Text = reaction.ToString();
 }
Esempio n. 3
0
    protected void LoadReaction(SimpleReaction rxn)
    {
      m_bLoading = true;
      if (m_CurrentReaction != null)
      {
        m_CurrentReaction.Changed -= new EventHandler(currentReactionChanged);
        m_CurrentReaction.ReactantsChanged -= new EventHandler(rxn_ReactantsChanged);
        m_CurrentReaction.ProductsChanged -= new EventHandler(rxn_ReactantsChanged);
      }
      m_CurrentReaction = rxn;
      txtReactants.Visible = txtProducts.Visible = comboDirection.Visible = true;
      txtFormula.Visible = false;
      if (SelectedReactionChanged != null)
        SelectedReactionChanged(this, new EventArgs());
      if (rxn == null)
      {
        SetPanelEnables(pnlReaction, false);
        //pnlReaction.Enabled = false;
        txtReactants.Text = txtProducts.Text = "";
        comboDirection.SelectedIndex = -1;
        comboExtentType.SelectedIndex = -1;
        comboExtentSpecie.SelectedIndex = -1;
        comboHORSpecie.SelectedIndex = -1;
        chkHOROverride.Checked = false;
        numSequence.Text = "";
        chkEnabled.Checked = false;
        m_bLoading = false;
        return;
      }
      rxn.Changed += new EventHandler(currentReactionChanged);
      rxn.ReactantsChanged += new EventHandler(rxn_ReactantsChanged);
      rxn.ProductsChanged += new EventHandler(rxn_ReactantsChanged);
      btnCopy.Enabled = btnMoveDown.Enabled = btnMoveUp.Enabled = btnRemove.Enabled = true;
      if (rxn.UseOriginalString)
      {
        txtReactants.Visible = txtProducts.Visible = comboDirection.Visible = false;
        txtFormula.Visible = true;
        txtFormula.Text = rxn.ToString();
      }
      /*if (string.IsNullOrEmpty(rxn.GetProductsString()))
          SetWaitingText(txtProducts, "Products");
      else
      {
          txtProducts.Text = rxn.GetProductsString();
          txtProducts.TextAlign = HorizontalAlignment.Left;
          txtProducts.ForeColor = System.Drawing.SystemColors.WindowText;
          txtProducts.Tag = true;
      }
      if (string.IsNullOrEmpty(rxn.GetReactantsString()))
          SetWaitingText(txtReactants, "Reactants");
      else
      {
          txtReactants.TextAlign = HorizontalAlignment.Right;
          txtReactants.Text = rxn.GetReactantsString();
          txtReactants.ForeColor = System.Drawing.SystemColors.WindowText;
          txtReactants.Tag = true;
      }*/

      SetPanelEnables(pnlReaction, true);

      comboExtentSpecie.Enabled = !chkFirstReactant.Checked;
      numSequence.Enabled = chkSequence.Checked;
      SetHOREnabled(rxn.CustomHeatOfReaction);

      txtReactants.Text = rxn.GetReactantsString();
      txtProducts.Text = rxn.GetProductsString();

      RepopulateSpecies(false);

      comboDirection.SelectedIndex = (int)rxn.Direction;

      comboExtentType.SelectedIndex = (int)rxn.ExtentType;
      chkHOROverride.Checked = rxn.CustomHeatOfReaction;

      numExtentValue.Text = rxn.ExtentInfo.Value.ToString();
      chkEnabled.Checked = rxn.Enabled;
      txtComment.Text = rxn.Comment;

      if (chkSequence.Checked)
      {
        numSequence.Value = Math.Min(Math.Max(rxn.Sequence, 1), sMaxSequences);
        numSequence.Text = numSequence.Value.ToString();
      }
      //pnlReaction.Enabled = true;

      m_bLoading = false;
      btnBalance.Enabled = rxn.CanBalance;
    }