예제 #1
0
파일: that.cs 프로젝트: ptksoft/xDB-2013
        public static void ShowTab_AllMovie()
        {
            if (FRM.Main == null)
            {
                return;
            }

            ucMovieList movieList = new ucMovieList();

            movieList.Dock     = DockStyle.Fill;
            movieList.Location = new Point(0, 0);
            movieList.OnDoubleClickMovieList += new WhenDoubleClickMovieList(movieList_OnDoubleClickMovieList);
            movieList.OnKeyUpMovieList       += new WhenKeyUpMovieList(movieList_OnKeyUpMovieList);

            TabPage newTabPage = new TabPage();

            newTabPage.Tag = new string[] {
                "all_movies",
                "All Movies @ " + ptkGeneral.GetTodayDateTimeSqlFormat()
            };
            newTabPage.Controls.Add(movieList);

            FRM.Main.tabMain.TabPages.Add(newTabPage);
            FRM.Main.tabMain.SelectedTab = newTabPage;
            FRM.Main.generateTabFunctionKey();

            movieList.RefreshMovieList(MovieDB.GetMovieList(), "All Movie");
        }
예제 #2
0
파일: that.cs 프로젝트: ptksoft/xDB-Metro
        public static void BatchCopyFileToNewPathInCurrentTab(TabPage tabToCopy)
        {
            ucMovieList movieList = null;

            foreach (Control ctl in tabToCopy.Controls)
            {
                if (ctl is ucMovieList)
                {
                    movieList = (ucMovieList)ctl;
                    break;
                }
            }
            if (movieList == null)
            {
                return;
            }

            // Get New File Path To Copy
            FolderBrowserDialog dir2write = new FolderBrowserDialog();

            if (dir2write.ShowDialog() != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }
            that.DebugAndLog("Selected destination folder = " + dir2write.SelectedPath);

            // Begin Copy File To New Path
            frmCopyFileStatus frmStatus = new frmCopyFileStatus();

            frmStatus.pathToWrite = dir2write.SelectedPath;
            frmStatus.listMovie   = movieList.GetListMovie();
            frmStatus.Show();
        }
예제 #3
0
        private void __RefreshSearchResult(List <MovieProfile> listResult, string descMovie)
        {
            // Build new moview result tab is Difference Topic
            if (movieList != null)
            {
                if (!movieList.Visible)
                {
                    movieList = null;
                }
                else
                {
                    if (movieList.Tag != null)
                    {
                        if (!movieList.Tag.ToString().Equals(CurrentTopic))
                        {
                            movieList = null;
                        }
                    }
                    else
                    {
                        movieList.Tag = CurrentTopic;
                    }
                }
            }

            // Build Result in form Main & New TAB
            if (movieList == null)
            {
                movieList          = new ucMovieList();
                movieList.Dock     = DockStyle.Fill;
                movieList.Location = new Point(0, 0);
                movieList.OnDoubleClickMovieList += new WhenDoubleClickMovieList(that.movieList_OnDoubleClickMovieList);
                movieList.OnKeyUpMovieList       += new WhenKeyUpMovieList(that.movieList_OnKeyUpMovieList);

                movieList.Tag = CurrentTopic;

                tabSearchResult     = new TabPage();
                tabSearchResult.Tag = new string[] { "search_result", "Search Result" };
                tabSearchResult.Controls.Add(movieList);

                FRM.Main.tabMain.TabPages.Add(tabSearchResult);
                FRM.Main.tabMain.SelectedTab = tabSearchResult;
                FRM.Main.generateTabFunctionKey();
            }

            // Action !!!
            movieList.RefreshMovieList(listResult, descMovie);
        }
예제 #4
0
파일: that.cs 프로젝트: ptksoft/xDB-2013
        public static void ShowTab_FilterMovie(string filterKey)
        {
            if (FRM.Main == null)
            {
                return;
            }
            if (!that.Filter.Contains(filterKey))
            {
                return;
            }
            MovieFilter filter = null;

            try
            {
                filter = JsonConvert.DeserializeObject <MovieFilter>(that.Filter[filterKey]);
                that.DebugAndLog("ShowFilterMovie()->Decode filter name [" + filterKey + "] Success");
            }
            catch (Exception ex) {
                that.DebugAndLog("ShowFilterMovie()->Decode filter name [" + filterKey + "] Fail");
                that.DebugAndLog("Exception: " + ex.Message);
                return;
            }
            if (filter == null)
            {
                return;                     // Second Trap for SAFE :P
            }
            ucMovieList movieList = new ucMovieList();

            movieList.Dock     = DockStyle.Fill;
            movieList.Location = new Point(0, 0);
            movieList.OnDoubleClickMovieList += new WhenDoubleClickMovieList(movieList_OnDoubleClickMovieList);
            movieList.OnKeyUpMovieList       += new WhenKeyUpMovieList(movieList_OnKeyUpMovieList);


            TabPage newTabPage = new TabPage();

            newTabPage.Tag = new string[] {
                "filter_movie",
                "Filter Movie"
            };
            newTabPage.Controls.Add(movieList);

            FRM.Main.tabMain.TabPages.Add(newTabPage);
            FRM.Main.tabMain.SelectedTab = newTabPage;
            FRM.Main.generateTabFunctionKey();

            movieList.RefreshMovieList(MovieDB.GetMovieList(filter), "Filter Movie by [" + filterKey + "]");
        }
예제 #5
0
        private void _RefreshSearchResult(List <MovieProfile> listResult, string descMovie)
        {
            if (movieList == null)
            {
                movieList          = new ucMovieList();
                movieList.Dock     = DockStyle.Fill;
                movieList.Location = new Point(0, 0);
                movieList.OnDoubleClickMovieList += new WhenDoubleClickMovieList(that.movieList_OnDoubleClickMovieList);
                movieList.OnKeyUpMovieList       += new WhenKeyUpMovieList(that.movieList_OnKeyUpMovieList);

                tabSearchResult     = new TabPage();
                tabSearchResult.Tag = new string[] { "search_result", "Search Result" };
                tabSearchResult.Controls.Add(movieList);

                FRM.Main.tabMain.TabPages.Add(tabSearchResult);
                FRM.Main.tabMain.SelectedTab = tabSearchResult;
                FRM.Main.generateTabFunctionKey();
            }
            movieList.RefreshMovieList(listResult, descMovie);
        }
예제 #6
0
파일: that.cs 프로젝트: ptksoft/xDB-Metro
        public static void BatchDeleteLastFilePathInCurrentTab(TabPage tabToDelete)
        {
            ucMovieList movieList = null;

            foreach (Control ctl in tabToDelete.Controls)
            {
                if (ctl is ucMovieList)
                {
                    movieList = (ucMovieList)ctl;
                    break;
                }
            }
            if (movieList == null)
            {
                return;
            }

            // Begin Delete Last File Path
            List <MovieProfile> listMovie = movieList.GetListMovie();

            if (listMovie.Count > 0)
            {
                if (MessageBox.Show(
                        "Are you sure to delete " + listMovie.Count.ToString() + " movie File Path!!",
                        " Confirm?", MessageBoxButtons.OKCancel
                        ) != DialogResult.OK)
                {
                    return;
                }
            }

            // After Confirm Begin Real Delete
            int countSuccess = 0;

            for (int i = 0; i < listMovie.Count; i++)
            {
                MovieProfile profile = (MovieProfile)listMovie[i];

                //--------------------------------------------------
                string filePath2Delete = profile.FilePath;
                if (File.Exists(filePath2Delete))
                {
                    try
                    {
                        File.Delete(filePath2Delete);
                        that.DebugAndLog("Delete RealFileInDisk [" + filePath2Delete + "] Success");
                    }
                    catch (Exception ex)
                    {
                        that.DebugAndLog("Error in delete RealFileInDisk [" + filePath2Delete + "] " + ex.Message);
                    }
                }
                profile.FilePath = "";      // Delete from Object
                profile.CheckFileConnect();
                //--------------------------------------------------

                if (!MovieDB.SaveMovieProfile(profile))
                {
                    that.DebugAndLog("Error in MovieDB.SaveMovieProfile() ... Cannot Remove Last FilePath");
                }
                else
                {
                    that.DebugAndLog("Delete last File path from Movie{" + profile.Hash + "} Success");
                    countSuccess++;
                }
            }
            MessageBox.Show("Success delete " + countSuccess.ToString() + " LastFile Path from " + listMovie.Count.ToString() + " profile");
        }