Пример #1
0
        private void SelectionFindRegion()
        {
            try
            {
                //Options.ScriptOptionCollection options = Options.GetOptions("Find Region");
                var myPrompt = new FormSimplePrompt
                {
                    tbUserData     = { Text = ScriptOptions.GetValue(SelectionStrings.FindRegionKeyName, SelectionStrings.FindRegionLastString, "") },
                    Text           = "Find Region",
                    lblPrompt      = { Text = "Search for:" },
                    lblDescription = { Text = "Partial name of region to find" }
                };

                if (myPrompt.ShowDialog() == DialogResult.OK)
                {
                    Region   selRegion  = myVegas.GetSelectedRegion();
                    Timecode startTime  = (selRegion != null) ? selRegion.Position : Timecode.FromSeconds(0);
                    Region   bestRegion = myVegas.Project.FindRegion(myPrompt.tbUserData.Text, startTime);

                    if (bestRegion == null)
                    {
                        return;
                    }

                    myVegas.Transport.SelectionStart  = bestRegion.Position;
                    myVegas.Transport.SelectionLength = bestRegion.Length;

                    ScriptOptions.SetValue(SelectionStrings.FindRegionKeyName, SelectionStrings.FindRegionLastString, myPrompt.tbUserData.Text);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
        }