当前位置: 首页>>代码示例>>C#>>正文


C# Util.UpdateStagingAppXml方法代码示例

本文整理汇总了C#中Util.UpdateStagingAppXml方法的典型用法代码示例。如果您正苦于以下问题:C# Util.UpdateStagingAppXml方法的具体用法?C# Util.UpdateStagingAppXml怎么用?C# Util.UpdateStagingAppXml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Util的用法示例。


在下文中一共展示了Util.UpdateStagingAppXml方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddDataSourceToPage

    public void AddDataSourceToPage(Hashtable State, string data_source_id)
    {
        XmlDocument xmlDoc = GetStagingAppXml(State);
        XmlNode data_source_id_node = xmlDoc.SelectSingleNode("//application/data_sources/data_source/data_source_id[.='" + data_source_id + "']");
        if (data_source_id == null)
        {
            return;
        }
        XmlNode page = xmlDoc.SelectSingleNode("//pages/page/name[.='" + State["SelectedAppPage"].ToString() + "']").ParentNode;
        XmlNode data_sources = page.SelectSingleNode("data_sources");
        if (data_sources == null)
            data_sources = CreateNode(xmlDoc, page, "data_sources");
        XmlNode page_data_source = CreateNode(xmlDoc, data_sources, "data_source");

        CreateNode(xmlDoc, page_data_source, "data_source_id", data_source_id);
        XmlNode event_node = CreateNode(xmlDoc, page_data_source, "event");
        CreateNode(xmlDoc, event_node, "data_source_event_type", "page");
        CreateNode(xmlDoc, event_node, "data_source_operations");
        State["AppXmlDoc"] = xmlDoc;
        Util util = new Util();
        util.UpdateStagingAppXml(State);
    }
开发者ID:dcolonvizi,项目名称:ViziAppsPortal,代码行数:22,代码来源:DataSources.cs

示例2: SaveWebServiceInfo_Click

    protected void SaveWebServiceInfo_Click(object sender, EventArgs e)
    {
        Util util = new Util();
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        if (util.CheckSessionTimeout(State, Response, "../../Default.aspx.aspx")) return;

        ClearMessages();

        if (WebServiceURL.Text.Length == 0)
        {
            SaveWebServiceInfoMessage.Text = "Enter Web Service URL";
            return;
        }
        //save in app xml
        XmlUtil x_util = new XmlUtil();
        XmlDocument doc = util.GetStagingAppXml(State);
        XmlNode root = doc.SelectSingleNode("app_project");
        if (root == null)
            root = doc.SelectSingleNode("mobiflex_project");

        XmlNode database_config = doc.SelectSingleNode("//database_config");
        if (database_config == null)
        {
            database_config = x_util.CreateNode(doc, root, "database_config");
        }

        XmlNode database_webservice_url = doc.SelectSingleNode("database_webservice_url");
        if (database_webservice_url == null)
            x_util.CreateNode(doc, database_config, "database_webservice_url", WebServiceURL.Text);
        else
            database_webservice_url.InnerText = WebServiceURL.Text;

        util.UpdateStagingAppXml(State);

         ((Hashtable)HttpRuntime.Cache[Session.SessionID])["DBWebServiceURL"] = WebServiceURL.Text;

        SaveWebServiceInfoMessage.Text = "Your Web Service URL has been saved.";
    }
开发者ID:dcolonvizi,项目名称:ViziAppsPortal,代码行数:38,代码来源:DBWebService.aspx.cs

示例3: SetFirstPageName

 public void SetFirstPageName(Hashtable State,string first_page_name)
 {
     XmlDocument xmlDoc = GetStagingAppXml(State);
     XmlNode first_page_name_node = xmlDoc.SelectSingleNode("//pages/first_page_name");
     if (first_page_name_node != null)
     {
         first_page_name_node.InnerText = first_page_name;
      }
     else
     {
         XmlNode pages_node = xmlDoc.SelectSingleNode("//pages");
         CreateNode(xmlDoc, pages_node, "first_page_name", first_page_name);
     }
     Util util = new Util();
     State["AppXmlDoc"] = xmlDoc;
     util.UpdateStagingAppXml(State);
 }
开发者ID:dcolonvizi,项目名称:ViziAppsPortal,代码行数:17,代码来源:XmlUtil.cs

示例4: ResetDatabaseConfig_Click

    protected void ResetDatabaseConfig_Click(object sender, EventArgs e)
    {
        XmlUtil x_util = new XmlUtil();
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        if (State == null || State.Count <= 2) { SessionTimeOut.Text = "../../Default.aspx"; return; }

        Util util = new Util();
        XmlDocument doc = util.GetStagingAppXml(State);
        XmlNode page_name = doc.SelectSingleNode("//pages/page/name[.='" + State["SelectedAppPage"].ToString() + "']");
        XmlNode data_sources = page_name.ParentNode.SelectSingleNode("data_sources");
        if (data_sources == null)
        {
            Message.Text = "There was an internal error with your design. Please notify ViziApps: " +  HttpRuntime.Cache["TechSupportEmail"].ToString();
            return;
        }
        XmlNodeList list = data_sources.SelectNodes("data_source");
        XmlNode data_source = list[(int)State["PageDataSourceIndex"]];
        XmlNode event_node = null;
        if (State["DataSourceEventField"] == null) //page type
        {
            XmlNode temp_data_source_event_type = data_source.SelectSingleNode("event/data_source_event_type[.='page']");
            if (temp_data_source_event_type != null)
                event_node = temp_data_source_event_type.ParentNode;
        }
        else //field type
        {
            XmlNode temp_data_source_event_field = data_source.SelectSingleNode("event/data_source_event_field[.='" + State["DataSourceEventField"].ToString() + "']");
            if (temp_data_source_event_field != null)
                event_node = temp_data_source_event_field.ParentNode;
        }
        if(event_node != null)
         data_source.RemoveChild(event_node);

        State["AppXmlDoc"] = doc;
        util.UpdateStagingAppXml(State);

        State["DBCommands"] = null;

        Message.Text = "All Query Commands for this event field have been deleted.";
        RefreshCommandsView();
        Message.ForeColor = Color.Maroon;
        SpreadsheetCommandsView.Nodes.Clear();
        CreateSpreadsheetRootNode();
    }
开发者ID:dcolonvizi,项目名称:ViziAppsPortal,代码行数:44,代码来源:GoogleSpreadsheetOperations.aspx.cs

示例5: BuildWebServiceDataTrees

    /******************************************* Web Service Functions *************************************/
    protected void BuildWebServiceDataTrees(string event_name)
    {
        string event_field = event_name;
        string button_id = event_name;
        RadComboBoxItem item = WebServiceEvents.Items.FindItemByText(event_name);
        WebServiceEvents.SelectedIndex = item.Index;
        if (event_name.Contains("->"))
        {
            DataMultiPage.SelectedIndex = 3;
            return;
        }
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        string app = State["SelectedApp"].ToString();

        string[] page_names = item.Value.Split(":".ToCharArray());
        string from_page = page_names[0];
        string to_page = page_names[1];
        if (to_page == "_this_page")
            to_page = from_page;
        PhoneRequestTreeView.Nodes.Clear();
        WebServiceInputTreeView.Nodes.Clear();
        PhoneResponseTreeView.Nodes.Clear();
        WebServiceResponseTreeView.Nodes.Clear();

        RadTreeNode WebServiceInputRoot = new RadTreeNode(event_field);
        WebServiceInputRoot.CssClass = "RadTreeView";
        WebServiceInputRoot.ImageUrl = "~/images/editor_images/button.png";
        WebServiceInputTreeView.Nodes.Add(WebServiceInputRoot);

        RadTreeNode WebServiceResponseRoot = new RadTreeNode(event_field);
        WebServiceResponseRoot.CssClass = "RadTreeView";
        WebServiceResponseRoot.ImageUrl = "~/images/editor_images/button.png";
        WebServiceResponseTreeView.Nodes.Add(WebServiceResponseRoot);

        Util util = new Util();
        XmlUtil x_util = new XmlUtil();
        XmlDocument doc = util.GetStagingAppXml(State, app);
        XmlNode root = doc.SelectSingleNode("app_project");
        if (root == null)
            root = doc.SelectSingleNode("mobiflex_project");

        XmlNode phone_data_requests = doc.SelectSingleNode("//phone_data_requests");
        bool update_xml = false;
        if (phone_data_requests == null)
        {
             phone_data_requests = x_util.CreateNode(doc, root, "phone_data_requests");
             update_xml = true;
        }

        XmlNode web_service_data_responses = doc.SelectSingleNode("//web_service_data_responses");
        if (web_service_data_responses == null)
        {
            web_service_data_responses = x_util.CreateNode(doc, root, "web_service_data_responses");
            update_xml = true;
        }
        if (update_xml)
        {
            State["AppXmlDoc"] = doc;
            util.UpdateStagingAppXml(State);
        }

        Hashtable input_to_event_map = new Hashtable();

        XmlNodeList pages = doc.SelectNodes("//pages/page");
        foreach (XmlNode page in pages)
        {
            XmlNode page_name_node = page.SelectSingleNode("name");
            string page_name = page_name_node.InnerText;
            RadTreeNode PhoneRequestRoot = null;
            RadTreeNode PhoneResponseRoot = null;
            if (page_name == from_page || SeeAllPages.Checked)
            {
                PhoneRequestRoot = new RadTreeNode(page_name);
                PhoneRequestRoot.CssClass = "RadTreeView";
                PhoneRequestRoot.ImageUrl = "~/images/ascx.gif";
                PhoneRequestTreeView.Nodes.Add(PhoneRequestRoot);
            }
            if (page_name == to_page || SeeAllPages.Checked)
            {
                PhoneResponseRoot = new RadTreeNode(page_name);
                PhoneResponseRoot.CssClass = "RadTreeView";
                PhoneResponseRoot.ImageUrl = "~/images/ascx.gif";
                PhoneResponseTreeView.Nodes.Add(PhoneResponseRoot);
                PhoneResponseRoot.Category = "page";
            }

            if (page_name != from_page && page_name != to_page && !SeeAllPages.Checked)
                continue;

            //do inputs from phone
            XmlNodeList input_nodes = page.SelectNodes("fields/text_area | fields/label | fields/text_field | fields/hidden_field");

            foreach (XmlNode input_node in input_nodes)
            {
                // phone input field
                XmlNode id_node = input_node.SelectSingleNode("id");
                if (page_name == from_page || SeeAllPages.Checked)
                {
                    string input_field = id_node.InnerText.Trim();
//.........这里部分代码省略.........
开发者ID:dcolonvizi,项目名称:ViziAppsPortal,代码行数:101,代码来源:ManageData.aspx.cs

示例6: BuildDatabaseTrees

    /************************************************ Database and Google Docs Functions ********************************/
    protected void BuildDatabaseTrees(string event_name)
    {
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        if (State["ManageDataType"].ToString() == "database")
        {
            if ( State["DBConnectionString"] != null)
                ViewConnectionString.Visible = true;
            else
                ViewConnectionString.Visible = false;
        }

         State["SelectedDBEvent"] = event_name;
        string event_field = event_name;
        string button_id = event_name;
        RadComboBoxItem item = null;
        if ( State["ManageDataType"].ToString() == "database")
        {
            item = DatabaseEvents.Items.FindItemByText(event_name);
            DatabaseEvents.SelectedIndex = item.Index;
        }
        else
        {
            item = SpreadSheetEvents.Items.FindItemByText(event_name);
            SpreadSheetEvents.SelectedIndex = item.Index;
        }
        if (event_name.Contains("->"))
        {
            DataMultiPage.SelectedIndex = 3;
            return;
        }
        string app =  State["SelectedApp"].ToString();

        string[] page_names = item.Value.Split(":".ToCharArray());
        string from_page = page_names[0];
        string to_page = page_names[1];
        RadTreeNode DatabaseCommandRoot = CreateDatabaseRootNode(event_field);

        Util util = new Util();
        XmlDocument doc = util.GetStagingAppXml(State, app);
        XmlNode database_config = doc.SelectSingleNode("//database_config");
        if (database_config == null)
        {
            database_config = doc.CreateElement("database_config");
            doc.FirstChild.NextSibling.AppendChild(database_config);
            util.UpdateStagingAppXml(State, app);
            if ( State["ManageDataType"].ToString() == "database")
                DatabaseConfigMessage.Text = "Click on 'Get Database Info'";
            else
                GoogleDocsConfigMessage.Text = "Click on 'Connect to Your Google Docs'";

            return;
        }

        InitDatabaseCommandsView(DatabaseCommandRoot, event_field);

        if ( State["ManageDataType"].ToString() == "database")
        {
            DatabaseCommandsView.ExpandAllNodes();
        }
        else
        {
            SpreadsheetCommandsView.ExpandAllNodes();
        }
    }
开发者ID:dcolonvizi,项目名称:ViziAppsPortal,代码行数:65,代码来源:ManageData.aspx.cs

示例7: SaveDatabaseConfig_Click


//.........这里部分代码省略.........
        if (events == null)
            events = x_util.CreateNode(doc, database_config, "events");

        XmlNode event_name_node = events.SelectSingleNode("event/event_name[.='" +  State["SelectedDBEvent"].ToString() + "']");
        XmlNode event_node = null;
        if (event_name_node == null)
        {
            event_node = x_util.CreateNode(doc, events, "event");
        }
        else
        {
            event_node = event_name_node.ParentNode;
            event_node.RemoveAll();
        }
        x_util.CreateNode(doc, event_node, "event_name",  State["SelectedDBEvent"].ToString());

        XmlNode sql_commands = x_util.CreateNode(doc, event_node, "sql_commands");

        ArrayList DBCommands = (ArrayList) State["DBCommands"];

        foreach (Hashtable CommandEntry in DBCommands)
        {
            XmlNode sql_command = x_util.CreateNode(doc, sql_commands, "sql_command");
            string command = CommandEntry["command"].ToString().ToLower();
            x_util.CreateNode(doc, sql_command, "command", command);
            if (command == "if")
            {
                x_util.CreateNode(doc, sql_command, "command_condition_phone_field1", CommandEntry["command_condition_device_field1"].ToString());
                x_util.CreateNode(doc, sql_command, "command_condition_operation", CommandEntry["command_condition_operation"].ToString());
                x_util.CreateNode(doc, sql_command, "command_condition_phone_field2", CommandEntry["command_condition_device_field2"].ToString());
            }
            else
            {
                x_util.CreateNode(doc, sql_command, "table", CommandEntry["table"].ToString());

                ArrayList DBFields = (ArrayList)CommandEntry["database_fields"];
                if (DBFields != null)
                {
                    foreach (Hashtable FieldEntry in DBFields)
                    {
                        XmlNode field_item = x_util.CreateNode(doc, sql_command, "field_item");
                        if (FieldEntry["database_field"] != null && FieldEntry["database_field"].ToString().Length > 0)
                        {
                            x_util.CreateNode(doc, field_item, "database_field", FieldEntry["database_field"].ToString());
                        }
                        if (FieldEntry["device_field"] != null && FieldEntry["device_field"].ToString().Length > 0)
                        {
                            x_util.CreateNode(doc, field_item, "phone_field", FieldEntry["device_field"].ToString());
                        }
                    }
                }
                ArrayList DBWhere = (ArrayList)CommandEntry["conditions"];
                if (DBWhere != null)
                {
                    foreach (Hashtable ConditionEntry in DBWhere)
                    {
                        XmlNode condition = x_util.CreateNode(doc, sql_command, "condition");
                        if (ConditionEntry["condition_operation"] != null && ConditionEntry["condition_operation"].ToString().Length > 0)
                        {
                            x_util.CreateNode(doc, condition, "condition_operation", ConditionEntry["condition_operation"].ToString());
                        }
                        if (ConditionEntry["condition_1st_field"] != null && ConditionEntry["condition_1st_field"].ToString().Length > 0)
                        {
                            x_util.CreateNode(doc, condition, "condition_1st_field", ConditionEntry["condition_1st_field"].ToString());
                        }
                        if (ConditionEntry["field_operation"] != null && ConditionEntry["field_operation"].ToString().Length > 0)
                        {
                            x_util.CreateNode(doc, condition, "field_operation", ConditionEntry["field_operation"].ToString());
                        }
                        if (ConditionEntry["condition_2nd_field"] != null && ConditionEntry["condition_2nd_field"].ToString().Length > 0)
                        {
                            x_util.CreateNode(doc, condition, "condition_2nd_field", ConditionEntry["condition_2nd_field"].ToString());
                        }
                    }
                }
                Hashtable DBOrderBy = (Hashtable)CommandEntry["order_by"];
                if (DBOrderBy != null)
                {
                    XmlNode order_by = x_util.CreateNode(doc, sql_command, "order_by");

                    if (DBOrderBy["sort_field"] != null && DBOrderBy["sort_field"].ToString().Length > 0)
                    {
                        x_util.CreateNode(doc, order_by, "sort_field", DBOrderBy["sort_field"].ToString());
                    }
                    if (DBOrderBy["sort_direction"] != null && DBOrderBy["sort_direction"].ToString().Length > 0)
                    {
                        x_util.CreateNode(doc, order_by, "sort_direction", DBOrderBy["sort_direction"].ToString());
                    }
                }
            }
        }
         State["AppXmlDoc"] = doc;
        util.UpdateStagingAppXml(State);

        RefreshCommandsView();
        if ( State["ManageDataType"].ToString() == "database")
            DatabaseConfigMessage.Text = "Query Commands for this event have been saved.";
        else
            GoogleDocsConfigMessage.Text = "Query Commands for this event have been saved.";
    }
开发者ID:dcolonvizi,项目名称:ViziAppsPortal,代码行数:101,代码来源:ManageData.aspx.cs

示例8: ResetDataRequestMap_Click

    protected void ResetDataRequestMap_Click(object sender, EventArgs e)
    {
        Util util = new Util();
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        if (util.CheckSessionTimeout(State, Response, "Default.aspx")) return;

        ClearMessages();
         XmlDocument doc = util.GetStagingAppXml(State);
        XmlNode phone_data_requests = doc.SelectSingleNode("//phone_data_requests");
        if (phone_data_requests == null)
            return;
        phone_data_requests.RemoveAll();
        util.UpdateStagingAppXml(State);

        ResetDataResponseMap_Click(sender, e);

        SaveRequestMessage.Text = "Request Map Reset.";
        RequestTreeEdits.Text = "";
    }
开发者ID:dcolonvizi,项目名称:ViziAppsPortal,代码行数:19,代码来源:ManageData.aspx.cs

示例9: RemoveAllConfigs

    protected void RemoveAllConfigs()
    {
        Util util = new Util();
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        XmlDocument doc = util.GetStagingAppXml(State);
        XmlNode database_config = doc.SelectSingleNode("//database_config");
        if (database_config != null)
            database_config.RemoveAll();

        XmlNode phone_data_requests = doc.SelectSingleNode("//phone_data_requests");
        if(phone_data_requests != null)
            phone_data_requests.RemoveAll();

         State["AppXmlDoc"] = doc;
        util.UpdateStagingAppXml(State);

         State["DBCommands"] = null;
    }
开发者ID:dcolonvizi,项目名称:ViziAppsPortal,代码行数:18,代码来源:ManageData.aspx.cs

示例10: GetAppDeviceType

    public string GetAppDeviceType(Hashtable State)
    {
        XmlDocument doc = null;
        if (State["AppXmlDoc"] != null)
            doc = (XmlDocument)State["AppXmlDoc"];
        else
        {
            Util util = new Util();
            doc = util.GetStagingAppXml(State);
            if (doc == null)
                return Constants.IPHONE;
        }

        XmlNode device_type = doc.SelectSingleNode("//device_type");
        if (device_type == null)
        {
            XmlNode configuration = doc.SelectSingleNode("//configuration");
            CreateNode(doc, configuration, "device_type", Constants.IPHONE);
            State["AppXmlDoc"] = doc;
            Util util = new Util();
            util.UpdateStagingAppXml(State);
            return Constants.IPHONE;
        }
        else
        {
            return device_type.InnerText;
        }
    }
开发者ID:dcolonvizi,项目名称:ViziAppsPortal,代码行数:28,代码来源:XmlUtil.cs

示例11: EncodeAppPageToAppXml

    public Hashtable EncodeAppPageToAppXml(Hashtable State, string page_name, string html)
    {
        XmlDocument doc = GetStagingAppXml(State);
           State["AppXmlDoc"] = doc;

           XmlNode configuration_node = doc.SelectSingleNode("//configuration");

        //save background
           if (State["BackgroundImageUrl"] != null)
           {
           string background_image = State["BackgroundImageUrl"].ToString();
           XmlNode background_image_node = configuration_node.SelectSingleNode("background_image");
           if (background_image_node == null)
               background_image_node = CreateNode(doc, configuration_node, "background_image", background_image);
           else
               background_image_node.InnerText = background_image;
           }

        //find page if it exists
        XmlNode page_name_node = doc.SelectSingleNode("//pages/page/name[.  ='" + page_name  + "']");
        XmlNode page_node = null;
        XmlNode fields_node = null;
        if (page_name_node == null) //no - create a new page
        {
            XmlNode pages_node = doc.SelectSingleNode("//pages");
            page_node = CreateNode(doc, pages_node, "page");
            CreateNode(doc, page_node, "name", page_name);
            CreateNode(doc, page_node, "order", GetNextPageOrder(doc));
        }
        else
        {
            page_node = page_name_node.ParentNode;
            fields_node = page_node.SelectSingleNode("fields");
            if (fields_node != null)
                page_node.RemoveChild(fields_node);
        }
         fields_node = CreateNode(doc, page_node, "fields");

         State["ComputeSymbols"] = new ArrayList();
         if (html.Length > 0)
         {
             //encode design
             HtmlDocument HtmlDoc = new HtmlDocument();
             if (State["Browser"].ToString() == "Opera")
                 html = FilterOperaHtml(html);

             HtmlDoc.LoadHtml(html);
             HtmlNodeCollection div_list = HtmlDoc.DocumentNode.SelectNodes("//div[starts-with(@title,'MobiFlex')]");
             string ret = ProcessHtmlNodes(State, doc, page_name, fields_node, div_list);
             if (ret != "OK")
             {
                 throw new Exception(ret);
             }
         }
         else if (State["BackgroundImageUrl"] != null) //new page with only a backbground
         {
            State["BackgroundHtml"] =  html = "<img id=\"background_image\" src=\"" + State["BackgroundImageUrl"].ToString() + "\" style=\"position:absolute;top:0px;left:0px;\"/>";
         }
        Util util = new Util();
        util.UpdateStagingAppXml(State);

        Hashtable duplicate_IDs = CheckForDuplicateIDs(page_name, doc);

        ArrayList ComputeSymbols = (ArrayList)State["ComputeSymbols"];
        if (ComputeSymbols.Count > 0)
        {
            CheckComputeSymbols(doc,State);
        }

        util.SavePageImage(State, page_name,html);

        return duplicate_IDs; // will return null if there are no duplicates
    }
开发者ID:dcolonvizi,项目名称:ViziAppsPortal,代码行数:73,代码来源:XmlUtil.cs

示例12: DeleteAppPage

    public void DeleteAppPage(Hashtable State, string page_name)
    {
        Util util = new Util();
        XmlDocument xmlDoc = GetStagingAppXml(State);
        XmlNode page_name_node = xmlDoc.SelectSingleNode("//pages/page/name[.  ='" + page_name + "']");
        if (page_name_node != null)
        {
            XmlNode page_node = page_name_node.ParentNode;
            XmlNode pages_node = page_node.ParentNode;
            pages_node.RemoveChild(page_node);
            State["AppXmlDoc"] = xmlDoc;
            util.UpdateStagingAppXml(State);
            util.DeleteAppPageImage(State, page_name);
        }

        //get first page first to see if that needs to be changed
        XmlNode first_page_name = xmlDoc.SelectSingleNode("//pages/first_page_name");
        if (first_page_name == null)
        {
            XmlNode pages = xmlDoc.SelectSingleNode("//pages");
            first_page_name = CreateNode(xmlDoc, pages, "first_page_name", "");
        }
        if (page_name == first_page_name.InnerText || first_page_name.InnerText == "")
        {
            //take first page we see
            XmlNode first_page_name_node = xmlDoc.SelectSingleNode("//pages/page/name");
            if (first_page_name_node != null)
            {
                first_page_name.InnerText = first_page_name_node.InnerText;
                State["AppXmlDoc"] = xmlDoc;
                util.UpdateStagingAppXml(State);
            }
        }
    }
开发者ID:dcolonvizi,项目名称:ViziAppsPortal,代码行数:34,代码来源:XmlUtil.cs

示例13: CreateStagingAppXml

    public void CreateStagingAppXml(Hashtable State, string device_type, 
        string application_name, string application_id, string page_name)
    {
        XmlDocument doc = new XmlDocument();
        doc.Load( HttpRuntime.Cache["NewProjectPath"].ToString());

        //set app type
        XmlNode application_node = doc.SelectSingleNode("//application");
        XmlNode type_node = application_node.SelectSingleNode("type");
        if (type_node == null)
            CreateNode(doc, application_node, "type", State["SelectedAppType"].ToString());
        else
            type_node.InnerText = State["SelectedAppType"].ToString();

        //set device_type
        XmlNode configuration = doc.SelectSingleNode("//configuration");
        XmlNode device_type_node = configuration.SelectSingleNode("device_type");
        XmlNode device_design_width_node = configuration.SelectSingleNode("device_design_width");
        XmlNode device_design_height_node = configuration.SelectSingleNode("device_design_height");

        switch (device_type)
        {
            case Constants.IPHONE:
                device_type_node.InnerText = Constants.IPHONE;
                device_design_width_node.InnerText = Constants.IPHONE_DISPLAY_WIDTH_S;
                device_design_height_node.InnerText = Constants.IPHONE_DISPLAY_HEIGHT_S;
                break;
            case Constants.ANDROID_PHONE:
                device_type_node.InnerText = Constants.ANDROID_PHONE;
                device_design_width_node.InnerText = Constants.ANDROID_PHONE_DISPLAY_WIDTH_S;
                device_design_height_node.InnerText = Constants.ANDROID_PHONE_DISPLAY_HEIGHT_S;
                break;
            case Constants.IPAD:
                device_type_node.InnerText = Constants.IPAD;
                device_design_width_node.InnerText = Constants.IPAD_DISPLAY_WIDTH_S;
                device_design_height_node.InnerText = Constants.IPAD_DISPLAY_HEIGHT_S;
                break;
            case Constants.ANDROID_TABLET:
                device_type_node.InnerText = Constants.ANDROID_TABLET;
                device_design_width_node.InnerText = Constants.ANDROID_TABLET_DISPLAY_WIDTH_S;
                device_design_height_node.InnerText = Constants.ANDROID_TABLET_DISPLAY_HEIGHT_S;
                break;
         }

        //set name
        XmlNode name = doc.SelectSingleNode("//application/name");
        name.InnerText = application_name;

        XmlNode id = doc.SelectSingleNode("//application/id");
        id.InnerText = application_id;

        XmlNode first_page_name = doc.SelectSingleNode("//pages/first_page_name");
        first_page_name.InnerText = page_name;

        Util util = new Util();
        State["AppXmlDoc"] = doc;
        util.UpdateStagingAppXml(State);
    }
开发者ID:dcolonvizi,项目名称:ViziAppsPortal,代码行数:58,代码来源:XmlUtil.cs

示例14: CopyAppPage

    public void CopyAppPage(Hashtable State, string page_to_copy, string new_page_name)
    {
        XmlDocument xmlDoc = GetStagingAppXml(State);

        XmlNode prev_page_name_node = xmlDoc.SelectSingleNode("//pages/page/name[.  ='" + page_to_copy + "']");
        if (prev_page_name_node != null)
        {
            XmlNode prev_page_node = prev_page_name_node.ParentNode;
            XmlNode new_page_node = prev_page_node.CloneNode(true);

            //modify prev node with new names
            new_page_node.SelectSingleNode("name").InnerText = new_page_name;
            new_page_node.SelectSingleNode("order").InnerText =  GetNextPageOrder(xmlDoc);

            XmlNodeList fields = new_page_node.SelectSingleNode("fields").ChildNodes;
            foreach (XmlNode field in fields)
            {
                string id = field.SelectSingleNode("id").InnerText;
                field.SelectSingleNode("id").InnerText = new_page_name.Replace(" ","_") + "_" + id;
                if(field.Name == "table")
                {
                  XmlNodeList table_field_names = field.SelectNodes("table_fields/table_field/name");
                  foreach (XmlNode table_field_name in table_field_names)
                  {
                      string name = table_field_name.InnerText;
                      table_field_name.InnerText = new_page_name.Replace(" ", "_") + "_" + name;
                  }
                }
                else if (field.Name == "picker")
                {
                    XmlNodeList picker_field_names = field.SelectNodes("picker_fields/picker_field/name");
                    foreach (XmlNode picker_field_name in picker_field_names)
                    {
                        string name = picker_field_name.InnerText;
                        picker_field_name.InnerText = new_page_name.Replace(" ", "_") + "_" + name;
                    }
                }
            }

            prev_page_node.ParentNode.AppendChild(new_page_node);

            Util util = new Util();
            State["AppXmlDoc"] = xmlDoc;
            util.UpdateStagingAppXml(State);

            HtmlToImage thumb = new HtmlToImage();
            string page_image_url = thumb.ConvertToImageLink(State, new_page_name, State["BackgroundHtml"].ToString());
            if (page_image_url != null)
                util.SaveAppPageImage(State, page_image_url);

        }
    }
开发者ID:dcolonvizi,项目名称:ViziAppsPortal,代码行数:52,代码来源:XmlUtil.cs

示例15: SetPageTransitionType

    public void SetPageTransitionType(Hashtable State, string page_transition_type)
    {
        XmlDocument doc = GetStagingAppXml(State);
        State["AppXmlDoc"] = doc;

        XmlNode application = doc.SelectSingleNode("//application");

        //set scale
        XmlNode device_type_node = application.SelectSingleNode("page_transition_type");
        if (device_type_node == null)
            device_type_node = CreateNode(doc, device_type_node, "page_transition_type");

        device_type_node.InnerText = page_transition_type;
        Util util = new Util();
        util.UpdateStagingAppXml(State);
    }
开发者ID:dcolonvizi,项目名称:ViziAppsPortal,代码行数:16,代码来源:XmlUtil.cs


注:本文中的Util.UpdateStagingAppXml方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。