コード例 #1
0
        private void uxCategoryChange_Click(object sender, RoutedEventArgs e)
        {
            var window = new CategoryWindow();

            window.Category = selectedCategory.Clone();

            if (true == window.ShowDialog())
            {
                App.InventoryRepository.Update(window.Category.ToRepositoryModel());
                LoadCategories();
            }
        }
コード例 #2
0
        public CateroryAddOrUpdateViewModel(Action reLoadListCat, Action closeDialog, CategoryModel category = null)
        {
            if (category == null) // Add new
            {
                CurrentCategory = new CategoryModel();
            }
            else  // Edit
            {
                CurrentCategory = category.Clone();
                _isEdit         = true;
            }


            MaxLengthName     = CurrentCategory.GetAttributeFrom <MaxLengthAttribute>(nameof(CurrentCategory.Name)).Length;
            ReLoadList        = reLoadListCat;
            CloseDialogParent = closeDialog;
        }
コード例 #3
0
        /// <summary>
        ///		Pega la categoría en un canal
        /// </summary>
        private void PasteCategoryToTrack(CategoryModel category, TrackModel track)
        {
            CategoryModel newCategory = category.Clone(track);

            // Elimina los ID
            newCategory.Id = null;
            foreach (EntryModel entry in newCategory.Entries)
            {
                entry.Id = null;
            }
            // Añade la catgoría al canal
            track.Categories.Add(newCategory);
            // Borra la categoría inicial si se debía cortar
            if (MustCut)
            {
                category.Track.Categories.Remove(category);
            }
        }