Instance() public static method

public static Instance ( SearchSettings settings ) : DataAccess.VideoListItem
settings DataAccess.SearchSettings
return DataAccess.VideoListItem
Exemplo n.º 1
0
        public async void CommandBinding_PlayFire(object sender, ExecutedRoutedEventArgs e)
        {
            if (!menuPlayFire.IsEnabled)
            {
                return;
            }

            SearchSettings settings = new SearchSettings();

            settings.MediaType      = MediaType.Video;
            settings.RatingRatio    = SessionCore.Instance.NgMain.RatioSlider.Value;
            settings.RatingCategory = "Fire";
            settings.RatingOperator = OperatorConditionEnum.GreaterOrEqual;
            settings.RatingValue    = 7.5f;
            settings.RatingFilters.Add(new SearchRatingSetting()
            {
                Category = "Length",
                Operator = OperatorConditionEnum.Smaller,
                Value    = 12
            });

            VideoListItem Result = SearchVideoWindow.Instance(settings);

            if (Result != null)
            {
                await SessionCore.Instance.Business.SetNextVideoFileAsync(PlayerMode.Fire, Result.FileName);
            }
        }
Exemplo n.º 2
0
        public void CommandBinding_AddLucidVideo(object sender, ExecutedRoutedEventArgs e)
        {
            if (!menuAddLucidVideo.IsEnabled)
            {
                return;
            }

            VideoListItem Result = SearchVideoWindow.Instance(new SearchSettings()
            {
                MediaType = MediaType.Video
            });

            if (Result != null)
            {
                LayerLucidVideoControl Layer = new LayerLucidVideoControl();
                Layer.OpenMedia(SessionCore.Instance.Business.GetMediaObject(Result.FileName));
                SessionCore.Instance.Layers.Add(Layer);
            }
        }
Exemplo n.º 3
0
        private async void CommandBinding_SpecialRequest(object sender, ExecutedRoutedEventArgs e)
        {
            if (!menuSpecialRequest.IsEnabled)
            {
                return;
            }

            SearchSettings SearchSettings = new SearchSettings()
            {
                MediaType   = MediaType.Video,
                RatingRatio = SessionCore.Instance.NgMain.RatioSlider.Value
            };
            VideoListItem Result = SearchVideoWindow.Instance(SearchSettings);

            if (Result != null)
            {
                await SessionCore.Instance.Business.SetNextVideoFileAsync(PlayerMode.SpecialRequest, Result.FileName).ConfigureAwait(false);
            }
        }
        private async void menuSelectFile_Click(object sender, RoutedEventArgs e)
        {
            if (!isNew)
            {
                // Bind to another file.
                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
                dlg.InitialDirectory = Settings.NaturalGroundingFolder;
                if (video.MediaType == MediaType.Video)
                {
                    dlg.Filter = string.Format("Video Files|*{0})", string.Join(";*", AppPaths.VideoExtensions));
                }
                else if (video.MediaType == MediaType.Audio)
                {
                    dlg.Filter = string.Format("Audio Files|*{0})", string.Join(";*", AppPaths.AudioExtensions));
                }
                else if (video.MediaType == MediaType.Image)
                {
                    dlg.Filter = string.Format("Image Files|*{0})", string.Join(";*", AppPaths.ImageExtensions));
                }
                if (dlg.ShowDialog(IsLoaded ? this : Owner).Value == true)
                {
                    if (!dlg.FileName.StartsWith(Settings.NaturalGroundingFolder))
                    {
                        MessageBox.Show("You must select a file within your Natural Grounding folder.", "Error", MessageBoxButton.OK, MessageBoxImage.Information);
                    }
                    else
                    {
                        string BindFile = dlg.FileName.Substring(Settings.NaturalGroundingFolder.Length);
                        if (business.GetVideoByFileName(BindFile) == null)
                        {
                            video.FileName = BindFile;
                            video.Length   = null;
                            video.Height   = null;
                            await LoadMediaInfoAsync();

                            if (isPopup)
                            {
                                SaveChanges();
                            }
                        }
                        else
                        {
                            MessageBox.Show("This file is already in the database.", "Error", MessageBoxButton.OK, MessageBoxImage.Information);
                        }
                    }
                    fileNotFound = false;
                }
            }
            else
            {
                // Bind file to an existing entry.
                SearchSettings settings = new SearchSettings()
                {
                    MediaType        = (MediaType)video.MediaTypeId,
                    ConditionField   = FieldConditionEnum.FileExists,
                    ConditionValue   = BoolConditionEnum.No,
                    ListIsInDatabase = true
                };
                VideoListItem Result = SearchVideoWindow.Instance(settings);
                if (Result != null)
                {
                    // Close and re-open selected entry.
                    Close();
                    EditVideoWindow NewForm = Instance(Result.MediaId, null, callback);
                    NewForm.video.FileName = video.FileName;
                    NewForm.video.Length   = null;
                    NewForm.video.Height   = null;
                    await NewForm.LoadMediaInfoAsync();
                }
            }
        }