Ejemplo n.º 1
0
 /// <summary>
 /// The replace show.
 /// </summary>
 /// <param name="episode">The episode.</param>
 /// <param name="notCatagorized">The not catagorized.</param>
 private void ReplaceShow(Episode episode, ScanNotCatagorized notCatagorized)
 {
     episode.FilePath.PathAndFilename = notCatagorized.FilePath;
     ImportTvFactory.NotCatagorized.Remove(notCatagorized);
     this.grdViewEpisodes.RefreshData();
     this.lblStatus.Text = string.Format("{0} set to {1}", notCatagorized.FilePath, episode.EpisodeName);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Handles the DragDrop event of the grdEpisode control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.Forms.DragEventArgs"/> instance containing the event data.</param>
        private void grdEpisode_DragDrop(object sender, DragEventArgs e)
        {
            GridHitInfo hitTest = this.grdViewEpisodes.CalcHitInfo(this.grdEpisode.PointToClient(new Point(e.X, e.Y)));

            if (hitTest.InRow)
            {
                var notCatagorized = e.Data.GetData(typeof(ScanNotCatagorized)) as ScanNotCatagorized;
                var episode = this.grdViewEpisodes.GetRow(hitTest.RowHandle) as Episode;
                var fileNameW = e.Data.GetData("FileNameW");

                if (episode != null && notCatagorized != null || fileNameW != null)
                {
                    if (fileNameW != null)
                    {
                        string[] fileNames = (string[])fileNameW;
                        if (fileNames.Length == 1)
                        {
                            string fileName = fileNames[0];

                            if (Settings.Get.InOutCollection.VideoExtentions.Contains(Path.GetExtension(fileName.ToLower()).Replace(".", string.Empty)))
                            {
                                notCatagorized = new ScanNotCatagorized();
                                notCatagorized.FilePath = fileName;
                            }
                        }
                    }

                    if (string.IsNullOrEmpty(episode.FilePath.PathAndFilename))
                    {
                        this.ReplaceShow(episode, notCatagorized);
                    }
                    else
                    {
                        var result =
                            XtraMessageBox.Show(
                                string.Format(
                                    "Do you want to replace\n{0}\nwith\n{1}", 
                                    episode.FilePath.PathAndFilename, 
                                    notCatagorized.FilePath), 
                                "Are you sure to want to replace?", 
                                MessageBoxButtons.YesNo, 
                                MessageBoxIcon.Question);

                        if (result == DialogResult.Yes)
                        {
                            this.ReplaceShow(episode, notCatagorized);
                        }
                    }
                }
            }
            else
            {
                e.Effect = DragDropEffects.None;
            }
        }