Exemple #1
0
        private void CatEdit_Click(object sender, RoutedEventArgs e)
        {
            var index = LvCategories.SelectedIndex;

            if (index >= 0)
            {
                var cat = categories[index];
                var dlg = new CategoryEditWindow {
                    Owner = Window
                };
                dlg.SetCategory(categories[index]);
                var ret = dlg.ShowDialog(Window);
                if (ret.HasValue && ret.Value)
                {
                    categories[index] = new Category
                    {
                        Name           = cat.Name,
                        DisplayName    = dlg.CategoryName,
                        DefaultFolder  = dlg.Folder,
                        FileExtensions = new HashSet <string>(dlg.FileTypes.Replace("\r\n", "")
                                                              .Split(',').Select(x => x.Trim()).Where(x => x.Length > 0))
                    };
                }
            }
        }
Exemple #2
0
        private void CatAdd_Click(object sender, RoutedEventArgs e)
        {
            var dlg = new CategoryEditWindow {
                Owner = Window
            };
            var ret = dlg.ShowDialog(Window);

            if (ret.HasValue && ret.Value)
            {
                categories.Add(new Category
                {
                    Name           = Guid.NewGuid().ToString(),
                    DisplayName    = dlg.CategoryName,
                    DefaultFolder  = dlg.Folder,
                    FileExtensions = new HashSet <string>(dlg.FileTypes.Replace("\r\n", "")
                                                          .Split(',').Select(x => x.Trim()).Where(x => x.Length > 0))
                });
            }
        }