コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="nu"></param>
        private void UpdateReturnInfoByNU(NameUse nu)
        {
            VariableDeclaration vdNameUse = FindFieldVarDecl(nu);

            if (vdNameUse != null)
            {
                GetSelfFields.Add(vdNameUse);
            }
            else
            {
                //update if assignedVar is a local variable
                var lVarInfo = FindLocalVarInfo(nu);
                if (lVarInfo != null)
                {
                    foreach (var vd in lVarInfo.AssignedFields)
                    {
                        PropertyFields.Add(vd);
                    }
                    lVarInfo.IsReturned = true;
                }
                //update if assignedVar is a paramether
                var pVarInfo = FindParaVarInfo(nu);
                if (pVarInfo != null)
                {
                    foreach (var vd in pVarInfo.AssignedFields)
                    {
                        PropertyFields.Add(vd);
                    }
                    pVarInfo.IsReturned = true;
                }
            }
        }
コード例 #2
0
        private void RegisterServerBoundControl(IServerBoundControl control)
        {
            string id = control.FieldId;

            if (id != null)
            {
                // Check for attribute suffix, field_@DayOfWeek or field_@label
                if (control is IEditableControl && id.IndexOf(".@") > 0)
                {
                    int p = id.IndexOf(".@");

                    if (p + 2 < id.Length)
                    {
                        string property = id.Substring(p + 2);

                        id = id.Substring(0, p);

                        if (!PropertyFields.ContainsKey(id))
                        {
                            PropertyFields.Add(id, new Dictionary <IEditableControl, string>());
                        }

                        PropertyFields[id].Add((IEditableControl)control, property);
                    }
                }

                Controls.Add(control);
            }
        }
コード例 #3
0
        private void PublishResponseToEditableControl(IServerBoundControl control, XElement publishElement)
        {
            IEditableControl editableControl = (IEditableControl)control;

            if (publishElement.Attribute(Common.PublishFieldDisabled) != null)
            {
                editableControl.SetEditable(!Common.boolValue(publishElement.Attribute(Common.PublishFieldDisabled).Value));
            }

            if (HasPropertyFields)
            {
                string id = publishElement.Attribute(Common.IDAttrib).Value;

                if (FixedContext != null)
                {
                    id = id.Substring(FixedContext.Length + 1);
                }

                if (PropertyFields.ContainsKey(id))
                {
                    IDictionaryEnumerator de = PropertyFields[id].GetEnumerator();

                    while (de.MoveNext())
                    {
                        foreach (XAttribute a in publishElement.Attributes())
                        {
                            if (a.Name == de.Value.ToString())
                            {
                                IEditableControl ec = (IEditableControl)de.Key;
                                ec.SetValue(a.Value);
                                break;
                            }
                        }
                    }
                }
            }
        }
 public void AppendPropertyField(ConfigurationObjectField field)
 {
     PropertyFields.Add(field.Name, field);
 }
コード例 #5
0
        public override void LoadView()
        {
            this.SendMessageSuper(PropertyPageDummyMainControllerClass, "loadView");

            PropertyFields.Add(new RmPropertyPageColorChooserButtonField()
            {
                View                    = ColorButton,
                CanToggleEnabled        = true,
                AvailableInBulkEditMode = true
            });

            PropertyFields.Add(new RmPropertyPageIconButtonField()
            {
                View                    = IconButton,
                CanToggleEnabled        = true,
                AvailableInBulkEditMode = true
            });

            PropertyFields.Add(new RmPropertyPageDummyField()
            {
                View  = imageViewHeader,
                Image = Icon.Icon48
            });

            PropertyFields.Add(new RmPropertyPageDummyField()
            {
                LabelView = textFieldDescription,
                LabelText = "With a Remote Desktop connection you can connect to remote computers supporting RDP (Remote Desktop Protocol, Standard Port is 3389). You can change the port in the Advanced section.".TLL()
            });

            PropertyFields.Add(new RmPropertyPageStringTextField()
            {
                PropertyName             = "Name",
                View                     = textFieldDisplayName,
                PlaceholderText          = "Display Name".TL(),
                LabelView                = textFieldDisplayNameLabel,
                LabelText                = "Display Name:".TL(),
                FocusField               = true,
                DisabledIfDefaultSetting = true,
                CanToggleEnabled         = true,
                ValidationCallback       = (field) => {
                    string retVal = string.Empty;

                    if (!field.CurrentObject.IsDefaultSetting &&
                        !IsInBulkEditMode)
                    {
                        bool isDisplayNameRequired = !IsInBulkAddMode;
                        bool displayNameOk         = !NSString.IsNullOrEmpty(textFieldDisplayName.StringValue);

                        if (isDisplayNameRequired &&
                            !displayNameOk)
                        {
                            retVal = "The \"Display Name\" must not be empty.".TL();
                        }
                    }

                    return(retVal);
                },
                SaveSetObjectValueCallback = (field, obj) => {
                    if (!obj.IsDefaultSetting)
                    {
                        field.SetObjectValue(obj);
                    }
                }
            });

            PropertyFields.Add(new RmPropertyPageStringTextField()
            {
                PropertyName             = "URI",
                View                     = textFieldComputerName,
                PlaceholderText          = "Computer Name (IP/FQDN)".TL(),
                LabelView                = textFieldComputerNameLabel,
                LabelText                = "Computer Name:".TL(),
                DisabledIfDefaultSetting = true,
                CanToggleEnabled         = true,
                ToggleEnabledCallback    = (field, enabled) => {
                    field.View.CastTo <NSControl>().IsEnabled      = enabled;
                    field.LabelView.CastTo <NSControl>().IsEnabled = enabled;
                },
                ValidationCallback = (field) => {
                    string retVal = string.Empty;

                    if (!field.CurrentObject.IsDefaultSetting &&
                        !IsInBulkEditMode)
                    {
                        bool computerNameOk = !NSString.IsNullOrEmpty(textFieldComputerName.StringValue);

                        if (!computerNameOk)
                        {
                            retVal = "The \"Computer Name\" must not be empty.".TLL();
                        }
                    }

                    return(retVal);
                },
                LoadSetUiValueCallback = (field, obj) => {
                    buttonComputerNameEditor.IsEnabled = (!obj.IsDefaultSetting && EditMode == ObjectEditMode.EditMode_New);

                    field.SetUiValue(field.GetObjectValue(obj));
                },
                SaveSetObjectValueCallback = (field, obj) => {
                    if (!obj.IsDefaultSetting)
                    {
                        field.SetObjectValue(obj);
                    }
                }
            });

            PropertyFields.Add(new RmPropertyPageStringTextField()
            {
                PropertyName            = "Description",
                View                    = textFieldDescription,
                PlaceholderText         = "Description".TL(),
                LabelView               = textFieldDescriptionLabel,
                LabelText               = "Description:".TL(),
                CanToggleEnabled        = true,
                AvailableInBulkEditMode = true
            });

            PropertyFields.Add(new RmPropertyPageStringTextField()
            {
                PropertyName            = "PhysicalAddress",
                View                    = textFieldPhysicalAddress,
                PlaceholderText         = "Physical Address".TL(),
                LabelView               = textFieldPhysicalAddressLabel,
                LabelText               = "Physical Address:".TL(),
                CanToggleEnabled        = true,
                AvailableInBulkEditMode = true
            });

            PropertyFields.Add(new RmPropertyPageMetaDataField()
            {
                PropertyName = "MetaData",
                View         = metadataView
            });

            NSNotificationCenter.DefaultCenter.AddObserverSelectorNameObject(this, "windowDidUpdate:".ToSelector(), NSWindow.NSWindowDidUpdateNotification, this.View.Window);
        }