private void mniAddXXX_Click(object sender, RoutedEventArgs e)
        {
            Task.Factory.StartNew(() => Util.NotifyEvent("AddXXX"));

            try
            {
                Main main = Util.TryFindParent <Main>(this);

                if (main != null)
                {
                    main.OldSelectedItems = main.SelectedItems;
                    main.SelectedItems    = EntityType.XXX;

                    main.OldAction = main.Action;
                    main.Action    = EntityAction.Added;

                    XxxUpdate objAdd = new XxxUpdate();
                    objAdd.ShowDialog();
                    main.ShowXxx(main.Action);
                }
            }
            catch (Exception ex)
            {
                CatchException(ex);
            }
            finally
            {
                Cursor = null;
            }
        }
Esempio n. 2
0
        private void EnableUpdate()
        {
            XxxUpdate parent = Util.TryFindParent <XxxUpdate>(this);

            if (string.IsNullOrEmpty(txtTitle.Text) == false)
            {
                parent.cmdUpdate.IsEnabled    = true;
                parent.cmdUpdateWeb.IsEnabled = true;
            }
            else if (string.IsNullOrEmpty(txtBarCode.Text) == false)
            {
                parent.cmdUpdateWeb.IsEnabled = true;
                if (string.IsNullOrEmpty(txtTitle.Text) == true)
                {
                    parent.cmdUpdate.IsEnabled = false;
                }
            }
            else
            {
                parent.cmdUpdate.IsEnabled    = false;
                parent.cmdUpdateWeb.IsEnabled = false;
            }
        }
        private void UpdateItem(ThumbItem thumbItem)
        {
            try
            {
                if (thumbItem == null)
                {
                    return;
                }

                bool?saved = false;

                switch (thumbItem.EType)
                {
                case EntityType.Apps:
                    AppsUpdate objAppsDetails = new AppsUpdate();
                    objAppsDetails.ItemsId = thumbItem.Id;
                    saved = objAppsDetails.ShowDialog();
                    if (saved == true)
                    {
                        Apps apps = new AppServices().Get(thumbItem.Id) as Apps;
                        FileThumbItem(thumbItem, apps);
                    }
                    break;

                case EntityType.Artist:
                    Task.Factory.StartNew(() => Util.NotifyEvent("ArtistDetail:" + thumbItem.Name));
                    ArtistDetail artistDetails = new ArtistDetail(thumbItem.Name, thumbItem.EType);
                    saved = artistDetails.ShowDialog();
                    break;

                case EntityType.Books:
                    BookUpdate objBookDetails = new BookUpdate();
                    objBookDetails.ItemsId = thumbItem.Id;
                    saved = objBookDetails.ShowDialog();
                    if (saved == true)
                    {
                        Books books = new BookServices().Get(thumbItem.Id) as Books;
                        FileThumbItem(thumbItem, books);
                    }
                    break;

                case EntityType.Games:
                    GameUpdate objGameDetails = new GameUpdate();
                    objGameDetails.ItemsId = thumbItem.Id;
                    saved = objGameDetails.ShowDialog();
                    if (saved == true)
                    {
                        Gamez games = new GameServices().Get(thumbItem.Id) as Gamez;
                        FileThumbItem(thumbItem, games);
                    }
                    break;

                case EntityType.Movie:
                    MovieUpdate objMovieDetails = new MovieUpdate();
                    objMovieDetails.ItemsId = thumbItem.Id;
                    saved = objMovieDetails.ShowDialog();
                    if (saved == true)
                    {
                        Movie movie = new MovieServices().Get(thumbItem.Id) as Movie;
                        FileThumbItem(thumbItem, movie);
                    }
                    break;

                case EntityType.Music:
                    MusicUpdate objMusicDetails = new MusicUpdate();
                    objMusicDetails.ItemsId = thumbItem.Id;
                    saved = objMusicDetails.ShowDialog();
                    if (saved == true)
                    {
                        Music music = new MusicServices().Get(thumbItem.Id) as Music;
                        FileThumbItem(thumbItem, music);
                    }
                    break;

                case EntityType.Nds:
                    NdsUpdate objNdsDetails = new NdsUpdate();
                    objNdsDetails.ItemsId = thumbItem.Id;
                    saved = objNdsDetails.ShowDialog();
                    if (saved == true)
                    {
                        Nds nds = new NdsServices().Get(thumbItem.Id) as Nds;
                        FileThumbItem(thumbItem, nds);
                    }
                    break;

                case EntityType.Series:
                    Main main = Util.TryFindParent <Main>(this);
                    main.NewSeasonAdded = false;
                    SerieUpdate objSerieDetails = new SerieUpdate();
                    objSerieDetails.ItemsId = thumbItem.Id;
                    saved = objSerieDetails.ShowDialog();
                    main.NewSeasonAdded = objSerieDetails.NewSeasonAdded;

                    if (objSerieDetails.NewSeasonAdded == true)
                    {
                        saved = true;
                    }

                    if (saved == true)
                    {
                        SeriesSeason serie = new SerieServices().Get(thumbItem.Id) as SeriesSeason;
                        FileThumbItem(thumbItem, serie);
                    }
                    break;

                case EntityType.XXX:
                    XxxUpdate objXxxDetails = new XxxUpdate();
                    objXxxDetails.ItemsId = thumbItem.Id;
                    saved = objXxxDetails.ShowDialog();
                    if (saved == true)
                    {
                        XXX xxx = new XxxServices().Get(thumbItem.Id) as XXX;
                        FileThumbItem(thumbItem, xxx);
                    }
                    break;
                }

                _currentItem = thumbItem;

                if (saved == true)
                {
                    RoutedEventArgs args = new RoutedEventArgs(UpdateEvent);
                    RaiseEvent(args);
                    Cursor = null;
                    ShowVisibleItems(MainStack);
                }
            }
            catch (Exception ex)
            {
                CatchException(ex);
            }
        }
        private void UpdateItem(ThumbItem thumbItem)
        {
            try
            {
                bool?saved = false;

                switch (thumbItem.EType)
                {
                case EntityType.Apps:
                    AppsUpdate objAppsDetails = new AppsUpdate();
                    objAppsDetails.ItemsId = thumbItem.Id;
                    saved = objAppsDetails.ShowDialog();
                    break;

                case EntityType.Books:
                    BookUpdate objBookDetails = new BookUpdate();
                    objBookDetails.ItemsId = thumbItem.Id;
                    saved = objBookDetails.ShowDialog();
                    break;

                case EntityType.Games:
                    GameUpdate objGameDetails = new GameUpdate();
                    objGameDetails.ItemsId = thumbItem.Id;
                    saved = objGameDetails.ShowDialog();
                    break;

                case EntityType.Movie:
                    MovieUpdate objMovieDetails = new MovieUpdate();
                    objMovieDetails.ItemsId = thumbItem.Id;
                    saved = objMovieDetails.ShowDialog();
                    break;

                case EntityType.Music:
                    MusicUpdate objMusicDetails = new MusicUpdate();
                    objMusicDetails.ItemsId = thumbItem.Id;
                    saved = objMusicDetails.ShowDialog();
                    break;

                case EntityType.Nds:
                    NdsUpdate objNdsDetails = new NdsUpdate();
                    objNdsDetails.ItemsId = thumbItem.Id;
                    saved = objNdsDetails.ShowDialog();
                    break;

                case EntityType.Series:
                    SerieUpdate objSerieDetails = new SerieUpdate();
                    objSerieDetails.ItemsId = thumbItem.Id;
                    saved = objSerieDetails.ShowDialog();
                    break;

                case EntityType.XXX:
                    XxxUpdate objXxxDetails = new XxxUpdate();
                    objXxxDetails.ItemsId = thumbItem.Id;
                    saved = objXxxDetails.ShowDialog();
                    break;
                }

                if (saved == true)
                {
                    RoutedEventArgs args = new RoutedEventArgs(SaveEventCf);
                    RaiseEvent(args);
                }
            }
            catch (Exception ex)
            {
                CatchException(ex);
            }
        }