예제 #1
0
        public void ShowImageBrowserWindow(string imageDirectory)
        {
            UIServices.SetBusyState();

            var imageBrowserWindow    = new ImageBrowserView();
            var imageBrowserViewModel = new ImageBrowserViewModel {
                ImageDirectory = imageDirectory
            };

            imageBrowserViewModel.LoadExistingImages();

            var okCommand     = new ButtonServiceCommand("OK", imageBrowserViewModel.OkCommand, false, true, true);
            var cancelCommand = new ButtonServiceCommand("Cancel", null, true, false, true);

            dialogService.ShowDialogWindow("Image Browser", new[] { okCommand, cancelCommand }, null, imageBrowserWindow, imageBrowserViewModel, false);
        }
        private void ViewBitmaps()
        {
            var scheduler = TaskScheduler.FromCurrentSynchronizationContext();
            IAssemblyDefinition assembly = GetAssemblyDefinition();

            var imb = new ImageBrowserView();
            regionManager.AddToRegion("PluginRegion", imb);
            imb.Closing += CloseView;
            imb.AssemblyName = Path.GetFileName(assembly.MainModule.FilePath);

            imb.Status = "Scanning for images...";
            imb.ProgressOverlayVisibility = Visibility.Visible;
            ResourceLoader.LoadBitmapsFromAssembly(assembly, i => imb.ProgressPercentage = i)
                .ContinueWith(r =>
                {
                    imb.Images.AddRange(r.Result);
                    imb.ProgressOverlayVisibility = Visibility.Collapsed;
                    imb.Status = string.Empty;
                }, scheduler);
        }