Beispiel #1
0
        protected override void AfterPropertiesDialog(ComponentProperties dialog)
        {
            base.AfterPropertiesDialog(dialog);
            Dictionary <string, string> meta = LoadModel(ComponentModel);

            LEDColour = (Color)ColorConverter.ConvertFromString(meta["colour"]);
            SetBrightness(0);
        }
Beispiel #2
0
 /*
  * This function is called after displaying a component properties dialog
  * so that the component can configure its parameters based on the values entered by the user.
  */
 protected virtual void AfterPropertiesDialog(ComponentProperties dialog)
 {
     if (ComponentValue.ID != "")
     {
         ComponentValue.Val = dialog.Parameters[0].Val;
     }
     if (ModelFile != "")
     {
         if (dialog.SelectedModel != ComponentModel)
         {
             LoadModel(dialog.SelectedModel);
         }
     }
     UpdateText();
     ParentCircuit.ParentWindow.UpdatePrompt();
 }
Beispiel #3
0
 /*
  * This function is called in order to populate the fields in a component properties dialog
  * It can be overriden to add extra fields. Return false to cancel display.
  */
 protected virtual bool SetupPropertiesDialog(ComponentProperties dialog)
 {
     if ((ModelFile == "") && (ComponentValue.ID == ""))
     {
         MessageBox.Show("There are no user changeable properties for this component.");
         return(false);
     }
     if (ModelFile != "")
     {
         dialog.AddModels(GetModelNames(ModelFile, ModelCategory));
         dialog.SelectModel(ComponentModel);
     }
     if (ComponentValue.ID != "")
     {
         dialog.AddQuantity(ComponentValue);
     }
     return(true);
 }
Beispiel #4
0
        //Shows the component properties dialog
        public void ShowComponentProperties()
        {
            ComponentProperties         dialog       = new ComponentProperties();
            Dictionary <string, string> paramsBefore = SaveParameters();

            if (SetupPropertiesDialog(dialog))
            {
                dialog.ShowDialog();
                if (!dialog.WasCancelled)
                {
                    AfterPropertiesDialog(dialog);
                    Dictionary <string, string> paramsNow = SaveParameters();
                    if (paramsNow.Any(element => element.Value != paramsBefore[element.Key]))
                    {
                        ParentCircuit.AddUndoAction(new ChangeAction(this, paramsBefore, paramsNow));
                    }
                }
            }
        }
Beispiel #5
0
 //We want to update colour bands after the properties dialog is displayed
 protected override void AfterPropertiesDialog(ComponentProperties dialog)
 {
     base.AfterPropertiesDialog(dialog);
     Render();
 }