/// <summary>
        /// Load the selected image main panel for further opertaion.
        /// </summary>
        /// <param name="model">Details of the image from the AI result to be loaded</param>
        private void ImageSelectedExecute(ImageSearchModel model)
        {
            SnipInsightViewModel viewModel = AppManager.TheBoss.ViewModel;
            var aiPanelVM = ServiceLocator.Current.GetInstance <AIPanelViewModel>();

            AppManager.TheBoss.OnSaveImage();

            if (string.IsNullOrEmpty(viewModel.RestoreImageUrl))
            {
                viewModel.RestoreImageUrl = viewModel.SavedCaptureImage;
            }

            ImageLoader.LoadFromUrl(new Uri(model.URL)).ContinueWith(t =>
            {
                Application.Current.Dispatcher.Invoke(() =>
                {
                    aiPanelVM.CapturedImage    = t.Result;
                    viewModel.SelectedImageUrl = model.URL;
                    AppManager.TheBoss.RunAllInsights();
                });
            }, TaskContinuationOptions.OnlyOnRanToCompletion);

            ImageLoader.LoadFromUrl(new Uri(model.URL)).ContinueWith(t =>
            {
                MessageBox.Show(Resources.Image_Not_Loaded);
            }, TaskContinuationOptions.NotOnRanToCompletion);
        }
Exemple #2
0
        // Initialize other viewmodels and models
        private void Initialize()
        {
            var imageSearchModel = new ImageSearchModel();

            this.SearchBarViewModel = new SearchBarViewModel(imageSearchModel);
            this.ImageViewModel     = new ImageViewModel(imageSearchModel);
        }
Exemple #3
0
        public SearchBarViewModel(ImageSearchModel imageSearchModel)
        {
            this.imageSearchModel = imageSearchModel;

            this.DoSearch = new DelegateCommand(this.DoSearchCommandHandler);

            this.imageSearchModel.FilterStateChanged += this.FilterStateChangedEventHandler;
        }
Exemple #4
0
        public ImageViewModel(ImageSearchModel imageSearchModel)
        {
            this.imageSearchModel = imageSearchModel;

            this.DisplayImageFullScreen = new DelegateCommand(this.DisplayImageFullScreenCommandHandler);

            this.imageSearchModel.TotalEstimatedMatchesChanged  += this.TotalEstimatedMatchesChangedEventHandler;
            this.imageSearchModel.SearchInProgressStatusChanged += this.SearchInProgressStatusChangedEventHandler;
        }
 private bool ImageSelectedCanExecute(ImageSearchModel model)
 {
     return(true);
 }
 public ImageSearchViewModel()
 {
     m_ImageSearchModel = new ImageSearchModel();
 }
 public IActionResult Search(ImageSearchModel model)
 {
     return(View("Index", model));
 }
        public IActionResult Index()
        {
            var model = new ImageSearchModel();

            return(View(model));
        }