コード例 #1
0
 /// <summary>
 /// Deserializes xml markup from file into an ResourceList object
 /// </summary>
 /// <param name="fileName">string xml file to load and deserialize</param>
 /// <param name="obj">Output ResourceList 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 ResourceList obj, out System.Exception exception) {
     exception = null;
     obj = default(ResourceList);
     try {
         obj = LoadFromFile(fileName);
         return true;
     }
     catch (System.Exception ex) {
         exception = ex;
         return false;
     }
 }
コード例 #2
0
 public static bool LoadFromFile(string fileName, out ResourceList obj) {
     System.Exception exception = null;
     return LoadFromFile(fileName, out obj, out exception);
 }
コード例 #3
0
 public static bool Deserialize(string xml, out ResourceList obj) {
     System.Exception exception = null;
     return Deserialize(xml, out obj, out exception);
 }
コード例 #4
0
 /// <summary>
 /// Deserializes workflow markup into an ResourceList object
 /// </summary>
 /// <param name="xml">string workflow markup to deserialize</param>
 /// <param name="obj">Output ResourceList 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 ResourceList obj, out System.Exception exception) {
     exception = null;
     obj = default(ResourceList);
     try {
         obj = Deserialize(xml);
         return true;
     }
     catch (System.Exception ex) {
         exception = ex;
         return false;
     }
 }
コード例 #5
0
ファイル: RepositoryTreeModel.cs プロジェクト: kanbang/Colt
        private System.Collections.IEnumerable GetSorted(ResourceList list)
        {
            //Sort them before returning them
            SortedList<string, RepositoryModelItem> folders = new SortedList<string, RepositoryModelItem>();
            SortedList<string, RepositoryModelItem> docs = new SortedList<string, RepositoryModelItem>();
            foreach (var item in list.Children)
            {
                if (item.IsFolder && !item.HasChildren && this.OmitEmptyFolders)
                    continue;

                if (item.IsFolder)
                    folders.Add(item.ResourceId, new RepositoryModelItem(item));
                else if (!HasFilteredTypes() || (HasFilteredTypes() && IsFilteredType(item.ResourceType)))
                    docs.Add(item.ResourceId, new RepositoryModelItem(item));

            }
            foreach (var folder in folders.Values)
            {
                yield return folder;
            }
            foreach (var doc in docs.Values)
            {
                yield return doc;
            }
        }
コード例 #6
0
ファイル: RepositoryTreeModel.cs プロジェクト: kanbang/Colt
 private System.Collections.IEnumerable GetSorted(string connectionName, ResourceList list)
 {
     //Sort them before returning them
     SortedList<string, RepositoryItem> folders = new SortedList<string, RepositoryItem>();
     SortedList<string, RepositoryItem> docs = new SortedList<string, RepositoryItem>();
     foreach (var item in list.Children)
     {
         var it = new RepositoryItem(connectionName, item);
         it.Model = this;
         if (it.IsFolder)
             folders.Add(it.ResourceId, it);
         else
             docs.Add(it.ResourceId, it);
     }
     foreach (var folder in folders.Values)
     {
         yield return folder;
     }
     foreach (var doc in docs.Values)
     {
         yield return doc;
     }
 }
コード例 #7
0
ファイル: ResourcePicker.cs プロジェクト: kanbang/Colt
        private void PopulateDocumentList(ResourceList list)
        {
            lstResources.Clear();
            SortedList<string, ResourceListResourceDocument> items = new SortedList<string, ResourceListResourceDocument>();
            foreach (var item in list.Items)
            {
                var doc = item as ResourceListResourceDocument;
                if (doc != null)
                {
                    string sortKey = doc.Name + "." + doc.ResourceType;
                    items.Add(sortKey, doc);
                }
            }
            foreach (var doc in items.Values)
            {
                var li = new ListViewItem(doc.Name);
                li.Tag = doc;

                try
                {
                    var rt = ResourceIdentifier.GetResourceType(doc.ResourceId);
                    li.ImageIndex = RepositoryIcons.GetImageIndexForResourceType(rt);
                }
                catch
                {
                    li.ImageIndex = RepositoryIcons.RES_UNKNOWN;
                }

                lstResources.Items.Add(li);
            }
        }