예제 #1
0
        public Form2(Video.MovieSection initialSection, string shortName)
        {
            InitializeComponent();

            int numberOfItemsInEnum = Video.MovieSection.GetNames(typeof(Video.MovieSection)).Length;

            // Update the radio buttons
            for (int i = 0; i < kNumberOfRadios; i++)
            {
                if (i < numberOfItemsInEnum)
                {
                    groupBox1.Controls[i].Text = Enum.GetNames(typeof(Video.MovieSection))[i].ToString();
                }
                else
                {
                    groupBox1.Controls[i].Text    = "--------";
                    groupBox1.Controls[i].Enabled = false;
                }
            }

            (groupBox1.Controls[(int)initialSection] as RadioButton).Checked = true;

            if (FriendlyNames.Exists(shortName))
            {
                textBox1.Text = FriendlyNames.Lookup(shortName);
            }
            else
            {
                textBox1.Text = String.Empty;
            }
        }
예제 #2
0
        public Rename(Video.MovieSection section, string shortName, string currentName)
        {
            InitializeComponent();

            _shortFilename = shortName;

            txtSection.Text      = section.ToString();
            txtPreviousName.Text = currentName;
            txtNewName.Text      = String.Empty;
            DialogResult         = DialogResult.Cancel;
        }
예제 #3
0
        private void treeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            if (e.Node is VideoNode)
            {
                VideoNode clickedNode = e.Node as VideoNode;
                Video     video       = clickedNode.Video;

                System.Diagnostics.Process.Start(video.FullPath);

                if (_setupMode)
                {
                    Form2 newSectionDlg = new Form2(video.VideoSection, video.ShortName);
                    newSectionDlg.ShowDialog();
                    Video.MovieSection newSection = newSectionDlg.Section;

                    if (video.VideoSection != newSection)
                    {
                        video.VideoSection = newSection;
                    }
                    if (!String.IsNullOrWhiteSpace(newSectionDlg.NewName))
                    {
                        FriendlyNames.Update(video.ShortName, newSectionDlg.NewName);
                        clickedNode.Text = newSectionDlg.NewName;
                    }
                }

                if (chkMarkAsViewed.Checked)
                {
                    bool videoWasWatched = video.Watched;
                    video.Watched = true;

                    if (!videoWasWatched)
                    {
                        TreeNode unviewed = _sections[(int)video.VideoSection].unviewed;
                        TreeNode viewed   = _sections[(int)video.VideoSection].viewed;

                        unviewed.Nodes.Remove(clickedNode);
                        viewed.Nodes.Add(clickedNode);
                        treeView1.Refresh();
                    }
                }
            }
        }
예제 #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            int chosenIndex         = -1;
            int numberOfItemsInEnum = Video.MovieSection.GetNames(typeof(Video.MovieSection)).Length;

            for (int i = 0; i < numberOfItemsInEnum; i++)
            {
                if ((groupBox1.Controls[i] as RadioButton).Checked)
                {
                    chosenIndex = i;
                    break;
                }
            }

            if (chosenIndex > -1)
            {
                _chosenSection = (Video.MovieSection)chosenIndex;
                _chosenName    = textBox1.Text;
            }

            Close();
        }