/// <summary> /// Handles the Click event of the buttonAddMediaCP control. /// </summary> /// <param name="o">The source of the event.</param> /// <param name="ea">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void buttonAddMediaCP_Click(Object o, EventArgs ea) { _mediaChooser.Save(); if (!string.IsNullOrEmpty(_textboxLinkTitle.Text) && _mediaChooserExtractor.Value != null && _mediaChooserExtractor.Value.ToString() != "") { string value = "m" + (_checkNewWindow.Checked ? "n" : "o") + _mediaChooserExtractor.Value.ToString(); _listboxLinks.Items.Add(new ListItem(_textboxLinkTitle.Text, value)); resetInputMedia(); ScriptManager.RegisterClientScriptBlock(_mediaChooser, _mediaChooser.GetType(), "clearMediaChooser", "mc_" + _mediaChooser.ClientID + ".ClearSelection();", true); } }
/// <summary> /// Saves this instance. /// </summary> public void Save() { BackgroundMediaChooser.Save(); _dataType.DBType = DBTypes.Nvarchar; UpdatePreValue(0, FontNameDropDownList.SelectedItem.Text); UpdatePreValue(1, CustomFontPathTextBox.Text); UpdatePreValue(2, FontSizeTextBox.Text); var commaSepratedList = string.Join(",", (from ListItem listItem in FontStyleCheckBoxList.Items where listItem.Selected select listItem.Value).ToArray()); UpdatePreValue(3, commaSepratedList); UpdatePreValue(4, ForegroundColorPicker.Value); UpdatePreValue(5, BackgroundColorPicker.Value); UpdatePreValue(6, ShadowColorPicker.Value); UpdatePreValue(7, HorizontalAlignmentDropDownList.SelectedItem.Text); UpdatePreValue(8, VerticalAlignmentDropDownList.SelectedItem.Text); UpdatePreValue(9, ImageHeightTextBox.Text); UpdatePreValue(10, ImageWidthTextBox.Text); UpdatePreValue(11, BackgroundMediaChooser.Value); UpdatePreValue(12, ImageFormatDropDownList.SelectedItem.Text); var sampleText = FontName + " " + FontSize + " " + OutputFormat; var imageParameters = new TextImageParameters(sampleText, OutputFormat, CustomFontPath, FontName, FontSize, FontStyles, ForegroundColor, BackgroundColor, ShadowColor, HorizontalAlignment, VerticalAlignment, ImageHeight, ImageWidth, BackgroundMedia); var imageUrl = MediaHelper.SaveTextImage(imageParameters, "Preview" + Page.Request["id"]); UpdatePreValue(13, imageUrl); }