private void _lstSuggestionLists_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (e.AddedItems.Count > 0)
     {
         SelectedSuggestion = (SuggestionList)e.AddedItems[0];
     }
 }
        private void uploadList_Click(object sender, RoutedEventArgs e)
        {
            Button b = (Button)sender;
            SelectedSuggestion = Config.Lists.Where(l => l.ListName == b.Tag.ToString()).SingleOrDefault();

            if (UploadList != null)
            {
                UploadList(this, EventArgs.Empty);
            }
        }
 private static List<SuggestionList> loadSuggestionListFromXml(XDocument doc)
 {
     var listList = new List<SuggestionList>();
     foreach (var item in doc.Descendants("List"))
     {
         var newItem = new SuggestionList
         {
             HeaderText = item.Element("HeaderText").Value,
             ListName = item.Element("ListName").Value,
             PluralName = item.Element("PluralName").Value,
             SingularName = item.Element("SingularName").Value,
             HistoryCount = int.Parse(item.Element("HistoryCount").Value),
             ReadOnly = bool.Parse(item.Element("ReadOnly").Value),
             ListSource = (ListSourceType)Enum.Parse(typeof(ListSourceType), item.Element("ListSource").Value, true),
             SourceUri = item.Element("SourceUri").Value,
             ListDate = DateTime.Parse(item.Element("ListDate").Value),
             SortPriority = int.Parse(item.Element("SortPriority").Value),
             IsVisible = bool.Parse(item.Element("IsVisible").Value)
         };
         listList.Add(newItem);
     }
     return listList;
 }
Example #4
0
 private static void loadSuggestionListToUI(Panorama para, IApplicationBar appBar, EventHandler newItemClick, SuggestionList li)
 {
     addMakeSuggestionCtlToPanorama(para, appBar, li.Id, li.HeaderText, li.ListFileName, li.PluralName, li.SingularName, li.HistoryCount, newItemClick);
 }
Example #5
0
 public void AddListToXml01()
 {
     SuggesterAppConfig config = new SuggesterAppConfig();
     using (Stream stream = getResoureFileStream(CONFIG_XML_FILE_NAME))
     {
         config.LoadFromStream(stream);
         int itemCountBefore = config.Lists.Count();
         SuggestionList newList = new SuggestionList
         {
             HeaderText = "New List",
             ListName = "New List",
             PluralName = "List Items",
             SingularName = "List Item",
             HistoryCount = 42,
             ReadOnly = false,
             ListSource = ListSourceType.SkyDrive,
             SourceUri = "foo/list.txt",
             ListDate = DateTime.Today,
             SortPriority = 100,
             IsVisible = false
         };
         config.Lists.Add(newList);
         int itemCountAfter = config.Lists.Count();
         Assert.AreEqual(itemCountBefore + 1, itemCountAfter);
     }
 }