Exemplo n.º 1
0
        // Return the updated list of content types.

        public Dictionary <String, String> GetContentTypes()
        {
            Dictionary <String, String> contentTypes = new Dictionary <string, string>();

            int id = 0;

            foreach (KeyValuePair <int, StackPanel> ct in rowPanels)
            {
                id = ct.Key;

                TextBox tb1 = ContentTypeListView.FindName("TextBoxFileType" + id.ToString()) as TextBox;
                TextBox tb2 = ContentTypeListView.FindName("TextBoxContentType" + id.ToString()) as TextBox;

                if (tb1 != null && tb2 != null)
                {
                    String fileType    = tb1.Text.Trim();
                    String contentType = tb2.Text.Trim();
                    if (!String.IsNullOrEmpty(fileType) && !String.IsNullOrEmpty(contentType) && !contentTypes.ContainsKey(fileType))
                    {
                        contentTypes.Add(tb1.Text, tb2.Text);
                    }
                }
            }

            return(contentTypes);
        }
Exemplo n.º 2
0
        // Add a row to the list.

        private void AddRow_MouseDown(object sender, MouseButtonEventArgs e)
        {
            StackPanel row = AddContentType(String.Empty, String.Empty);

            ContentTypeListView.ScrollIntoView(ContentTypeListView.Items[ContentTypeListView.Items.Count - 1]);
        }