Exemplo n.º 1
0
        public BSkyTextBox()
        {
            InitializeComponent();
            //  base.Style = (Style)this.FindResource("lala");
            Syntax = "%%VALUE%%";
            //Standardizing the textbox button font type and font sizes to protect against changes in themes
            this.FontFamily    = new FontFamily("Segoe UI");
            this.FontSize      = 12;
            SubstituteSettings = "TextAsIs";
            OverwriteSettings  = "DontPrompt";
            //  RequiredSyntax = true;

            //TemplateKey = "TextBoxBaseControlTemplate";

            this.SetResourceReference(TemplateProperty, "TextBoxBaseControlTemplate");
            ///Setting shades ///
            //  var converter = new System.Windows.Media.BrushConverter();
            // this.BorderBrush = (Brush)converter.ConvertFrom("#FFA9A9A9");

            //base.Background = Brushes.Beige;
            //this.Effect =
            //    new DropShadowEffect
            //    {
            //        Color = new Color { R = 155, A = 200, B = 0, G = 95 },
            //        Direction = 320,
            //        ShadowDepth = 0,
            //        Opacity = 1
            //    };
            //Added by Aaron 12/23/2012
            TextChangedBehaviour = new BehaviourCollection();
        }
Exemplo n.º 2
0
        public LevelEditor()
        {
            Behaviours = new BehaviourCollection( );

            const string contentRootFolder = @"c:\";

            _properties = new LevelProperties
            {
                Name              = "Root",
                Visible           = true,
                CustomProperties  = new CustomProperties(),
                ContentRootFolder = contentRootFolder,
                Version           = ObjectFactory.GetInstance <IGetAssemblyInformation>( ).Version
            };

            _previousContentRootFolder = contentRootFolder;

            var contentRootChanged = new ContentRootChanged(_previousContentRootFolder, contentRootFolder);

            ObjectFactory.GetInstance <IEventHub>().Publish(contentRootChanged);

            Layers = new List <LayerEditor>
            {
                new LayerEditor(this, @"Layer_0")
            };
        }
Exemplo n.º 3
0
        public LevelEditor()
        {
            Behaviours = new BehaviourCollection( );

            const string contentRootFolder = @"c:\";

            _properties = new LevelProperties
                {
                    Name = "Root",
                    Visible = true,
                    CustomProperties = new CustomProperties(),
                    ContentRootFolder = contentRootFolder,
                    Version = ObjectFactory.GetInstance<IGetAssemblyInformation>( ).Version
                };

            _previousContentRootFolder = contentRootFolder;

            var contentRootChanged = new ContentRootChanged(_previousContentRootFolder, contentRootFolder);

            ObjectFactory.GetInstance<IEventHub>().Publish(contentRootChanged);

            Layers = new List<LayerEditor>
                {
                    new LayerEditor( this, @"Layer_0" )
                } ;
        }
        public BSkyListBoxwBorderForDatasets()
        {
            InitializeComponent();

            SelectionChangeBehaviour = new BehaviourCollection();
            base.SelectionMode       = SelectionMode.Extended;
        }
        /// <summary>
        ///   Creates all necessary collections for the AI. Note that the collections created by this
        ///   will in most instances be unique. If however, for some reason, there is the need for different
        ///   AI systems, then these should have separate collections.
        /// </summary>
        /// <returns></returns>
        public static IAiCollection Create()
        {
            var a = new ActionCollection();
            var c = new ConsiderationCollection();
            var o = new OptionCollection(a, c);
            var b = new BehaviourCollection(o);

            return(new AiCollection(b));
        }
        public BSkyRadioButton()
        {
            CheckedChangeBehaviour = new BehaviourCollection();
            //Standardizing the radio button font type and font sizes to protect against changes in themes
            this.FontFamily = new FontFamily("Segoe UI");
            this.FontSize   = 12;

            this.FontSize = 12;
            Syntax        = "%%VALUE%%";
            this.SetResourceReference(StyleProperty, "RadioButtonTemplate");
        }
        //dialogmode =true means the dataset listbox is invoked from dialog editor
        //populate =true means I automatically populate the dataset variable list with existing datasets
        public BSkyListBoxwBorderForDatasets(bool populate, bool dialogmode)
        {
            //Code below sets up the binding for displaying the icon and dataset in the listbox
            InitializeComponent();
            base.SelectionMode       = SelectionMode.Extended;
            SelectionChangeBehaviour = new BehaviourCollection();
            AutoPopulate             = populate;
            DialogEditorMode         = dialogmode;
            SubstituteSettings       = "UseComma";
            MoveVariables            = true;

            Syntax = "%%VALUE%%";
        }
Exemplo n.º 8
0
        public BSkyComboBox()
        {
            _DisplayItems = new StringCollection();

            // List<string> DisplayItems = new System.Collections.Generic.List<string>();
            //System.Windows.Data.Binding b = new System.Windows.Data.Binding();
            //b.Source = base.ItemsSource;
            //this.SetBinding(b, DisplayItems);
            base.ItemsSource = _DisplayItems;
            // 12/31/2012 Aaron
            //Added the line below to support the text property
            // IsEditable = true;
            SelectionChangeBehaviour = new BehaviourCollection();
            Syntax = "%%VALUE%%";
        }
Exemplo n.º 9
0
 public BSkyButton()
 {
     ClickBehaviour = new BehaviourCollection();
     ///Setting shades ///
     //LinearGradientBrush lgb = new LinearGradientBrush(new Color() { R = 221, A = 200, B = 239, G = 255 }, new Color() { R = 155, B = 95, G = 200 }, 70.5);
     //this.Background = lgb;///
     //this.Effect =
     //    new DropShadowEffect
     //    {
     //        Color = new Color { R = 153, A = 100, B = 234, G = 214 },
     //        Direction = 100,
     //        ShadowDepth = 0,
     //        Opacity = 1
     //    };
 }
Exemplo n.º 10
0
 public NewAutomata(
     BehaviourCollection newRecordBehaviours,
     BehaviourCollection carriageReturnBehaviours,
     BehaviourCollection delimitedBehaviours,
     BehaviourCollection nakedCellBehaviours,
     BehaviourCollection quotedCellBehaviours,
     BehaviourCollection quoteEndBehaviours
     )
 {
     _newRecordBehaviours      = newRecordBehaviours;
     _carriageReturnBehaviours = carriageReturnBehaviours;
     _delimitedBehaviours      = delimitedBehaviours;
     _nakedCellBehaviours      = nakedCellBehaviours;
     _quotedCellBehaviours     = quotedCellBehaviours;
     _quoteEndBehaviours       = quoteEndBehaviours;
 }
Exemplo n.º 11
0
        public LayerEditor(LevelEditor parentLevel, string name)
        {
            _properties = new LayerProperties
            {
                Name             = name,
                CustomProperties = new CustomProperties( ),
                Visible          = true,
                ScrollSpeed      = Vector2.One
            };

            ParentLevel = parentLevel;

            Items = new List <ItemEditor>();

            _behaviours = new BehaviourCollection( );
        }
Exemplo n.º 12
0
 public BSkySlider()
 {
     CheckedChangeBehaviour = new BehaviourCollection();
     IsSnapToTickEnabled    = true;
     TickPlacement          = System.Windows.Controls.Primitives.TickPlacement.Both;
     //TickFrequency = 2;
     AutoToolTipPlacement = System.Windows.Controls.Primitives.AutoToolTipPlacement.BottomRight;
     Foreground           = Brushes.Black;
     //SmallChange = 0.1;
     IsSnapToTickEnabled  = false;
     AutoToolTipPrecision = 2;
     IsMoveToPointEnabled = true;
     // IsSelectionRangeEnabled = true;
     SelectionStart = Minimum;
     SelectionEnd   = Maximum;
     Syntax         = "%%VALUE%%";
 }
Exemplo n.º 13
0
        public Item(Vector position, Hashtable props, string id, byte type, IWorld world, IFiber fiber, bool innerFiber, Dictionary <byte, object> inTags, float size,
                    int subZone, BehaviourCollection collection)
            : this(position, props, id, type, world, inTags, size, subZone, collection)
        {
            if (innerFiber)
            {
                this.fiber        = new PoolFiber();
                this.fiberStarted = false;
            }
            else
            {
                this.fiber        = fiber;
                this.fiberStarted = true;
            }

            //ServerRuntimeStats.Default.CreateItem(type);
        }
Exemplo n.º 14
0
        public BSkyTargetList(bool SourceList, bool dialogDesigner)
        {
            base.AutoVar = !SourceList;

            base.renderVars = dialogDesigner;

            Syntax = "%%VALUE%%";
            SelectionChangeBehaviour = new BehaviourCollection();
            // if (SourceList==1)
            if (SourceList && !dialogDesigner)
            {
                if (this.ItemsCount > 0)
                {
                    this.SelectedIndex = 0;
                }
                this.Focus();
            }
        }
 public BSkyCheckBox()
 {
     CheckedChangeBehaviour = new BehaviourCollection();
     Syntax = "%%VALUE%%";
     this.SetResourceReference(StyleProperty, "CheckBoxTemplate");
     //Standardizing the checkbox button font type and font sizes to protect against changes in themes
     this.FontFamily = new FontFamily("Segoe UI");
     this.FontSize   = 12;
     uncheckedsyntax = "FALSE";
     // this.SetResourceReference(TemplateProperty, "CheckBoxTemplate");
     ///Setting shades ///
     //this.Effect =
     //    new DropShadowEffect
     //    {
     //        Color = new Color { R = 155, A = 200, B = 0, G = 95 },
     //        Direction = 320,
     //        ShadowDepth = 0,
     //        Opacity = 1
     //    };
 }
Exemplo n.º 16
0
        public LevelEditor(XElement xml)
        {
            TypeLookup.Rehydrate(xml);

            _properties = xml.Element(@"LevelProperties").DeserializedAs <LevelProperties>( );

            _previousContentRootFolder = _properties.ContentRootFolder;

            if (!Directory.Exists(_properties.ContentRootFolder))
            {
                string message = @"The level file has a content root folder that does not exist.
It says the content root is at ""{0}"". Images specified in this level file are relative to this folder so you should change it in order to load this level file correctly.
Would you like to change it?".FormatWith(_properties.ContentRootFolder);

                if (MessageBox.Show(message, @"Content root folder not found.", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    var folderBrowserDialog = new Ookii.Dialogs.VistaFolderBrowserDialog( );

                    DialogResult dialogResult = folderBrowserDialog.ShowDialog( );

                    if (dialogResult == DialogResult.OK)
                    {
                        _properties.ContentRootFolder = folderBrowserDialog.SelectedPath;
                    }
                }
            }

            if (_properties.ContentRootFolder != _previousContentRootFolder)
            {
                //ObjectFactory.GetInstance<IEventHub>().Publish(new ContentRootChanged(_previousContentRootFolder, _properties.ContentRootFolder));
            }

            Behaviours = new BehaviourCollection(_properties, xml);

            Layers = new List <LayerEditor>(xml.CertainElement(@"Layers").Elements(@"Layer").Select(x => LayerEditor.FromXml(this, x)));

            ActiveLayer = Layers.FirstOrDefault( );
        }
Exemplo n.º 17
0
 public BSkySourceList()
 {
     SelectionChangeBehaviour = new BehaviourCollection();
 }
Exemplo n.º 18
0
 public virtual void RecreateFromXml(LayerEditor parentLayer, XElement xml)
 {
     Behaviours = new BehaviourCollection(ItemProperties, xml);
 }
Exemplo n.º 19
0
 protected ItemEditor( )
 {
     Behaviours = new BehaviourCollection( );
 }
Exemplo n.º 20
0
        private Item(Vector position, Hashtable props, string id, byte type, IWorld world, Dictionary <byte, object> inTags, float size, int subZone, BehaviourCollection collection)
            : base(world, id, type, inTags, size, subZone, collection)
        {
            transform.SetPosition(position);
            properties.SetProperties(props, null);

            this.eventChannel          = new MessageChannel <ItemEventMessage>(ItemEventMessage.CounterEventSend);
            this.disposeChannel        = new MessageChannel <ItemDisposedMessage>(MessageCounters.CounterSend);
            this.positionUpdateChannel = new MessageChannel <ItemPositionMessage>(MessageCounters.CounterSend);
            destroyedByLogic           = false;

            this.world = world;
        }
Exemplo n.º 21
0
 public MmoItem(PeerBase peer, InterestArea interest, IWorld world, GameApplication app, float[] coordinate, float[] rotation,
                Hashtable properties, string gameRefId, Dictionary <byte, object> inTags, float size, int subZone, BehaviourCollection collection)
     : base(coordinate.ToVector(false), properties, gameRefId, (byte)ItemType.Avatar, world, peer.RequestFiber, false, inTags, size, subZone, collection)
 {
     owner = GetComponent <MmoActor>();
     owner.SetApplication(app);
     owner.SetPeer(peer);
     owner.SetAvatar(this);
     owner.AddInterestArea(interest);
     owner.SetWorld(world);
     transform.SetPosition(coordinate);
     transform.SetRotation(rotation);
 }
Exemplo n.º 22
0
 public CtrlListBox()
 {
     Syntax                   = "%%VALUE%%";
     SubstituteSettings       = "UseComma";
     SelectionChangeBehaviour = new BehaviourCollection();
 }
Exemplo n.º 23
0
        public LevelEditor(XElement xml)
        {
            TypeLookup.Rehydrate( xml );

            _properties = xml.Element( @"LevelProperties" ).DeserializedAs<LevelProperties>( ) ;

            _previousContentRootFolder = _properties.ContentRootFolder;

            if( !Directory.Exists( _properties.ContentRootFolder ) )
            {
                string message = @"The level file has a content root folder that does not exist.
            It says the content root is at ""{0}"". Images specified in this level file are relative to this folder so you should change it in order to load this level file correctly.
            Would you like to change it?".FormatWith( _properties.ContentRootFolder ) ;

                if(MessageBox.Show( message, @"Content root folder not found.", MessageBoxButtons.YesNo, MessageBoxIcon.Question )==DialogResult.Yes)
                {
                    var folderBrowserDialog = new Ookii.Dialogs.VistaFolderBrowserDialog( ) ;

                    DialogResult dialogResult = folderBrowserDialog.ShowDialog( ) ;

                    if( dialogResult == DialogResult.OK )
                    {
                        _properties.ContentRootFolder=folderBrowserDialog.SelectedPath ;
                    }
                }
            }

            if (_properties.ContentRootFolder != _previousContentRootFolder)
            {
                //ObjectFactory.GetInstance<IEventHub>().Publish(new ContentRootChanged(_previousContentRootFolder, _properties.ContentRootFolder));
            }

            Behaviours = new BehaviourCollection( _properties, xml );

            Layers = new List<LayerEditor>( xml.CertainElement( @"Layers" ).Elements( @"Layer" ).Select( x => LayerEditor.FromXml( this, x ) ) ) ;

            ActiveLayer = Layers.FirstOrDefault( ) ;
        }
Exemplo n.º 24
0
 protected ItemEditor( )
 {
     Behaviours=new BehaviourCollection( );
 }
Exemplo n.º 25
0
 public virtual void RecreateFromXml( LayerEditor parentLayer, XElement xml )
 {
     Behaviours= new BehaviourCollection(ItemProperties, xml);
 }
Exemplo n.º 26
0
 public BSkyTargetList()
 {
     SelectionChangeBehaviour = new BehaviourCollection();
 }
Exemplo n.º 27
0
        public void ApplyBehaviour(object sender, BehaviourCollection behaviours)
        {
            //A control is associated with a behavior collection
            //A behavior collection is a collection of behaviors
            //A behavior can contains one condition e.g. itemscount = 0 and one or more setters e.g. set the property canexecute =true on control destination. The setter also stores the
            //value of the property its bound to (the control and the propert name)
            //Behaviors are invoked on the control when a particular activity takes place for e.g. when a selection changes on a listbox control, when text is entered
            //on a text control.
            //Typical use case for behaviors is as follows. Every control has a CanExecute property. This can be enabled or disabled by default.
            //The OK button will only be enabled when the can execute property of all the controls on the canvas are set to true.
            //
            //For example, when the
            //one sample t.test dialog is rendered for the first time, the destination listbox will always be empty. We would then set the default value of canexecute to false.
            //We would define a condition for when items count is > than 0 and set canexecute for the destination property to true only when items count is > than 0.
            //We would also add another condition to set Canexecute to false when items count is 0 to account for the case when users move variables from the destination
            //back to the source.
            //Also note that you can have canexecute to true on the destination control of one sample t.test but have the canexecute property on the textbox set to false
            //as no valid entry has be entered tocompare the dialog against. In this situation the OK button on the dialog is disabled



            foreach (Behaviour behaviour in behaviours)
            {
                //Get the type of object where the selection has changed
                //Added by Aaron 04/12/2014
                //The code below to make sure that the property type matches the value type. This insures that the
                //condition can be applied without any exceptionsto which the property
                IBSkyInputControl ctrl = sender as IBSkyInputControl;
                Type t = sender.GetType();
                if (behaviour.Condition.PropertyName == null)
                {
                    System.Windows.Forms.MessageBox.Show(BSky.GlobalResources.Properties.Resources.CanvasPropNotSet1 + " \"" + ctrl.Name + "\"" +
                                                         BSky.GlobalResources.Properties.Resources.CanvasPropNotSet2 + "  \"" + ctrl.Name + "\" " +
                                                         BSky.GlobalResources.Properties.Resources.CanvasPropNotSet3);
                    return;
                }

                //Get information of the property on which the condition is specified. The property belongs to the object
                PropertyInfo pInfo = t.GetProperty(behaviour.Condition.PropertyName);
                if (pInfo == null)
                {
                    continue;
                }
                //Get the value of the property for which the condition is triggered
                object value = pInfo.GetValue(sender, null);
                bool   pass  = false;
                //why can't I call pInfo.GetType() below?
                //Store the type of the property for which the condition is defined
                Type propType = pInfo.PropertyType;



                if (propType == typeof(int) || propType == typeof(double) || propType == typeof(long))
                {
                    try
                    {
                        double lvalue = Convert.ToDouble(value);
                        double rvalue = Convert.ToDouble(behaviour.Condition.Value);
                    }
                    catch (FormatException e)
                    {
                        System.Windows.Forms.MessageBox.Show(BSky.GlobalResources.Properties.Resources.CtrlBehaviourIncorrect1 + "  \"" + ctrl.Name + "\" " +
                                                             BSky.GlobalResources.Properties.Resources.CtrlBehaviourIncorrect2 + " \n" +
                                                             BSky.GlobalResources.Properties.Resources.CtrlBehaviourIncorrect3 +
                                                             "  \"" + behaviour.Condition.PropertyName + "\" " +
                                                             BSky.GlobalResources.Properties.Resources.CtrlBehaviourIncorrect4 +
                                                             " \"" + behaviour.Condition.Value + "\"\n" +
                                                             BSky.GlobalResources.Properties.Resources.CtrlBehaviourIncorrect5);
                        return;
                    }
                }

                if (propType == typeof(Boolean))
                {
                    try
                    {
                        Boolean lvalue = Convert.ToBoolean(value);
                        Boolean rvalue = Convert.ToBoolean(behaviour.Condition.Value);
                    }
                    catch (FormatException e)
                    {
                        System.Windows.Forms.MessageBox.Show(BSky.GlobalResources.Properties.Resources.CtrlBehaviourIncorrect1 +
                                                             " \"" + ctrl.Name + "\" " +
                                                             BSky.GlobalResources.Properties.Resources.CtrlBehaviourIncorrect2 + "\n" +
                                                             BSky.GlobalResources.Properties.Resources.CtrlBehaviourIncorrect3 +
                                                             "  \"" + behaviour.Condition.PropertyName + "\" " +
                                                             BSky.GlobalResources.Properties.Resources.CtrlBehaviourIncorrect4 +
                                                             " \"" + behaviour.Condition.Value + "\"\n" +
                                                             BSky.GlobalResources.Properties.Resources.CtrlBehaviourIncorrect5);
                        return;
                    }
                }



                //Code below sets pass =true if the condition specified is triggered
                switch (behaviour.Condition.Operator)
                {
                //Added by Aaron: 08/25/2013
                //the equals operator appliesto strings (textboxes) and numeric types (itemscount on a listbox)

                case ConditionalOperator.Equals:
                    if (propType == typeof(int) || propType == typeof(double) || propType == typeof(long) || propType == typeof(string) || propType == typeof(Boolean))
                    {
                        if (propType == typeof(int) || propType == typeof(double) || propType == typeof(long))
                        {
                            double lvalue = Convert.ToDouble(value);
                            double rvalue = Convert.ToDouble(behaviour.Condition.Value);
                            if (lvalue == rvalue)
                            {
                                pass = true;
                            }
                        }
                        if (propType == typeof(string))
                        {
                            string lvalue = value as string;
                            string rvalue = behaviour.Condition.Value;
                            if (lvalue == rvalue)
                            {
                                pass = true;
                            }
                        }
                        if (propType == typeof(Boolean))
                        {
                            Boolean lvalue = Convert.ToBoolean(value);
                            Boolean rvalue = Convert.ToBoolean(behaviour.Condition.Value);
                            if (lvalue == rvalue)
                            {
                                pass = true;
                            }
                        }
                    }
                    break;

                case ConditionalOperator.GreaterThan:
                    if (propType == typeof(int) || propType == typeof(double) || propType == typeof(long))
                    {
                        double lvalue = Convert.ToDouble(value);
                        double rvalue = Convert.ToDouble(behaviour.Condition.Value);
                        if (lvalue > rvalue)
                        {
                            pass = true;
                        }
                    }
                    break;

                case ConditionalOperator.GreaterThanEqualsTo:
                    if (propType == typeof(int) || propType == typeof(double) || propType == typeof(long))
                    {
                        double lvalue = Convert.ToDouble(value);
                        double rvalue = Convert.ToDouble(behaviour.Condition.Value);
                        if (lvalue >= rvalue)
                        {
                            pass = true;
                        }
                    }
                    break;

                case ConditionalOperator.LessThan:
                    if (propType == typeof(int) || propType == typeof(double) || propType == typeof(long))
                    {
                        double lvalue = Convert.ToDouble(value);
                        double rvalue = Convert.ToDouble(behaviour.Condition.Value);
                        if (lvalue < rvalue)
                        {
                            pass = true;
                        }
                    }
                    break;

                case ConditionalOperator.LessThanEqualsTo:
                    if (propType == typeof(int) || propType == typeof(double) || propType == typeof(long))
                    {
                        double lvalue = Convert.ToDouble(value);
                        double rvalue = Convert.ToDouble(behaviour.Condition.Value);
                        if (lvalue >= rvalue)
                        {
                            pass = true;
                        }
                    }
                    break;

                case ConditionalOperator.Contains:
                    if (propType == typeof(string))
                    {
                        string lvalue = value.ToString();
                        string rvalue = behaviour.Condition.Value.ToString();
                        if (lvalue.Contains(rvalue))
                        {
                            pass = true;
                        }
                    }
                    break;

                case ConditionalOperator.Like:
                    if (propType == typeof(string))
                    {
                        string lvalue = value.ToString();
                        string rvalue = behaviour.Condition.Value.ToString();
                        if (lvalue.StartsWith(rvalue))
                        {
                            pass = true;
                        }
                    }
                    break;

                //Added by Aaron on 08/25/2013
                //We want the textbox on One Sample T.test disabled unless a valid numeric value is entered to compare against
                case ConditionalOperator.IsNumeric:
                    if (propType == typeof(string))
                    {
                        decimal number        = 0;
                        string  valueasstring = value as string;
                        bool    canConvert    = Decimal.TryParse(valueasstring, out number);
                        if (canConvert == true)
                        {
                            pass = true;
                        }
                    }
                    break;

                case ConditionalOperator.NotNumeric:
                    if (propType == typeof(string))
                    {
                        decimal number        = 0;
                        string  valueasstring = value as string;
                        bool    canConvert    = Decimal.TryParse(valueasstring, out number);
                        if (canConvert == false)
                        {
                            pass = true;
                        }
                    }
                    break;

                //Added by Aaron 12/12/2013
                //This is to support a condition of valid string to ensure a textbox has a valid string entered
                case ConditionalOperator.ValidString:
                    if (propType == typeof(string))
                    {
                        string valueasstring = value as string;
                        if (valueasstring != null && valueasstring != "")
                        {
                            pass = true;
                        }
                    }
                    break;

                case ConditionalOperator.isNullOrEmpty:
                    if (propType == typeof(string))
                    {
                        string valueasstring = value as string;
                        if (valueasstring == null || valueasstring == "")
                        {
                            pass = true;
                        }
                    }
                    break;
                }
                if (pass)
                {
                    foreach (PropertySetter setter in behaviour.Setters)
                    {
                        //Added by Aaron 05/16/2015
                        //Its very easily to create a null property and control name and value set
                        //you click add a setter and we create a control name, property name and value to null
                        //The if look ensures that we don't crash
                        if (setter.ControlName != null || setter.PropertyName != null)
                        {
                            object fe = null;
                            if (string.IsNullOrEmpty(setter.ControlName))
                            {
                                fe = this;
                            }
                            else
                            {
                                fe = this.getCtrl(setter.ControlName);
                                // fe = this.FindName(setter.ControlName);
                            }
                            //Aaron 04/06/2014
                            // Error message needs to inserted here
                            if (fe == null)
                            {
                                System.Windows.Forms.MessageBox.Show(BSky.GlobalResources.Properties.Resources.CtrlBehaviourIncorrect1 +
                                                                     "  \"" + ctrl.Name + "\" " +
                                                                     BSky.GlobalResources.Properties.Resources.CtrlBehaviourIncorrect2 + "\n" +
                                                                     BSky.GlobalResources.Properties.Resources.TheCtrlName +
                                                                     " \"" + setter.ControlName + "\" " +
                                                                     BSky.GlobalResources.Properties.Resources.CantFind +
                                                                     BSky.GlobalResources.Properties.Resources.CheckBehaviour +
                                                                     " \"" + ctrl.Name + "\" " +
                                                                     BSky.GlobalResources.Properties.Resources.InDialogEditor);

                                return;
                            }


                            Type feType = fe.GetType();
                            //Aaron 11/03/2013
                            //fepinfo has has the destination property that needs to be set
                            PropertyInfo fepInfo = feType.GetProperty(setter.PropertyName);
                            if (fepInfo == null)
                            {
                                System.Windows.Forms.MessageBox.Show(BSky.GlobalResources.Properties.Resources.CtrlBehaviourIncorrect1 +
                                                                     "  \"" + ctrl.Name + "\" " +
                                                                     BSky.GlobalResources.Properties.Resources.CtrlBehaviourIncorrect2 + " \n" +
                                                                     BSky.GlobalResources.Properties.Resources.ThePropName +
                                                                     " \"" + setter.PropertyName + "\" " +
                                                                     BSky.GlobalResources.Properties.Resources.NotValidCtrlProp +
                                                                     " \"" + setter.ControlName + "\" " +
                                                                     BSky.GlobalResources.Properties.Resources.CheckBehaviour +
                                                                     " \"" + ctrl.Name + "\" " +
                                                                     BSky.GlobalResources.Properties.Resources.InDialogEditor);



                                return;
                            }
                            // Added by Aaron11/03/2013
                            //Commented the section below

                            //if (!setter.IsBinding)
                            //{
                            //    //Aaron 11/03/2013
                            //    //sets the value of the destination property
                            //    fepInfo.SetValue(fe, Convert.ChangeType(setter.Value, fepInfo.PropertyType), null);
                            //}
                            //else
                            //{
                            //    //Aaron 11/03/2013
                            //    //gets the source control name
                            //    object source = this.FindName(setter.SourceControlName);
                            //    if (source == null)
                            //        return;
                            //    Type sourceType = source.GetType();
                            //    //gets the property from the source control
                            //    PropertyInfo sourcePropInfo = sourceType.GetProperty(setter.SourcePropertyName);
                            //    //gets the value of the property from the source control
                            //    object val = sourcePropInfo.GetValue(source, null);

                            //    //Sets the destination value to the value of the property from the source control
                            //    fepInfo.SetValue(fe, Convert.ChangeType(val, fepInfo.PropertyType), null);
                            //}

                            try
                            {
                                fepInfo.SetValue(fe, Convert.ChangeType(setter.Value, fepInfo.PropertyType), null);
                                if (fepInfo == null)
                                {
                                    System.Windows.Forms.MessageBox.Show(BSky.GlobalResources.Properties.Resources.TheValue +
                                                                         " \"" + setter.Value + "\" " +
                                                                         BSky.GlobalResources.Properties.Resources.CantAssignToProp +
                                                                         " \"" + setter.PropertyName + "\" " +
                                                                         BSky.GlobalResources.Properties.Resources.CheckBehaviour +
                                                                         " \"" + ctrl.Name + "\" " +
                                                                         BSky.GlobalResources.Properties.Resources.InDialogEditor);
                                }
                            }


                            catch (FormatException e)
                            {
                                System.Windows.Forms.MessageBox.Show(BSky.GlobalResources.Properties.Resources.TheExceptionGenerated +
                                                                     " \"" + e.Message + "\"" + "\n" +
                                                                     BSky.GlobalResources.Properties.Resources.ThePropName +
                                                                     " \"" + setter.PropertyName + "\" " +
                                                                     BSky.GlobalResources.Properties.Resources.InCtrl +
                                                                     " \"" + setter.ControlName + "\" " +
                                                                     BSky.GlobalResources.Properties.Resources.CantSetValue +
                                                                     " \"" + setter.Value + "\" " +
                                                                     BSky.GlobalResources.Properties.Resources.PropCantAcceptVal + "\n" +
                                                                     BSky.GlobalResources.Properties.Resources.CheckBehaviour +
                                                                     " \"" + ctrl.Name + "\" " +
                                                                     BSky.GlobalResources.Properties.Resources.InDialogEditor);
                            }
                        }
                    } //Added by Aaron 05/16/2015, this is the end of the for loop
                }
            }
            CheckCanExecute();
        }
Exemplo n.º 28
0
 public ViewModelBase()
 {
     Behaviours = new BehaviourCollection(this, ViewContext.Container);
 }
 public SingleItemList()
 {
     SelectionChangeBehaviour = new BehaviourCollection();
 }
Exemplo n.º 30
0
 public TargetAggregate()
 {
     SelectionChangeBehaviour = new BehaviourCollection();
 }