コード例 #1
0
        private void cmdBrowseFile_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                OpenFileDialog objDialog = new OpenFileDialog();
                objDialog.InitialDirectory = Environment.SpecialFolder.MyComputer.ToString();

                if (objDialog.ShowDialog() == true)
                {
                    if (string.IsNullOrEmpty(objDialog.FileName) == false)
                    {
                        txtFileName.Text    = objDialog.SafeFileName;
                        _objEntity.FileName = objDialog.SafeFileName;

                        if (string.IsNullOrWhiteSpace(txtFilePath.Text))
                        {
                            txtFilePath.Text    = objDialog.FileName.Replace(objDialog.SafeFileName, "");
                            _objEntity.FilePath = txtFilePath.Text;
                        }

                        MovieServices.Fill(MediaInfoService.getInfo(objDialog.FileName, _objEntity.Id), _objEntity);
                        MovieUpdate parent = Util.TryFindParent <MovieUpdate>(this);
                        parent.Bind();
                    }
                }
            }
            catch (Exception ex)
            {
                Util.LogException(ex);
                new MessageBoxYesNo(ex.Message, false, true).ShowDialog();
            }
        }
コード例 #2
0
        private void mniAddMovie_Click(object sender, RoutedEventArgs e)
        {
            Task.Factory.StartNew(() => Util.NotifyEvent("AddMovie"));

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

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

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

                    MovieUpdate objAddMovie = new MovieUpdate();
                    objAddMovie.ShowDialog();
                    main.ShowMovies(main.Action);
                }
            }
            catch (Exception ex)
            {
                CatchException(ex);
            }
            finally
            {
                Cursor = null;
            }
        }
コード例 #3
0
        private void cmdAddMovie_Click(object sender, RoutedEventArgs e)
        {
            MovieUpdate window = new MovieUpdate();

            window.ShowDialog();
            RoutedEventArgs args = new RoutedEventArgs(CmdAddMoviesClickEvent);

            RaiseEvent(args);
        }
コード例 #4
0
        private void EnableUpdate()
        {
            MovieUpdate parent = Util.TryFindParent <MovieUpdate>(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;
            }
        }
コード例 #5
0
        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);
            }
        }
コード例 #6
0
        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);
            }
        }