本文整理汇总了C#中Util.GetAppPageImage方法的典型用法代码示例。如果您正苦于以下问题:C# Util.GetAppPageImage方法的具体用法?C# Util.GetAppPageImage怎么用?C# Util.GetAppPageImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Util
的用法示例。
在下文中一共展示了Util.GetAppPageImage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Controls_PageView
public Controls_PageView(string PageName)
{
XmlUtil x_util = new XmlUtil();
Util util = new Util();
//get page image
Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
PageImage.ImageUrl = util.GetAppPageImage(State, State["PageViewAppID"].ToString(), PageName);
PageImage.ID = PageName + "_PageImage";
PageImage.Attributes.Add("onclick", "goToPage('" + PageName + "');");
PageImage.Attributes.Add("onmouseover", "this.style.cursor='pointer';");
PageImage.Attributes.Add("onmouseout", "this.style.cursor='arrow';");
if (State["UseFullPageImage"] != null)
{
PageImage.Width = 320;
PageImage.Height = 460;
}
//get page fields
XmlDocument doc = x_util.GetStagingAppXml(State);
RadTreeNode PageRoot = new RadTreeNode(PageName);
PageRoot.CssClass = "RadTreeView";
PageRoot.ImageUrl = "../images/ascx.gif";
PageRoot.Category = "page";
PageRoot.Font.Size = FontUnit.Point(12);
OnePageView.Nodes.Add(PageRoot);
//do all fields
XmlNode page = doc.SelectSingleNode("//pages/page/name[. ='" + PageName + "']").ParentNode;
XmlNode fields = page.SelectSingleNode("fields");
if (fields != null)
{
//sort fields first
SortedList list = new SortedList();
SortableList<StoryBoardField> nameList = new SortableList<StoryBoardField>();
foreach (XmlNode child in fields.ChildNodes)
{
Hashtable dict = new Hashtable();
dict["field_type"] = child.Name;
XmlNode id_node = child.SelectSingleNode("id");
dict["id"] = id_node;
string input_field = id_node.InnerText.Trim();
if (child.SelectSingleNode("left") != null)
dict["left"] = child.SelectSingleNode("left").InnerText;
else
dict["left"] = "0";
if (child.SelectSingleNode("top") != null)
dict["top"] = child.SelectSingleNode("top").InnerText;
else
dict["top"] = "0";
dict["width"] = child.SelectSingleNode("width").InnerText;
dict["height"] = child.SelectSingleNode("height").InnerText;
string field_type = dict["field_type"].ToString();
if (field_type == "button" ||
field_type == "image_button" ||
field_type == "table" ||
field_type == "switch")
{
if(child.SelectSingleNode("submit") != null)
dict["submit"] = child.SelectSingleNode("submit").InnerText;
}
if (field_type == "table" )
{
XmlNodeList sub_fields = child.SelectNodes("table_fields/table_field/name");
ArrayList table_list = new ArrayList();
foreach (XmlNode sub_field in sub_fields)
{
table_list.Add(sub_field.InnerText);
}
dict["sub_fields"] = table_list;
}
else if (field_type == "picker")
{
XmlNodeList sub_fields = child.SelectNodes("picker_fields/picker_field/name");
ArrayList picker_list = new ArrayList();
foreach (XmlNode sub_field in sub_fields)
{
picker_list.Add(sub_field.InnerText);
}
dict["sub_fields"] = picker_list;
}
list[input_field] = dict;
nameList.Add(new StoryBoardField(id_node.InnerText.Trim(), Convert.ToInt32(dict["top"].ToString()), Convert.ToInt32(dict["left"].ToString())));
}
nameList.Sort("Top", true);
foreach (StoryBoardField input_field in nameList)
{
Hashtable dict = (Hashtable)list[input_field.FieldName];
string field_type = dict["field_type"].ToString();
RadTreeNode field_node = util.CreateFieldNode(PageRoot, input_field.FieldName, field_type);
field_node.Value = "left:" + dict["left"].ToString() + ";top:" + dict["top"].ToString() + ";width:" + dict["width"].ToString() + ";height:" + dict["height"].ToString() ;
if (dict["submit"] != null && dict["submit"].ToString().Length > 0 && dict["submit"].ToString() != ";")
{
field_node.BackColor = Color.PeachPuff;
string[] submit = dict["submit"].ToString().Split(";".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
string target_page_name = null;
//.........这里部分代码省略.........
示例2: ExportDesign_Click
protected void ExportDesign_Click(object sender, EventArgs e)
{
Util util = new Util();
Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
if (util.CheckSessionTimeout(State, Response, "../Default.aspx")) return;
try
{
XmlUtil x_util = new XmlUtil();
//get PDF file path
string path = Server.MapPath("../..") + @"\temp_files";
string file_name = State["SelectedApp"].ToString() + ".pdf";
file_name = file_name.Replace(" ", "_");
string save_file_path = path + @"\" + State["Username"].ToString() + "." + file_name;
//open PDF doc
var doc = new Document(PageSize.LETTER);
PdfWriter.GetInstance(doc, new FileStream(save_file_path, FileMode.Create));
doc.Open();
//get pages
string[] pages = x_util.GetAppPageNames(State, State["SelectedApp"].ToString());
//push content to PDF
foreach (string page in pages)
{
//get page image
string url = util.GetAppPageImage(State, State["PageViewAppID"].ToString(), page);
string[] fields = x_util.GetAppPageFields(State, State["SelectedApp"].ToString(), page);
StringBuilder fields_string = new StringBuilder();
bool isFirst = true;
foreach (string field in fields)
{
if (isFirst)
isFirst = false;
else
fields_string.Append(", ");
fields_string.Append(field);
}
doc.Add(new Paragraph("Page: " + page));
if (fields.Length == 0)
{
doc.Add(new Paragraph("There are no fields on this page"));
doc.NewPage();
continue;
}
doc.Add(new Paragraph("Fields: " + fields_string.ToString()));
doc.Add(new Paragraph(" "));
try
{
iTextSharp.text.Image image = iTextSharp.text.Image.GetInstance(new Uri(url));
image.Border = Rectangle.BOX;
image.BorderColor = BaseColor.BLACK;
image.BorderWidth = 1f;
if (State["SelectedDeviceType"].ToString() == Constants.IPAD ||
State["SelectedDeviceType"].ToString() == Constants.ANDROID_TABLET)
image.ScaleToFit(450f, 600f);
else
image.ScaleToFit(320f, 460f);
doc.Add(image);
}
catch (Exception ex0)
{ } //bad image url exception - skip
doc.NewPage();
}
doc.Close();
doPopup.Text = "../../temp_files/" + State["Username"].ToString() + "." +file_name;
}
catch (Exception ex)
{
throw new Exception(ex.Message + ": " + ex.StackTrace);
}
}