コード例 #1
0
        /// <summary>
        ///     Sets the thermal energy of the selected solution to a value.
        /// </summary>
        /// <param name="args">An argument struct containing the value to set the thermal energy to.</param>
        private void SetThermalEnergy(FloatSpinBox.FloatSpinBoxEventArgs args)
        {
            if (_solutions == null || _selectedSolution == null)
            {
                return;
            }

            var command = $"setsolutionthermalenergy {_target} {_selectedSolution} {args.Value}";

            _consoleHost.ExecuteCommand(command);
        }
コード例 #2
0
        /// <summary>
        ///     Execute a command to modify the reagents in the solution.
        /// </summary>
        private void SetReagent(FloatSpinBox.FloatSpinBoxEventArgs args, string reagentId)
        {
            if (_solutions == null || _selectedSolution == null)
            {
                return;
            }

            var current = _solutions[_selectedSolution].GetReagentQuantity(reagentId);
            var delta   = args.Value - current.Float();

            if (MathF.Abs(delta) < 0.01)
            {
                return;
            }

            var command = $"addreagent {_target} {_selectedSolution} {reagentId} {delta}";

            _consoleHost.ExecuteCommand(command);
        }