public static bool LoadFromFile(string fileName, out ResourceDocumentHeaderType obj)
 {
     System.Exception exception = null;
     return LoadFromFile(fileName, out obj, out exception);
 }
 /// <summary>
 /// Deserializes xml markup from file into an ResourceDocumentHeaderType object
 /// </summary>
 /// <param name="fileName">string xml file to load and deserialize</param>
 /// <param name="obj">Output ResourceDocumentHeaderType object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool LoadFromFile(string fileName, out ResourceDocumentHeaderType obj, out System.Exception exception)
 {
     exception = null;
     obj = default(ResourceDocumentHeaderType);
     try {
         obj = LoadFromFile(fileName);
         return true;
     }
     catch (System.Exception ex) {
         exception = ex;
         return false;
     }
 }
 public static bool Deserialize(string xml, out ResourceDocumentHeaderType obj)
 {
     System.Exception exception = null;
     return Deserialize(xml, out obj, out exception);
 }
 /// <summary>
 /// Deserializes workflow markup into an ResourceDocumentHeaderType object
 /// </summary>
 /// <param name="xml">string workflow markup to deserialize</param>
 /// <param name="obj">Output ResourceDocumentHeaderType object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool Deserialize(string xml, out ResourceDocumentHeaderType obj, out System.Exception exception)
 {
     exception = null;
     obj = default(ResourceDocumentHeaderType);
     try {
         obj = Deserialize(xml);
         return true;
     }
     catch (System.Exception ex) {
         exception = ex;
         return false;
     }
 }
        /// <summary>
        /// Raises the System.Windows.Forms.Form.Load event
        /// </summary>
        /// <param name="e"></param>
        protected override void OnLoad(EventArgs e)
        {
            Dictionary<string, ListViewItem> ul = new Dictionary<string, ListViewItem>();
            Dictionary<string, ListViewItem> gl = new Dictionary<string, ListViewItem>();

            UsersAndGroups.Items.Clear();
            var site = (ISiteService)m_connection.GetService((int)ServiceType.Site);

            foreach (UserListUser u in site.EnumerateUsers().Items)
            {
                ListViewItem lvi = new ListViewItem(new string[] { u.FullName, u.Description, StatusNames[IHUSER] }, IHUSER);
                lvi.Tag = u;
                UsersAndGroups.Items.Add(lvi);
                ul.Add(u.Name, lvi);
            }

            foreach (GroupListGroup g in site.EnumerateGroups().Group)
            {
                ListViewItem lvi = new ListViewItem(new string[] { g.Name, g.Description, StatusNames[IHGROUP] }, IHGROUP);
                lvi.Tag = g;
                UsersAndGroups.Items.Add(lvi);
                gl.Add(g.Name, lvi);
            }

            if (m_resourceId.IsFolder)
            {
                m_folderHeader = m_connection.ResourceService.GetFolderHeader(m_resourceId);
                if (m_folderHeader.Security.Users != null && m_folderHeader.Security.Users.User != null)
                    foreach (ResourceSecurityTypeUsersUser u in m_folderHeader.Security.Users.User)
                        if (ul.ContainsKey(u.Name))
                            UpdateListItem(u, ul[u.Name]);

                if (m_folderHeader.Security.Groups != null && m_folderHeader.Security.Groups.Group != null)
                    foreach (ResourceSecurityTypeGroupsGroup g in m_folderHeader.Security.Groups.Group)
                        if (gl.ContainsKey(g.Name))
                            UpdateListItem(g, gl[g.Name]);

                UseInherited.Checked = m_folderHeader.Security.Inherited;
                tabControl1.TabPages.Remove(WMSTab);
                tabControl1.TabPages.Remove(WFSTab);
                tabControl1.TabPages.Remove(CustomTab);
                tabControl1.TabPages.Remove(ReferenceTab);
            }
            else
            {
                m_resourceHeader = m_connection.ResourceService.GetResourceHeader(m_resourceId);
                if (m_resourceHeader.Security.Users != null && m_resourceHeader.Security.Users.User != null)
                    foreach (ResourceSecurityTypeUsersUser u in m_resourceHeader.Security.Users.User)
                        if (ul.ContainsKey(u.Name))
                            UpdateListItem(u, ul[u.Name]);

                if (m_resourceHeader.Security.Groups != null && m_resourceHeader.Security.Groups.Group != null)
                    foreach (ResourceSecurityTypeGroupsGroup g in m_resourceHeader.Security.Groups.Group)
                        if (gl.ContainsKey(g.Name))
                            UpdateListItem(g, gl[g.Name]);

                UseInherited.Checked = m_resourceHeader.Security.Inherited;
                if (m_resourceId.Extension != ResourceTypes.LayerDefinition.ToString())
                    tabControl1.TabPages.Remove(WMSTab);
                else
                    UpdateWMSDisplay();

                if (m_resourceId.Extension != ResourceTypes.FeatureSource.ToString())
                    tabControl1.TabPages.Remove(WFSTab);
                else
                    UpdateWFSDisplay();
            }

            //Hide the tabControl if it only has one tab
            if (tabControl1.TabCount == 1)
            {
                foreach (Control c in new System.Collections.ArrayList(tabControl1.TabPages[0].Controls))
                {
                    tabControl1.Controls.Remove(c);
                    c.Top += tabControl1.Top;
                    this.Controls.Add(c);

                }

                this.Controls.Remove(tabControl1);
            }

            this.Text = m_resourceId;
            UseInherited_CheckedChanged(null, null);
        }
 public void LoadResourceHeader(ResourceDocumentHeaderType docHeader)
 {
     txtXml.Text = docHeader.Serialize();
     _serializer = new XmlSerializer(typeof(ResourceDocumentHeaderType));
     isFolder = false;
 }