Example #1
0
    /// <summary>
    /// Loads selected item parameters into the selector.
    /// </summary>
    public void LoadItemConfiguration()
    {
        // Load properties
        ItemProperties.LoadItemProperties(Parameters);
        pnlUpdateProperties.Update();

        // Remember item to colorize
        ItemToColorize = NodeID.Replace("\\", "\\\\").Replace("'", "\\'");
    }
Example #2
0
    /// <summary>
    /// Performs actions necessary to select particular item from a list.
    /// </summary>
    private void SelectMediaItem(string argument)
    {
        if (!string.IsNullOrEmpty(argument))
        {
            string[] argArr = argument.Split(ARG_SEPARATOR);
            if (argArr.Length >= 2)
            {
                // Get information from argument
                string path   = argArr[0];
                string size   = ValidationHelper.GetString(argArr[1], string.Empty);
                bool   isFile = ValidationHelper.GetBoolean(argArr[2], true);

                bool avoidPropUpdate = ItemToColorize.EqualsCSafe(path, true);

                if ((isFile) && (File.Exists(path)))
                {
                    FileInfo fi = FileInfo.New(path);
                    path = fi.FullName;
                }
                else
                {
                    if (Directory.Exists(path))
                    {
                        DirectoryInfo di = DirectoryInfo.New(path);
                        path = di.FullName;
                    }
                }

                ItemToColorize = path.Replace("\\", "\\\\").Replace("'", "\\'").ToLowerCSafe();

                if (!avoidPropUpdate)
                {
                    // Get selected properties from session
                    Hashtable selectedParameters = SessionHelper.GetValue("DialogSelectedParameters") as Hashtable ?? new Hashtable();

                    // Update selected properties
                    selectedParameters[DialogParameters.ITEM_PATH]          = path;
                    selectedParameters[DialogParameters.ITEM_RESOLVED_PATH] = URLHelper.ResolveUrl(path);
                    selectedParameters[DialogParameters.ITEM_SIZE]          = size;
                    selectedParameters[DialogParameters.ITEM_ISFILE]        = isFile;
                    selectedParameters[DialogParameters.ITEM_RELATIVEPATH]  = Config.StartingPath.StartsWithCSafe("~");

                    // Force media properties control to load selected item
                    ItemProperties.LoadItemProperties(selectedParameters);

                    SessionHelper.SetValue("DialogSelectedParameters", selectedParameters);
                    // Update properties panel
                    PropertiesUpdatePanel.Update();
                }
            }
        }
    }
    /// <summary>
    /// Loads selected item parameters into the selector.
    /// </summary>
    /// <param name="properties">Name-value collection representing item to load</param>
    public void LoadSelectedItem(Hashtable properties)
    {
        if ((properties != null) && (properties.Count > 0))
        {
            Hashtable temp = (Hashtable)properties.Clone();

            if ((properties[DialogParameters.AV_URL] != null) && ((properties[DialogParameters.LAST_TYPE] == null) || ((MediaTypeEnum)properties[DialogParameters.LAST_TYPE] == MediaTypeEnum.AudioVideo)))
            {
                drpMediaType.SelectedValue = "av";
                txtUrl.Text = properties[DialogParameters.AV_URL].ToString();
            }
            else if ((properties[DialogParameters.FLASH_URL] != null) && ((properties[DialogParameters.LAST_TYPE] == null) || ((MediaTypeEnum)properties[DialogParameters.LAST_TYPE] == MediaTypeEnum.Flash)))
            {
                drpMediaType.SelectedValue = "flash";
                txtUrl.Text = properties[DialogParameters.FLASH_URL].ToString();
            }
            else if ((properties[DialogParameters.IMG_URL] != null) && ((properties[DialogParameters.LAST_TYPE] == null) || ((MediaTypeEnum)properties[DialogParameters.LAST_TYPE] == MediaTypeEnum.Image)))
            {
                drpMediaType.SelectedValue = "image";

                // Update URL
                string url = ValidationHelper.GetString(properties[DialogParameters.IMG_URL], "");
                txtUrl.Text = url;

                // Get original dimensions
                GetExternalImageDimensions(url);

                temp[DialogParameters.IMG_ORIGINALWIDTH]  = mWidth;
                temp[DialogParameters.IMG_ORIGINALHEIGHT] = mHeight;
            }
            else if ((properties[DialogParameters.URL_URL] != null) && ((properties[DialogParameters.LAST_TYPE] == null) || ((MediaTypeEnum)properties[DialogParameters.LAST_TYPE] == MediaTypeEnum.Unknown)))
            {
                txtUrl.Text = properties[DialogParameters.URL_URL].ToString();
            }
            if (!String.IsNullOrEmpty(txtUrl.Text))
            {
                ShowProperties();
                // Load temp properties because ShowProperties() change original properties
                ItemProperties.LoadItemProperties(temp);
            }
        }
    }