Ejemplo n.º 1
0
        private void buttonRemoveSource_Click(object sender, EventArgs e)
        {
            MyFormField.DelayButtonClick(buttonRemoveSource);

            if (currentSource == null)
            {
                return;
            }

            string message = "Are you sure you want to remove this Video Source?" + Environment.NewLine;

            message += "Alias: " + currentSource.alias + Environment.NewLine;
            message += "Type: " + currentSource.type + Environment.NewLine;
            message += "Directory: " + currentSource.directory + Environment.NewLine;
            string lastScanned = currentSource.lastScanned.ToLocalTime().ToString();

            if (currentSource.lastScanned == DateTime.MinValue)
            {
                lastScanned = "Not yet";
            }
            message += "Last Scanned: " + lastScanned + Environment.NewLine;

            if (MessageBox.Show(message, "Confirm Removal",
                                MessageBoxButtons.YesNo, MessageBoxIcon.Question,
                                MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.Yes)
            {
                listViewSource.SelectedItems[0].Remove();


                // remove entry from settings
                Config.settings.sources.Remove(currentSource);

                List <VideoInfo> currentVideoInfos = ListVideoInfo.GetList();
                int nbrOrigVideoInfos = currentVideoInfos.Count();
                currentVideoInfos.RemoveAll(s => s.sourceAlias == currentSource.alias);
                int nbrRemovedVideoInfos = nbrOrigVideoInfos - currentVideoInfos.Count();
                ListVideoInfo.SetList(currentVideoInfos);

                // meh, but works
                FormMain        formMain        = (FormMain)this.Owner;
                SubFormListView subFormListView = formMain.GetSubFormListView();
                subFormListView.SetListViewInfos(ListVideoInfo.GetList());

                MyLog.Add("Removed " + currentSource.alias + " and it's " + nbrRemovedVideoInfos + " VideoItems");

                // datatable xml will be updated on main form close
                // settings xml will be updated on main form close

                currentSource = null;
                buttonRemoveSource.Enabled = false;
            }
        }
Ejemplo n.º 2
0
        private void buttonSave_Click(object sender, EventArgs e)
        {
            Button button = (Button)sender;

            button.Enabled = false;
            button.Text    = "Saving..";



            SaveForm();

            MyFormField.DelayButtonClick(button, "Save");
        }
Ejemplo n.º 3
0
        private void buttonScan_Click(object sender, EventArgs e)
        {
            Button button = (Button)sender;

            if (selectedVideoInfo != null && selectedVideoInfo.videoItem != null)
            {
                button.Enabled = false;
                button.Text    = "Scanning..";

                string directory = selectedVideoInfo.videoDirectory;
                MyLog.Add("Scanning: " + directory);

                ParseVideo parseVideo = new ParseVideo();
                selectedVideoInfo = parseVideo.ReadDirectory(directory);


                subFormFileList.SetList(selectedVideoInfo);
                SetForm(selectedVideoInfo);
                ListVideoInfo.UpdateVideoInfoList(selectedVideoInfo);


                MyFormField.DelayButtonClick(button, "Scan");
            }
        }
Ejemplo n.º 4
0
        private void buttonPlay_Click(object sender, EventArgs e)
        {
            Button button = (Button)sender;

            if (selectedVideoInfo != null && selectedVideoInfo.files != null && selectedVideoInfo.files.video != null)
            {
                button.Enabled = false;
                button.Text    = "Playing..";

                PlayFile playFile = new PlayFile();
                playFile.playFile_Completed += (senderPlay, eventPlay) => PlayFile_Completed(senderPlay, eventPlay, selectedVideoInfo);
                playFile.AddAccessToSubForms(this, subFormProgress);
                string   videoFullName = selectedVideoInfo.GetFullName(selectedVideoInfo.files.video);
                FileInfo fileInfo      = MyFile.FileInfo(videoFullName);
                if (fileInfo == null)
                {
                    MessageBox.Show("Error trying to play video [" + selectedVideoInfo.files.video.Name + "]");
                    return;
                }
                playFile.Play(selectedVideoInfo, selectedVideoInfo.files.video);

                MyFormField.DelayButtonClick(button, "Play");
            }
        }