Example #1
0
        /// <summary>
        /// Called after Decide has made its choice, or, as usual for ExpressionMembers, after user edited the value through a Dialog.
        /// For checks, SetValue must change the attributes/etc of the statement according to the newly chosen value
        /// <example>If you chose "Use GM ...", SetValue will set "use_gm_..." attribute to ""</example>
        /// </summary>
        protected override void SetValueInternal(ExpressionMemberContainer container, string value)
        {
            if (value == Choices[1]) //convert
            {
                string msg = "Whale statement (name: \"" + (container.GetAttribute("name") ?? "<null>") + "\" ";

                value = "Monster";
                container.Statement.Name = value;
                if (!String.IsNullOrEmpty(container.GetAttribute("targetName")))
                {
                    //ATTACK
                    container.SetAttribute("type", "TARGET_THROTTLE");
                    container.SetAttribute("value1", container.GetAttribute("scriptThrottle"));
                    msg += "targetName: \"" + container.GetAttribute("targetName") + "\" scriptThrottle \"" + container.GetAttribute("scriptThrottle") + ") was converted to add_ai \"TARGET_THROTTLE\" statement";
                }
                else
                {
                    //POINT_THROTTLE
                    container.SetAttribute("type", "POINT_THROTTLE");
                    container.SetAttribute("value1", container.GetAttribute("pointX"));
                    container.SetAttribute("value2", container.GetAttribute("pointY"));
                    container.SetAttribute("value3", container.GetAttribute("pointZ"));
                    container.SetAttribute("value4", container.GetAttribute("scriptThrottle"));
                    msg += "target point: \"" + container.GetAttribute("pointX") + ", " + container.GetAttribute("pointY") + ", " + container.GetAttribute("pointZ") + "\" scriptThrottle: \"" + container.GetAttribute("scriptThrottle") + ") was converted to add_ai \"POINT_THROTTLE\" statement";
                }

                Log.Add(msg);
            }

            base.SetValueInternal(container, value);
        }
Example #2
0
        /// <summary>
        /// This function is called when check needs to decide which list of ExpressionMembers to output.
        /// After it is called, SetValue will be called, to allow for error correction.
        /// </summary>
        /// <example>If input is wrong, decide will choose something, and then the input will be corrected in the SetValue function</example>
        public override string Decide(ExpressionMemberContainer container)
        {
            string f = container.GetAttribute("fakeShieldsFront");
            string r = container.GetAttribute("fakeShieldsRear");
            int    fi, ri;

            Helper.IntTryParse(f, out fi);
            Helper.IntTryParse(r, out ri);

            if ((f == null || fi == -1) && (r == null || ri == -1))
            {
                return(Choices[0]);                // no fake shields
            }
            if (r == null || ri == -1)
            {
                return(Choices[1]);                // fake front shields
            }
            if (f == null || fi == -1)
            {
                return(Choices[2]);                // fake rear shields
            }
            if (true)
            {
                return(Choices[3]);                // fake front/rear shields
            }
        }
        /// <summary>
        /// Called after Decide has made its choice, or, as usual for ExpressionMembers, after user edited the value through a Dialog.
        /// For checks, SetValue must change the attributes/etc of the statement according to the newly chosen value
        /// <example>If you chose "Use GM ...", SetValue will set "use_gm_..." attribute to ""</example>
        /// </summary>
        protected override void SetValueInternal(ExpressionMemberContainer container, string value)
        {
            if (value != null)
            {
                //Only set the node name if this is a straight 1 to 1 check value, otherwise the name would be modified by other code that will follow
                if (!String.IsNullOrEmpty(value) && !value.Contains(' ') && !value.Contains('>') && !value.Contains('<'))
                {
                    container.Statement.Name = value;
                }

                //For custom one-to-one
                //if (value == "<DIRECT_DETECTED>")

                //}

                //For all many-to-one
                if (value == "<destroy>")
                {
                    if (container.Statement.Name != "destroy" && container.Statement.Name != "destroy_near")
                    {
                        container.Statement.Name = "destroy";
                    }
                }

                base.SetValueInternal(container, value);
            }
        }
Example #4
0
 /// <summary>
 /// This function is called when check needs to decide which list of ExpressionMembers to output.
 /// After it is called, SetValue will be called, to allow for error correction.
 /// </summary>
 /// <example>If input is wrong, decide will choose something, and then the input will be corrected in the SetValue function</example>
 public override string Decide(ExpressionMemberContainer container)
 {
     if (container.Statement.Name == "destroy")
     {
         return(Choices[0]);                // destroy (named object)
     }
     if (container.GetAttribute("type") == "asteroids")
     {
         return(Choices[1]);                // destroy_near asteroids
     }
     if (container.GetAttribute("type") == "mines")
     {
         return(Choices[2]);                // destroy_near mines
     }
     if (container.GetAttribute("type") == "nebulas")
     {
         return(Choices[3]); // destroy_near nebulas
     }
     if (container.GetAttribute("type") == "whales")
     {
         return(Choices[4]); // destroy_near whales
     }
     if (container.GetAttribute("type") == "drones")
     {
         return(Choices[5]); // destroy_near drones
     }
     if (true)
     {
         return(Choices[6]);                // destroy_near all
     }
 }
        /// <summary>
        /// This function is called when check needs to decide which list of ExpressionMembers to output. 
        /// After it is called, SetValue will be called, to allow for error correction. 
        /// </summary>
        /// <example>If input is wrong, decide will choose something, and then the input will be corrected in the SetValue function</example>
        public override string Decide(ExpressionMemberContainer container)
		{
			if (container.Statement.Name == "if_exists")
				return Choices[0]; // if object exists
			else
				return Choices[1]; // if object doesnt exist
		}
Example #6
0
        /// <summary>
        /// Context menu strip with nested items (based on menu groups).
        /// </summary>
        internal static ContextMenuStrip PrepareContextMenuStrip_NestedList(ExpressionMemberContainer container, ExpressionMemberValueEditor editor, ExpressionMemberValueEditorActivationMode mode)
        {
            string value = container.GetValue();

            if (editor.ValueSelectorContextMenuStrip == null || editor.LastUser != container.Member.ValueDescription || editor.ForceRecreateMenu)
            {
                editor.ValueSelectorContextMenuStrip = new ContextMenuStrip();
                editor.InitContextMenuStrip();
                editor.LastUser = container.Member.ValueDescription;
                editor.ValueSelectorContextMenuStrip.Items.Clear();
                editor.ValueSelectorContextMenuStrip.Tag = false;

                int i = 0;
                foreach (KeyValuePair <int, string> kvp in editor.MenuGroups.OrderBy((KeyValuePair <int, string> x) => x.Key))
                {
                    ToolStripMenuItem tsm = new ToolStripMenuItem(kvp.Value);
                    editor.ValueSelectorContextMenuStrip.Items.Add(tsm);

                    while (i < kvp.Key)
                    {
                        string item = editor.MenuItems[i++];

                        ToolStripItem tsi = tsm.DropDownItems.Add(item);

                        tsi.Tag    = container;
                        tsi.Click += ContextMenuClickChoose;
                    }
                }

                editor.ShowHideContextMenuStrip();
            }

            AssignContainerToContextMenuStrip(editor.ValueSelectorContextMenuStrip, container, value);
            return(editor.ValueSelectorContextMenuStrip);
        }
Example #7
0
        /// <summary>
        /// Default context menu strip for booleans (yes/no)
        /// </summary>
        internal static ContextMenuStrip PrepareContextMenuStrip_DefaultBool(ExpressionMemberContainer container, ExpressionMemberValueEditor editor, ExpressionMemberValueEditorActivationMode mode)
        {
            string value = container.GetValue();

            if (editor.ValueSelectorContextMenuStrip == null || editor.LastUser != container.Member.ValueDescription || editor.ForceRecreateMenu)
            {
                editor.ValueSelectorContextMenuStrip = new ContextMenuStrip();
                editor.InitContextMenuStrip();
                editor.LastUser = container.Member.ValueDescription;
                editor.ValueSelectorContextMenuStrip.Items.Clear();
                editor.ValueSelectorContextMenuStrip.Tag = false;

                foreach (string item in new string[3] {
                    "Default", container.Member.ValueToDisplay("1"), container.Member.ValueToDisplay("0")
                })
                {
                    ToolStripItem tsi = editor.ValueSelectorContextMenuStrip.Items.Add(item);
                    tsi.Tag    = container;
                    tsi.Click += ContextMenuClickChoose;
                }

                editor.ShowHideContextMenuStrip();
            }

            AssignContainerToContextMenuStrip(editor.ValueSelectorContextMenuStrip, container, value);
            return(editor.ValueSelectorContextMenuStrip);
        }
        /// <summary>
        /// Called after Decide has made its choice, or, as usual for ExpressionMembers, after user edited the value through a Dialog.
        /// For checks, SetValue must change the attributes/etc of the statement according to the newly chosen value
        /// <example>If you chose "Use GM ...", SetValue will set "use_gm_..." attribute to ""</example>
        /// </summary>
        protected override void SetValueInternal(ExpressionMemberContainer container, string value)
        {
            if (value == "<OBSOLETE_COUNTECM>")
            {
                // Convert countECM to countEMP.
                value = "<DEFAULT>";
                container.SetAttribute("property", "countEMP");
            }

            if (value == "<OBSOLETE_MISSILESTORESECM>")
            {
                // Convert missileStoresECM to missileStoresEMP.
                value = "<DEFAULT>";
                container.SetAttribute("property", "missileStoresEMP");
            }

            //if (value == "<INVALID_PROPERTY>")
            //{
            //    value = "<DEFAULT>";
            //    container.SetAttribute("property", "positionX");
            //}
            if (Mission.Current.Loading && value == "<READ_ONLY>")
            {
                Log.Add("Warning! Attempt to add to read-only property " + container.GetAttribute("property") + " detected in event: " + container.Statement.Parent.Name + "!");
            }
            if (Mission.Current.Loading && value == "<UNKNOWN_PROPERTY>")
            {
                Log.Add("Warning! Unknown property " + container.GetAttribute("property") + " detected in event: " + container.Statement.Parent.Name + "!");
            }

            base.SetValueInternal(container, value);
        }
Example #9
0
 /// <summary>
 /// Called after Decide has made its choice, or, as usual for ExpressionMembers, after user edited the value through a Dialog.
 /// For checks, SetValue must change the attributes/etc of the statement according to the newly chosen value
 /// <example>If you chose "Use GM ...", SetValue will set "use_gm_..." attribute to "" if it was null</example>
 /// </summary>
 protected override void SetValueInternal(ExpressionMemberContainer container, string value)
 {
     if (value == Choices[0]) //name
     {
         container.SetAttribute("use_gm_selection", null);
         container.SetAttribute("player_slot", null);
         container.SetAttributeIfNull("name", "");
     }
     if (value == Choices[1]) //usegm
     {
         if (container.GetAttribute("use_gm_selection") == null)
         {
             container.SetAttribute("use_gm_selection", "");
         }
         container.SetAttribute("name", null);
         container.SetAttribute("player_slot", null);
     }
     if (value == Choices[2]) //useslot
     {
         container.SetAttribute("use_gm_selection", null);
         container.SetAttribute("name", null);
         container.SetAttributeIfNull("player_slot", "");
     }
     base.SetValueInternal(container, value);
 }
        /// <summary>
        /// Called after Decide has made its choice, or, as usual for ExpressionMembers, after user edited the value through a Dialog.
        /// For checks, SetValue must change the attributes/etc of the statement according to the newly chosen value
        /// <example>If you chose "Use GM ...", SetValue will set "use_gm_..." attribute to ""</example>
        /// </summary>
        protected override void SetValueInternal(ExpressionMemberContainer container, string value)
        {
            if (value != null)
            {
                //Only set the node name if this is a straight 1 to 1 check value, otherwise the name would be modified by other checks that follow
                if (!String.IsNullOrEmpty(value) && !value.Contains(' ') && !value.Contains('>') && !value.Contains('<'))
                {
                    container.Statement.Name = value;
                }
                //For custom one-to-one
                //if (value == "<DIRECT_DETECTED>")
                //{
                //}
                //For all many-to-one
                if (value == "<existence>")
                {
                    if (container.Statement.Name != "if_exists" && container.Statement.Name != "if_not_exists")
                    {
                        container.Statement.Name = "if_exists";
                    }
                }
                if (value == "<location>")
                {
                    if (container.Statement.Name != "if_inside_sphere" && container.Statement.Name != "if_outside_sphere" && container.Statement.Name != "if_inside_box" && container.Statement.Name != "if_outside_box")
                    {
                        container.Statement.Name = "if_inside_sphere";
                    }
                }

                base.SetValueInternal(container, value);
            }
        }
Example #11
0
        /// <summary>
        /// Set value of the current member, including all checks (like, sets to null if this is a "store only if filled" value etc...)
        /// </summary>
        protected override void SetValueInternal(ExpressionMemberContainer container, string value)
        {
            string old = container.Statement.Body;

            if (value != null)
            {
                container.Statement.Body = value;
            }
            else
            {
                container.Statement.Body = "";
            }
            if (old != container.Statement.Body)
            {
                try
                {
                    // Miscrosoft.Preformance is so helpful! Yeah sure, if I could just call OuterXml without assigning it, I'd never do this!
                    string justSoThatOuterXmlGetLogicIsCalled = container.Statement.ToXml(new XmlDocument()).OuterXml;
                }
                catch
                {
                    container.Statement.Body = old;
                }
            }
        }
        /// <summary>
        /// Called after Decide has made its choice, or, as usual for ExpressionMembers, after user edited the value through a Dialog.
        /// For checks, SetValue must change the attributes/etc of the statement according to the newly chosen value
        /// <example>If you chose "Use GM ...", SetValue will set "use_gm_..." attribute to ""</example>
        /// </summary>
        protected override void SetValueInternal(ExpressionMemberContainer container, string value)
        {
            if (value == Choices[(int)Choice.RandomInt])
            {
                container.SetAttributeIfNull("randomIntLow", "0");
                container.SetAttributeIfNull("randomIntHigh", "0");
                container.SetAttribute("randomFloatLow", null);
                container.SetAttribute("randomFloatHigh", null);
                container.SetAttribute("value", null);
            }
            if (value == Choices[(int)Choice.RandomFloat])
            {
                container.SetAttribute("randomIntLow", null);
                container.SetAttribute("randomIntHigh", null);
                container.SetAttributeIfNull("randomFloatLow", "0.0");
                container.SetAttributeIfNull("randomFloatHigh", "0.0");
                container.SetAttribute("value", null);
            }
            if (value == Choices[(int)Choice.Exact])
            {
                container.SetAttribute("randomIntLow", null);
                container.SetAttribute("randomIntHigh", null);
                container.SetAttribute("randomFloatLow", null);
                container.SetAttribute("randomFloatHigh", null);
                container.SetAttributeIfNull("value", "0.0");
            }

            base.SetValueInternal(container, value);

            if (container.GetAttribute("integer") != null && container.GetAttribute("integer") != "yes")
            {
                container.SetAttribute("integer", null);
            }
        }
        /// <summary>
        /// Method that calls PrepareContextMenuStripMethod and returns the result.
        /// </summary>
        public ContextMenuStrip PrepareContextMenuStrip(ExpressionMemberContainer container, ExpressionMemberValueEditorActivationMode mode)
        {
            ContextMenuStrip cms = PrepareContextMenuStripMethod(container, this, mode);

            //TODO: I'd want to limit context menu vertically somehow, but it does not really scroll well so for now it's disabled
            //cms.MaximumSize = new Size(cms.MaximumSize.Width,  500);
            return(cms);
        }
        /// <summary>
        /// Shows a GUI form to edit the container's expression member
        /// </summary>
        public override void ShowEditingDialog(ExpressionMemberContainer container, ExpressionMemberValueDescription description, string defaultValue)
        {
            KeyValuePair <bool, string> result = DialogRHKeys.Show(container.Member.Name, container.GetAttribute("raceKeys"), container.GetAttribute("hullKeys"), DialogRHKeysMode.RaceNamesKeys);

            if (result.Key)
            {
                ValueChosen(container, result.Value);
            }
        }
        /// <summary>
        /// Shows a GUI form to edit the container's expression member
        /// </summary>
        /// <param name="container"></param>
        public override void ShowEditingDialog(ExpressionMemberContainer container, ExpressionMemberValueDescription description, string defaultValue)
        {
            KeyValuePair <bool, string> result = DialogSimple.Show(container.Member.Name, description, container.GetValue(), container.Member.Mandatory, defaultValue, true);

            if (result.Key)
            {
                ValueChosen(container, result.Value);
            }
        }
        /// <summary>
        /// Shows a GUI form to edit the container's expression member
        /// </summary>
        /// <param name="container"></param>
        public override void ShowEditingDialog(ExpressionMemberContainer container, ExpressionMemberValueDescription description, string defaultValue)
        {
            KeyValuePair <bool, string> result = DialogConsoleList.Show(container.Member.Name, container.GetValue());

            if (result.Key)
            {
                ValueChosen(container, result.Value);
            }
        }
        /// <summary>
        /// Called after Decide has made its choice, or, as usual for ExpressionMembers, after user edited the value through a Dialog.
        /// For checks, SetValue must change the attributes/etc of the statement according to the newly chosen value
        /// <example>If you chose "Use GM ...", SetValue will set "use_gm_..." attribute to ""</example>
        /// </summary>
        protected override void SetValueInternal(ExpressionMemberContainer container, string value)
		{
			if (value == Choices[0]) 
				container.Statement.Name = "if_exists";
			else 
				container.Statement.Name = "if_not_exists";

			base.SetValueInternal(container, value);
		}
        /// <summary>
        /// Called after Decide has made its choice, or, as usual for ExpressionMembers, after user edited the value through a Dialog.
        /// For checks, SetValue must change the attributes/etc of the statement according to the newly chosen value
        /// <example>If you chose "Use GM ...", SetValue will set "use_gm_..." attribute to ""</example>
        /// </summary>
        protected override void SetValueInternal(ExpressionMemberContainer container, string value)
        {
            if (Mission.Current.Loading && value == "!ok")
            {
                Log.Add("Warning! Unknown  fleet property " + container.GetAttribute("property_f") + " detected in event: " + container.Statement.Parent.Name + "!");
            }

            base.SetValueInternal(container, value);
        }
        /// <summary>
        /// This function is called when check needs to decide which list of ExpressionMembers to output.
        /// After it is called, SetValue will be called, to allow for error correction.
        /// </summary>
        /// <example>If input is wrong, decide will choose something, and then the input will be corrected in the SetValue function</example>
        public override string Decide(ExpressionMemberContainer container)
        {
            switch (container.Statement.Name)
            {
            case "create":
            case "add_ai":
            case "clear_ai":
            case "log":
            case "set_variable":
            case "set_timer":
            case "incoming_message":
            case "big_message":
            case "end_mission":
            case "incoming_comms_text":
            case "gm_instructions":
            case "set_object_property":
            case "set_fleet_property":
            case "set_comms_button":
            case "set_gm_button":
            case "gm_button":
            case "clear_comms_button":
            case "clear_gm_button":
            case "addto_object_property":
            case "copy_object_property":
            case "set_relative_position":
            case "set_to_gm_position":
            case "set_skybox_index":
            case "warning_popup_message":
            case "set_difficulty_level":
            case "set_player_grid_damage":
            case "play_sound_now":
            case "set_damcon_members":
            case "direct":
            case "start_getting_keypresses_from":
            case "end_getting_keypresses_from":
            case "set_ship_text":
            case "set_special":
            case "set_side_value":
            case "spawn_external_program":
            case "set_monster_tag_data":
            case "set_named_object_tag_state":
            case "set_player_carried_type":
            case "set_player_station_carried":
            case "clear_player_station_carried":
                return(container.Statement.Name);

            case "destroy":
            case "destroy_near":
                return("<destroy>");
                //...
            }

            //fallback option
            return("");
        }
Example #20
0
 /// <summary>
 /// This function is called when check needs to decide which list of ExpressionMembers to output.
 /// After it is called, SetValue will be called, to allow for error correction.
 /// </summary>
 /// <example>If input is wrong, decide will choose something, and then the input will be corrected in the SetValue function</example>
 public override string Decide(ExpressionMemberContainer container)
 {
     if (string.IsNullOrWhiteSpace(container.GetAttribute("value")))
     {
         return(Choices[0]);                // text
     }
     else
     {
         return(Choices[1]);                // id
     }
 }
Example #21
0
 /// <summary>
 /// This function is called when check needs to decide which list of ExpressionMembers to output.
 /// After it is called, SetValue will be called, to allow for error correction.
 /// </summary>
 /// <example>If input is wrong, decide will choose something, and then the input will be corrected in the SetValue function</example>
 public override string Decide(ExpressionMemberContainer container)
 {
     if (container.GetAttribute("use_gm_selection") == null)
     {
         return(Choices[0]); // name
     }
     else
     {
         return(Choices[1]); // use_gm_sel
     }
 }
        /// <summary>
        /// Get value of current member to display in the text string representing the statement.
        /// </summary>
        public override string GetValueText(ExpressionMemberContainer container)
        {
            string result = container.Statement.Body.Replace("\r\n", "");

            while (result.Length > 0 && !Char.IsLetterOrDigit(result[0]))
            {
                result = result.Remove(0, 1);
            }

            return(result);
        }
Example #23
0
        /// <summary>
        /// Called after Decide has made its choice, or, as usual for ExpressionMembers, after user edited the value through a Dialog.
        /// For checks, SetValue must change the attributes/etc of the statement according to the newly chosen value
        /// <example>If you chose "Use GM ...", SetValue will set "use_gm_..." attribute to ""</example>
        /// </summary>
        protected override void SetValueInternal(ExpressionMemberContainer container, string value)
        {
            if (value == "<OBSOLETE_SIDE>")
            {
                // Convert "side" attribute to "sideValue" attribute.
                value = Choices[1]; // "... side #"
                container.SetAttribute("sideValue", container.GetAttribute("side"));
            }

            base.SetValueInternal(container, value);
        }
 /// <summary>
 /// This function is called when check needs to decide which list of ExpressionMembers to output.
 /// After it is called, SetValue will be called, to allow for error correction.
 /// </summary>
 /// <example>If input is wrong, decide will choose something, and then the input will be corrected in the SetValue function</example>
 public override string Decide(ExpressionMemberContainer container)
 {
     if (container.GetAttribute("fleetnumber") == null)
     {
         return(Choices[0]);                // all ships
     }
     else
     {
         return(Choices[1]);                // fleetnumber
     }
 }
 /// <summary>
 /// This function is called when check needs to decide which list of ExpressionMembers to output.
 /// After it is called, SetValue will be called, to allow for error correction.
 /// </summary>
 /// <example>If input is wrong, decide will choose something, and then the input will be corrected in the SetValue function</example>
 public override string Decide(ExpressionMemberContainer container)
 {
     if (!String.IsNullOrEmpty(container.GetAttribute("targetName")))
     {
         return(Choices[1]);                // name
     }
     else
     {
         return(Choices[0]);                // point
     }
 }
Example #26
0
 /// <summary>
 /// This function is called when check needs to decide which list of ExpressionMembers to output.
 /// After it is called, SetValue will be called, to allow for error correction.
 /// </summary>
 /// <example>If input is wrong, decide will choose something, and then the input will be corrected in the SetValue function</example>
 public override string Decide(ExpressionMemberContainer container)
 {
     if (container.Statement.Name == "if_inside_sphere" || container.Statement.Name == "if_inside_box")
     {
         return(Choices[0]);                // inside
     }
     else
     {
         return(Choices[1]);                // outside
     }
 }
 /// <summary>
 /// This function is called when check needs to decide which list of ExpressionMembers to output.
 /// After it is called, SetValue will be called, to allow for error correction.
 /// </summary>
 /// <example>If input is wrong, decide will choose something, and then the input will be corrected in the SetValue function</example>
 public override string Decide(ExpressionMemberContainer container)
 {
     if (ExpressionMemberValueDescriptions.PropertyF.Editor.XmlValueToDisplay.ContainsKey(container.GetAttribute("property", ExpressionMemberValueDescriptions.PropertyF.DefaultIfNull)))
     {
         return(Choices[0]);                // ok
     }
     else
     {
         return(Choices[1]);                // not ok
     }
 }
Example #28
0
        /// <summary>
        /// Called after Decide has made its choice, or, as usual for ExpressionMembers, after user edited the value through a Dialog.
        /// For checks, SetValue must change the attributes/etc of the statement according to the newly chosen value
        /// <example>If you chose "Use GM ...", SetValue will set "use_gm_..." attribute to ""</example>
        /// </summary>
        protected override void SetValueInternal(ExpressionMemberContainer container, string value)
        {
            if (value == Choices[0])
            {
                container.Statement.Name = container.Statement.Name.Replace("outside", "inside");
            }
            else
            {
                container.Statement.Name = container.Statement.Name.Replace("inside", "outside");
            }

            base.SetValueInternal(container, value);
        }
        /// <summary>
        /// Called after Decide has made its choice, or, as usual for ExpressionMembers, after user edited the value through a Dialog.
        /// For checks, SetValue must change the attributes/etc of the statement according to the newly chosen value
        /// <example>If you chose "Use GM ...", SetValue will set "use_gm_..." attribute to ""</example>
        /// </summary>
        protected override void SetValueInternal(ExpressionMemberContainer container, string value)
        {
            if (value == Choices[0])             //point
            {
                container.SetAttribute("fleetnumber", null);
            }
            else
            {
                container.SetAttributeIfNull("fleetnumber", "0.0");
            }

            base.SetValueInternal(container, value);
        }
Example #30
0
        /// <summary>
        /// Called after Decide has made its choice, or, as usual for ExpressionMembers, after user edited the value through a Dialog.
        /// For checks, SetValue must change the attributes/etc of the statement according to the newly chosen value
        /// <example>If you chose "Use GM ...", SetValue will set "use_gm_..." attribute to ""</example>
        /// </summary>
        protected override void SetValueInternal(ExpressionMemberContainer container, string value)
        {
            if (value == Choices[0])             //id
            {
                container.SetAttribute("value", null);
            }
            else                                                        //text
            {
                container.SetAttributeIfNull("value", "0");
            }

            base.SetValueInternal(container, value);
        }