コード例 #1
0
 private void Delete()
 {
     if (CateList.SelectedItem != null)
     {
         ClassForList SelectedCate = (ClassForList)CateList.SelectedItem;
         foreach (CategoryClass Cate in CategoryList)
         {
             if (Cate.Name == SelectedCate.Name)
             {
                 indexIn = CategoryList.IndexOf(Cate);
             }
         }
         CategoryList.RemoveAt(indexIn);
         string name              = null;
         string formats           = null;
         List <ClassForList> List = new List <ClassForList> {
         };
         foreach (CategoryClass category in CategoryList)
         {
             foreach (string format in category.Formats)
             {
                 formats += $" {format};";
             }
             name = category.Name;
             ClassForList Cate = new ClassForList(name, formats);
             List.Add(Cate);
             name    = null;
             formats = null;
         }
         CateList.ItemsSource = List;
     }
 }
コード例 #2
0
        private void Create_Button_Click(object sender, RoutedEventArgs e)
        {
            creating = true;
            CategoryEditor ce_win = new CategoryEditor();

            ce_win.Closing += (s, e) =>
            {
                string name              = null;
                string formats           = null;
                List <ClassForList> List = new List <ClassForList> {
                };
                foreach (CategoryClass category in CategoryList)
                {
                    foreach (string format in category.Formats)
                    {
                        formats += $"{format}; ";
                    }
                    name = category.Name;
                    ClassForList Cate = new ClassForList(name, formats);
                    List.Add(Cate);
                    name    = null;
                    formats = null;
                }
                CateList.ItemsSource = List;
            };
            ce_win.ShowDialog();
        }
コード例 #3
0
        public Advance_Settings_Page()
        {
            InitializeComponent();
            string name              = null;
            string formats           = null;
            List <ClassForList> List = new List <ClassForList> {
            };

            foreach (CategoryClass category in CategoryList)
            {
                foreach (string format in category.Formats)
                {
                    formats += $" {format};";
                }
                name = category.Name;
                ClassForList Cate = new ClassForList(name, formats);
                List.Add(Cate);
                name    = null;
                formats = null;
            }
            CateList.ItemsSource = List;
        }
コード例 #4
0
 private void Edit()
 {
     if (CateList.SelectedItem != null)
     {
         creating = false;
         ClassForList SelectedCate = (ClassForList)CateList.SelectedItem;
         foreach (CategoryClass Cate in CategoryList)
         {
             if (Cate.Name == SelectedCate.Name)
             {
                 indexIn = CategoryList.IndexOf(Cate);
             }
         }
         CategoryEditor ce_win = new CategoryEditor();
         ce_win.Closing += (s, e) =>
         {
             string name              = null;
             string formats           = null;
             List <ClassForList> List = new List <ClassForList> {
             };
             foreach (CategoryClass category in CategoryList)
             {
                 foreach (string format in category.Formats)
                 {
                     name     = category.Name;
                     formats += $" {format};";
                 }
                 ClassForList Cate = new ClassForList(name, formats);
                 List.Add(Cate);
                 formats = "";
                 name    = "";
             }
             CateList.ItemsSource = List;
         };
         ce_win.ShowDialog();
     }
 }