Exemplo n.º 1
0
        protected override void OnPreRender(EventArgs e)
        {
            if (!IsPostBack)
            {
                DataBind();
            }
            FieldLabel.Text     = GetMetaDataValue("Name", Attribute.StaticName);
            FieldLabel.HelpText = GetMetaDataValue <string>("Notes");

            bool Value = false;

            if (Boolean.TryParse(FieldValueEditString, out Value))
            {
                CheckBox1.Checked = Value;
            }
            else if (MetaData.ContainsKey("DefaultValue") && !String.IsNullOrEmpty(((IAttribute <string>)MetaData["DefaultValue"]).Typed[DimensionIds]) && Boolean.TryParse(((IAttribute <string>)MetaData["DefaultValue"]).Typed[DimensionIds], out Value))
            {
                CheckBox1.Checked = Value;
            }
            else
            {
                CheckBox1.Checked = false;
            }

            base.OnPreRender(e);
        }
Exemplo n.º 2
0
        /// <summary>
        /// </summary>
        /// <param name="key"></param>
        /// <param name="defaultValue"></param>
        /// <returns></returns>
        public string GetMetadata(string key, string defaultValue = "")
        {
            if (!MetaData.ContainsKey(key))
            {
                MetaData.Add(key, defaultValue);
            }

            return(MetaData[key]);
        }
Exemplo n.º 3
0
 public dynamic ToJson()
 {
     return(new
     {
         Title = MetaData != null && MetaData.ContainsKey("Title") ? MetaData["Title"] : string.Empty,
         Author = MetaData != null && MetaData.ContainsKey("Author") ? MetaData["Author"] : string.Empty,
         Subject = MetaData != null && MetaData.ContainsKey("Subject") ? MetaData["Subject"] : string.Empty,
         NumberOfPages = NumberOfPages,
         FilePath = FileInfo.FullName,
         BookMarks = BookMarks
     });
 }
Exemplo n.º 4
0
        public void AddMetaData(string key, string value)
        {
            if (true == MetaData.ContainsKey(key))
            {
                throw new ArgumentException(
                          "A duplicate key was attempted to be adding to the metadata. " +
                          "I believe this needs to be unique, so I developed the library as such " +
                          "but I've never actually asked VoiceLabs if it's required and just assumed.",
                          "key");
            }

            MetaData.Add(key, new AnalyticsSlot(key, value));
        }
        public override string GetMetaData()
        {
            string sMetaKey = "";

            lock (_MutexObj)
            {
                if (MetaData.ContainsKey(MetaTag))
                {
                    sMetaKey = MetaData[MetaTag];
                }
            }
            return(sMetaKey);
        }
 public override void AddMetaData(string metaValue)
 {
     lock (_MutexObj)
     {
         if (MetaData.ContainsKey(MetaTag))
         {
             MetaData[MetaTag] = metaValue;
         }
         else
         {
             MetaData.Add(MetaTag, metaValue);
         }
     }
 }
 public override bool SetPropertyData(string key, string data)
 {
     lock (_MutexObj)
     {
         if (MetaData.ContainsKey(key))
         {
             MetaData[key] = data;
         }
         else
         {
             MetaData.Add(key, data);
         }
     }
     return(true);
 }
 public override bool GetPropertyData(string key, out string data)
 {
     data = null;
     lock (_MutexObj)
     {
         if (MetaData.ContainsKey(key))
         {
             if (MetaData[key] != null)
             {
                 data = MetaData[key];
             }
         }
     }
     return(true);
 }
Exemplo n.º 9
0
        override public void Initialize(DrawArgs drawArgs)
        {
            Camera = DrawArgs.Camera;

            // Initialize download rectangles
            if (DownloadInProgressTexture == null)
            {
                DownloadInProgressTexture = CreateDownloadRectangle(
                    DrawArgs.Device, World.Settings.DownloadProgressColor, 0);
            }
            if (DownloadQueuedTexture == null)
            {
                DownloadQueuedTexture = CreateDownloadRectangle(
                    DrawArgs.Device, World.Settings.DownloadQueuedColor, 0);
            }
            if (DownloadTerrainTexture == null)
            {
                DownloadTerrainTexture = CreateDownloadRectangle(
                    DrawArgs.Device, World.Settings.DownloadTerrainRectangleColor, 0);
            }

            try
            {
                lock (m_topmostTiles.SyncRoot)
                {
                    foreach (QuadTile qt in m_topmostTiles.Values)
                    {
                        qt.Initialize();
                    }
                }
            }
            catch
            {
            }
            isInitialized = true;


            if (MetaData.ContainsKey("EffectPath"))
            {
                m_effectPath = MetaData["EffectPath"] as string;
            }
            else
            {
                m_effectPath = null;
            }
            m_effect = null;
        }
Exemplo n.º 10
0
 /// <summary>
 /// </summary>
 /// <param name="key"></param>
 /// <param name="value"></param>
 public void SetMetadata(string key, string value)
 {
     if (!MetaData.ContainsKey(key))
     {
         MetaData.Add(key, value);
     }
     else
     {
         if (value == "")
         {
             MetaData.Remove(key);
         }
         else
         {
             MetaData[key] = value;
         }
     }
 }
Exemplo n.º 11
0
        public override bool SetSourceData(byte[] data, string documentId, bool overwrite)
        {
            lock (_MutexObj)
            {
                FileData = data == null ? null : Convert.ToBase64String(data);
                FileId   = documentId;

                if (MetaData.ContainsKey(DocumentReplace))
                {
                    MetaData[DocumentReplace] = overwrite.ToString();
                }
                else
                {
                    MetaData.Add(DocumentReplace, overwrite.ToString());
                }
            }
            return(true);
        }
Exemplo n.º 12
0
 public override bool ClearPropertyData(string key)
 {
     lock (_MutexObj)
     {
         if (!string.IsNullOrEmpty(key))
         {
             if (MetaData.ContainsKey(key))
             {
                 MetaData.Remove(key);
             }
         }
         else
         {
             MetaData.Clear();
         }
     }
     return(true);
 }
Exemplo n.º 13
0
 private string _getFirstValue(string key)
 {
     return(MetaData.ContainsKey(key) ? MetaData[key].FirstOrDefault() ?? string.Empty : string.Empty);
 }
Exemplo n.º 14
0
        /// <summary>
        /// The code that should run once when a control is loaded
        /// Base code should have "virtual"
        /// Derived classes should have "override"
        /// </summary>
        public virtual void InitializeFieldTemplate()
        {
            string DefaultValue = GetMetaDataValue(MetaDataDefaultValueKey, "");

            // Do things depending which InputType this control has set
            if (InputType == InputTypes.Wysiwyg)
            {
                TextBox1.Visible    = false;
                Texteditor1.Visible = true;

                //if (MetaData.ContainsKey(MetaDataWysiwygHeightKey))
                //{
                var WysiwygHeight = GetMetaDataValue(MetaDataWysiwygHeightKey, new decimal?());     // (((IAttribute<decimal?>)(MetaData[MetaDataWysiwygHeightKey]))).Typed[DimensionIds];
                if (WysiwygHeight.HasValue)
                {
                    Texteditor1.Height = new Unit(Convert.ToInt32(WysiwygHeight));
                }
                //}
                if (MetaData.ContainsKey(MetaDataWysiwygWidthKey))
                {
                    var WysiwygWidth = (((IAttribute <decimal?>)(MetaData[MetaDataWysiwygWidthKey]))).Typed[DimensionIds];
                    if (WysiwygWidth.HasValue)
                    {
                        Texteditor1.Width = new Unit(Convert.ToInt32(WysiwygWidth));
                    }
                }

                if (FieldValueEditString != null)
                {
                    Texteditor1.Text = FieldValueEditString;
                }
                else
                {
                    Texteditor1.Text = DefaultValue;
                }

                Texteditor1.ChooseMode = false;
            }
            else if (InputType == InputTypes.DropDown)
            {
                TextBox1.Visible  = false;
                DropDown1.Visible = true;
                if (!String.IsNullOrEmpty(GetMetaDataValue <string>(MetaDataDrowdownValuesKey)))
                {
                    DropDown1.DataSource = (from c in GetMetaDataValue <string>(MetaDataDrowdownValuesKey).Replace("\r", "").Split('\n')
                                            select new
                    {
                        Text = c.Contains(':') ? (c.Split(':'))[0] : c,
                        Value = c.Contains(':') ? (c.Split(':'))[1] : c
                    }).ToList();
                }
                DropDown1.DataBind();

                if (!String.IsNullOrEmpty(FieldValueEditString))
                {
                    if (DropDown1.Items.Cast <ListItem>().All(i => i.Value != FieldValueEditString))
                    {
                        DropDown1.Items.Insert(0, new ListItem(FieldValueEditString + " (keep old value)", FieldValueEditString));
                    }
                    DropDown1.SelectedValue = FieldValueEditString;
                }

                if (FieldValueEditString == null)
                {
                    DropDown1.SelectedValue = DefaultValue;
                }
            }
            else if (InputType == InputTypes.Link)
            {
                TextBox1.Visible = false;
                DnnUrl1.Visible  = true;

                DnnUrl1.Url = FieldValueEditString;
            }
            else
            {
                // Row Count of multiline field
                var metaDataRowCount = GetMetaDataValue <decimal?>(MetaDataRowCountKey);
                if (metaDataRowCount.HasValue && metaDataRowCount > 0)
                {
                    TextBox1.Rows = Convert.ToInt32(metaDataRowCount.Value.ToString());
                    if (TextBox1.Rows > 1)
                    {
                        TextBox1.TextMode = System.Web.UI.WebControls.TextBoxMode.MultiLine;
                    }
                }

                if (GetMetaDataValue <bool>(MetaDataIsRequiredKey))
                {
                    TextBox1.CssClass += " dnnFormRequired";
                }

                var metaDataLength = GetMetaDataValue <int?>(MetaDataLengthKey);
                if (metaDataLength.HasValue && metaDataLength > 0)
                {
                    TextBox1.MaxLength = metaDataLength.Value;
                }

                TextBox1.ToolTip = GetMetaDataValue <string>(MetaDataNotesKey);

                if (FieldValueEditString != null)
                {
                    TextBox1.Text = FieldValueEditString;
                }
                else
                {
                    TextBox1.Text = DefaultValue;
                }
            }

            if (ShowDataControlOnly)
            {
                FieldLabel.Visible = false;
            }

            valFieldValue.DataBind();

            var metaRegularExpressions = GetMetaDataValue <string>(MetaDataRegularExpression);

            if (!String.IsNullOrEmpty(metaRegularExpressions))
            {
                valRegularExpression.ValidationExpression = metaRegularExpressions;
            }
            valRegularExpression.DataBind();
        }