// ReSharper restore CollectionNeverQueried.Local

        #region CTOR

        public QuickVariableInputViewModel(Action <IEnumerable <string>, bool> addToCollection)
        {
            VerifyArgument.IsNotNull("addToCollection", addToCollection);
            _addToCollection = addToCollection;

            IsClosed            = true;
            IsValid             = true;
            IsSplitTokenEnabled = true;
            SplitTypeList       = new List <string> {
                SplitTypeIndex, SplitTypeChars, SplitTypeNewLine, SplitTypeSpace, SplitTypeTab
            };
            VariableListString = string.Empty;
            SplitType          = "Chars";
            SplitToken         = string.Empty;
            Prefix             = string.Empty;
            Suffix             = string.Empty;

            ClearCommand = new DelegateCommand(DoClear);
            AddCommand   = new RelayCommand(DoAdd, o => CanAdd);

            _previewViewModel = new PreviewViewModel
            {
                InputsVisibility = Visibility.Collapsed
            };
            PreviewViewModel.PreviewRequested += DoPreview;
        }
Exemplo n.º 2
0
 public PreviewView()
 {
     this.InitializeComponent();
     vm = SimpleIoc.Default.GetInstance <PreviewViewModel>();
     // vm = new PreviewViewModel();
     DataContext = vm;
 }
Exemplo n.º 3
0
        protected async override void OnExecute(object parameter)
        {
            var images = await this.shell.PreviewAsync();

            var dialog = new PreviewViewModel(this.configs, images);
            await dialog.ShowDialogAsync();
        }
Exemplo n.º 4
0
        public ActionResult PreviewAndPay(PreviewViewModel model)
        {
            var cart = mShoppingService.GetCurrentShoppingCart();

            if (!mCheckoutService.IsPaymentMethodValid(model.PaymentMethod.PaymentMethodID))
            {
                ModelState.AddModelError("PaymentMethod.PaymentMethodID", ResHelper.GetString("DancingGoatMvc.Payment.PaymentMethodRequired"));
            }

            var checkResult = cart.ValidateContent();

            if (checkResult.CheckFailed)
            {
                ProcessCheckResult(checkResult);
            }

            if (cart.IsEmpty)
            {
                ModelState.AddModelError("cart.empty", ResHelper.GetString("DancingGoatMvc.Checkout.EmptyCartError"));
            }

            if (!ModelState.IsValid)
            {
                var viewModel = mCheckoutService.PreparePreviewViewModel(model.PaymentMethod);
                return(View("PreviewAndPay", viewModel));
            }

            cart.PaymentMethod = mCheckoutService.GetPaymentMethod(model.PaymentMethod.PaymentMethodID);
            cart.Evaluate();

            mShoppingService.CreateOrder(cart);
            mShoppingService.DeleteShoppingCart(cart);

            return(RedirectToAction("ThankYou"));
        }
Exemplo n.º 5
0
        /// <summary>
        /// Creates view model for checkout preview step.
        /// </summary>
        /// <param name="paymentMethod">Payment method selected on preview step</param>
        public PreviewViewModel PreparePreviewViewModel(PaymentMethodViewModel paymentMethod = null)
        {
            var cart           = mShoppingService.GetCurrentShoppingCart();
            var billingAddress = mShoppingService.GetBillingAddress();
            var shippingOption = cart.ShippingOption;
            var paymentMethods = CreatePaymentMethodList(cart);

            paymentMethod = paymentMethod ?? new PaymentMethodViewModel(cart.PaymentOption, paymentMethods);

            // PaymentMethods are excluded from automatic binding and must be recreated manually after post action
            paymentMethod.PaymentMethods = paymentMethod.PaymentMethods ?? paymentMethods;

            var deliveryDetailsModel = new DeliveryDetailsViewModel
            {
                Customer       = new CustomerViewModel(cart.Customer),
                BillingAddress = new BillingAddressViewModel(billingAddress, null, mCountryRepository),
                ShippingOption = new ShippingOptionViewModel(shippingOption, null, cart.IsShippingNeeded)
            };

            var cartModel = new CartViewModel(cart);

            var viewModel = new PreviewViewModel
            {
                CartModel       = cartModel,
                DeliveryDetails = deliveryDetailsModel,
                ShippingName    = shippingOption?.ShippingOptionDisplayName ?? "",
                PaymentMethod   = paymentMethod
            };

            return(viewModel);
        }
Exemplo n.º 6
0
        public PreviewWindow(IEditorPropertyAccessor accessor, PreviewViewModel viewModel)
        {
            _accessor  = accessor;
            _viewModel = viewModel;

            _viewModel.UpdateRenderTexture(true,
                                           RenderTexture.Create(Engine.WindowSize - new Vector2I(600, 18), TextureFormat.R8G8B8A8_UNORM));
        }
Exemplo n.º 7
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     if (this.DataContext != null)
     {
         this.Visibility = Visibility.Collapsed;
         PreviewViewModel prvm = DataContext as PreviewViewModel;
         prvm.ChooseScreen();
     }
 }
Exemplo n.º 8
0
        void DependecyReport_Click(object sender, RoutedEventArgs e)
        {
            var dependencyReport = new DependencyReport(fileNames);
            var reportCreator    = dependencyReport.Run(list);
            var previewViewModel = new PreviewViewModel(dependencyReport.ReportSettings, reportCreator.Pages);

            viewer.SetBinding(previewViewModel);
            ActivateReportTab();
        }
Exemplo n.º 9
0
        public IActionResult StartApplication()
        {
            var previewViewModel = new PreviewViewModel();

            if (_sessionService.Exists("viewPreviewData"))
            {
                previewViewModel = _sessionService.Get <PreviewViewModel>("viewPreviewData");
            }
            return(View(previewViewModel));
        }
        public ActionResult Index(IContent currentContent)
        {
            var startPage = _pageTypeServices.StartPageService.Homepage;
            var startPageAdditionalProperties = _pageTypeServices.StartPageService.GetStartPageAdditionalProperties(startPage);

            var supportedAreas = GetSupportedPreviewAreas(currentContent);
            var viewModel      = new PreviewViewModel <StartPage, StartPageAdditionalProperties>(startPage, startPageAdditionalProperties, currentContent, supportedAreas);

            return(View("~/Views/Blocks/Preview.cshtml", viewModel));
        }
Exemplo n.º 11
0
 private void PreviewWindow_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
 {
     this.viewModel = this.DataContext as PreviewViewModel;
     this.viewModel.PropertyChanged += viewModel_PropertyChanged;
     this.RefreshControlMargins();
     if (this.viewModel.InCornerDisplayMode)
     {
         this.previewControls.Opacity = 1.0;
     }
 }
Exemplo n.º 12
0
        public void PreviewViewModel_Implementation_INotifyPropertyChanged()
        {
            //------------Setup for test--------------------------


            //------------Execute Test---------------------------
            var previewViewModel = new PreviewViewModel();

            //------------Assert Results-------------------------
            Assert.IsInstanceOfType(previewViewModel, typeof(INotifyPropertyChanged));
        }
        void Button_Plain(object sender, RoutedEventArgs e)
        {
            var stream = LoadPlainResource();

            var rf            = new ReportingFactory();
            var reportCreator = rf.ReportCreator(stream);

            reportCreator.BuildExportList();
            var previewViewModel = new PreviewViewModel(rf.ReportModel.ReportSettings, reportCreator.Pages);

            viewer.SetBinding(previewViewModel);
        }
        void Button_Graphics(object sender, RoutedEventArgs e)
        {
            var stream = GraphicsContainer();

            var rf            = new ReportingFactory();
            var reportCreator = rf.ReportCreator(stream);

            reportCreator.BuildExportList();
            var previewViewModel = new PreviewViewModel(rf.ReportModel.ReportSettings, reportCreator.Pages);

            viewer.SetBinding(previewViewModel);
        }
Exemplo n.º 15
0
        public ActionResult Index(IContent currentContent)
        {
            this.currentContent = currentContent;

            var startPage = epiDependencies.ContentRepository.Get <StartPage>(SiteDefinition.Current.StartPage);

            var supportedAreas = GetSupportedPreviewAreas();

            var viewModel = new PreviewViewModel(startPage, currentContent, supportedAreas);

            return(View("~/Views/Blocks/Preview.cshtml", viewModel));
        }
Exemplo n.º 16
0
        public PreviewPage(IAppManager appManager)
        {
            InitializeComponent();

            _viewModel = new PreviewViewModel(
                AppState.IocContainer.GetInstance <IPreviewImageGenerator>(),
                AppState.IocContainer.GetInstance <IFileSystem>(),
                appManager,
                AppState.IocContainer.GetInstance <IDevice>());

            BindingContext = _viewModel;
        }
Exemplo n.º 17
0
        public void Setup()
        {
            _imageGenerator = Substitute.For <IPreviewImageGenerator>();
            _fileSystem     = Substitute.For <IFileSystem>();
            _fileService    = Substitute.For <IFile>();
            _appManager     = Substitute.For <IAppManager>();
            _viewModel      = new PreviewViewModel(_imageGenerator, _fileSystem, _appManager, MockDevice.Self)
            {
                IsPageVisible = true
            };

            _fileSystem.File.Returns(_fileService);
        }
Exemplo n.º 18
0
        public PreviewWindow(IPreviewModel model)
        {
            InitializeComponent();
            DataContext = new PreviewViewModel(model);

            scrollViewer.ScrollChanged += OnScrollViewerScrollChanged;
            scrollViewer.MouseLeftButtonUp += OnMouseLeftButtonUp;
            scrollViewer.PreviewMouseLeftButtonUp += OnMouseLeftButtonUp;
            scrollViewer.PreviewMouseLeftButtonDown += OnMouseLeftButtonDown;
            scrollViewer.MouseMove += OnMouseMove;

            slider.ValueChanged += OnSliderValueChanged;
        }
Exemplo n.º 19
0
        public ActionResult Index(IContent currentContent)
        {
            var model = new PreviewViewModel(currentContent);

            var contentArea = new ContentArea();

            contentArea.Items.Add(new ContentAreaItem
            {
                ContentLink = currentContent.ContentLink
            });

            model.ContentArea = contentArea;

            return(View(model));
        }
Exemplo n.º 20
0
        protected override void LoadFromPrimary()
        {
            LoggingService.Info("LoadFrompromary");

            var xml              = designerLoader.SerializeModel();
            var modelLoader      = new ModelLoader();
            var reportmodel      = modelLoader.Load(xml.DocumentElement) as ReportModel;
            var reportingFactory = new ReportingFactory();
            var reportCreator    = reportingFactory.ReportCreator(reportmodel);

            reportCreator.BuildExportList();
            var previewViewModel = new PreviewViewModel(reportingFactory.ReportModel.ReportSettings, reportCreator.Pages);

            viewer.SetBinding(previewViewModel);
        }
        void Button_List(object sender, RoutedEventArgs e)
        {
            var stream = LoadListResource();

            var cl = new ContributorsList();
            var cc = cl.ContributorCollection;

            var rf            = new ReportingFactory();
            var reportCreator = rf.ReportCreator(stream, cc);

            reportCreator.BuildExportList();
            var previewViewModel = new PreviewViewModel(rf.ReportModel.ReportSettings, reportCreator.Pages);

            viewer.SetBinding(previewViewModel);
        }
Exemplo n.º 22
0
        public void PreviewViewModel_Constructor_Properties_Initialized()
        {
            //------------Setup for test--------------------------

            //------------Execute Test---------------------------
            var previewViewModel = new PreviewViewModel();

            //------------Assert Results-------------------------
            Assert.IsNotNull(previewViewModel.Inputs);
            Assert.IsInstanceOfType(previewViewModel.Inputs, typeof(ObservableCollection <ObservablePair <string, string> >));
            Assert.AreEqual(0, previewViewModel.Inputs.Count);

            Assert.IsNotNull(previewViewModel.PreviewCommand);
            Assert.AreEqual(Visibility.Visible, previewViewModel.InputsVisibility);
        }
Exemplo n.º 23
0
        public async Task <IActionResult> StartApplication(PreviewViewModel previewViewModel)
        {
            if (!ModelState.IsValid)
            {
                return(View(previewViewModel));
            }

            var applicationStartRequest = new StartApplicationRequest
            {
                UserReference   = UserReference,
                WorkflowType    = previewViewModel.ProjectType,
                ApplicationData = previewViewModel.ApplicationData
            };

            var qnaResponse = new StartApplicationResponse();

            try
            {
                qnaResponse = await _qnaApiClient.StartApplications(applicationStartRequest);
            }
            catch (HttpRequestException ex) {
                dynamic obj = JToken.Parse(ex.Message);
                if (obj.statusCode == "400")
                {
                    ModelState.AddModelError(nameof(previewViewModel.ApplicationData), (string)obj.message);
                    return(View(previewViewModel));
                }
            }

            if (_sessionService.Exists("viewPreviewData"))
            {
                _sessionService.Remove("viewPreviewData");
            }
            _sessionService.Set("viewPreviewData", JsonConvert.SerializeObject(previewViewModel));

            var allApplicationSequences = await _qnaApiClient.GetAllApplicationSequences(qnaResponse.ApplicationId);

            var sequenceNos = string.Join(',', allApplicationSequences.Select(x => x.SequenceNo));

            foreach (var _ in allApplicationSequences.Where(seq => seq.SequenceNo == previewViewModel.SequenceNo).Select(seq => new { }))
            {
                var sections = allApplicationSequences.Select(async sequence => await _qnaApiClient.GetSections(qnaResponse.ApplicationId, sequence.Id)).Select(t => t.Result).ToList();
                return(RedirectToAction("Sequence", new { Id = qnaResponse.ApplicationId, sequenceNo = previewViewModel.SequenceNo }));
            }

            ModelState.AddModelError(nameof(previewViewModel.SequenceNo), $"Sequence number not found. Valid sequences are: {sequenceNos}");
            return(View(previewViewModel));
        }
Exemplo n.º 24
0
        public void PreviewViewModel_PreviewCommand_CanExecute_EqualsCanPreview()
        {
            //------------Setup for test--------------------------
            var previewViewModel = new PreviewViewModel();

            //------------Execute Test---------------------------
            previewViewModel.CanPreview = false;
            var canExecuteFalse = previewViewModel.PreviewCommand.CanExecute(null);

            previewViewModel.CanPreview = true;
            var canExecuteTrue = previewViewModel.PreviewCommand.CanExecute(null);

            //------------Assert Results-------------------------
            Assert.IsFalse(canExecuteFalse);
            Assert.IsTrue(canExecuteTrue);
        }
Exemplo n.º 25
0
        public ActionResult PreviewAndPay(PreviewViewModel model, [FromServices] IStringLocalizer <SharedResources> localizer)
        {
            var cart = shoppingService.GetCurrentShoppingCart();

            if (cart.IsEmpty)
            {
                ModelState.AddModelError("cart.empty", localizer["Please add some item to your shopping cart."]);

                var viewModel = checkoutService.PreparePreviewViewModel(model.PaymentMethod);
                return(View("PreviewAndPay", viewModel));
            }

            if (!checkoutService.IsPaymentMethodValid(model.PaymentMethod.PaymentMethodID))
            {
                ModelState.AddModelError("PaymentMethod.PaymentMethodID", localizer["Select payment method"]);
            }
            else
            {
                shoppingService.SetPaymentOption(model.PaymentMethod.PaymentMethodID);
            }

            var validator = new CreateOrderValidator(cart, skuInfoProvider, countryInfoProvider, stateInfoProvider);

            if (!validator.Validate())
            {
                ProcessCheckResult(validator.Errors);
            }

            if (!ModelState.IsValid)
            {
                var viewModel = checkoutService.PreparePreviewViewModel(model.PaymentMethod);
                return(View("PreviewAndPay", viewModel));
            }

            try
            {
                shoppingService.CreateOrder();
            }
            catch (InvalidOperationException ex)
            {
                ModelState.AddModelError("cart.createordererror", ex.Message);
                var viewModel = checkoutService.PreparePreviewViewModel(model.PaymentMethod);
                return(View("PreviewAndPay", viewModel));
            }

            return(RedirectToAction("ThankYou"));
        }
Exemplo n.º 26
0
        public ActionResult PreviewAndPay(PreviewViewModel model)
        {
            var cart = shoppingService.GetCurrentShoppingCart();

            if (cart.IsEmpty)
            {
                ModelState.AddModelError("cart.empty", ResHelper.GetString("DancingGoatMvc.Checkout.EmptyCartError"));

                var viewModel = checkoutService.PreparePreviewViewModel(model.PaymentMethod);
                return(View("PreviewAndPay", viewModel));
            }

            if (!checkoutService.IsPaymentMethodValid(model.PaymentMethod.PaymentMethodID))
            {
                ModelState.AddModelError("PaymentMethod.PaymentMethodID", ResHelper.GetString("DancingGoatMvc.Payment.PaymentMethodRequired"));
            }
            else
            {
                shoppingService.SetPaymentOption(model.PaymentMethod.PaymentMethodID);
            }

            var validator = new CreateOrderValidator(cart, skuInfoProvider, countryInfoProvider, stateInfoProvider);

            if (!validator.Validate())
            {
                ProcessCheckResult(validator.Errors);
            }

            if (!ModelState.IsValid)
            {
                var viewModel = checkoutService.PreparePreviewViewModel(model.PaymentMethod);
                return(View("PreviewAndPay", viewModel));
            }

            try
            {
                shoppingService.CreateOrder();
            }
            catch (InvalidOperationException ex)
            {
                ModelState.AddModelError("cart.createordererror", ex.Message);
                var viewModel = checkoutService.PreparePreviewViewModel(model.PaymentMethod);
                return(View("PreviewAndPay", viewModel));
            }

            return(RedirectToAction("ThankYou"));
        }
Exemplo n.º 27
0
        /// <summary>
        /// Preview an image
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public IActionResult Preview(string id)
        {
            //Get base64string for this id from the NEO blockchain
            var image = NeoAPI.getStorage(NeoAPI.Net.Test, _scriptHash, id);

            //Check if we find an image
            if (image == null || image.Value == null)
            {
                return(new NotFoundResult());
            }

            PreviewViewModel model = new PreviewViewModel();

            model.Image = image.Value;

            return(View(model));
        }
Exemplo n.º 28
0
        public void PreviewViewModel_PreviewCommand_Executed_FiresPreviewRequestedEvent()
        {
            //------------Setup for test--------------------------
            var previewRequested = false;

            var previewViewModel = new PreviewViewModel();

            previewViewModel.PreviewRequested += (sender, args) =>
            {
                previewRequested = true;
            };

            //------------Execute Test---------------------------
            previewViewModel.PreviewCommand.Execute(null);

            //------------Assert Results-------------------------
            Assert.IsTrue(previewRequested);
        }
Exemplo n.º 29
0
        public void PreviewViewModel_Output_Changed_ValueSetAndFiresNotifyPropertyChangedEvent()
        {
            //------------Setup for test--------------------------
            const string OutputValue = "Test Output";

            var actualPropertyName = string.Empty;

            var previewViewModel = new PreviewViewModel();

            previewViewModel.PropertyChanged += (sender, args) => actualPropertyName = args.PropertyName;

            //------------Execute Test---------------------------
            previewViewModel.Output = OutputValue;

            //------------Assert Results-------------------------
            Assert.AreEqual("Output", actualPropertyName);
            Assert.AreEqual(OutputValue, previewViewModel.Output);
        }
        public async Task <IActionResult> Index()
        {
            var user = await userManager.GetUserAsync(HttpContext.User);

            var vm = new PreviewViewModel();

            if (user.CurrentJobId == null)
            {
                vm.CurrentJob = null;
            }
            else
            {
                vm.CurrentJob = await jobService.GetJob(user.CurrentJobId.Value);

                vm.Items = await inventoryService.GetInventoryItemsOfJob(user.CurrentJobId.Value);
            }

            return(View(vm));
        }
Exemplo n.º 31
0
        protected override void LoadFromPrimary()
        {
            Pages.Clear();
            ReportModel model = designerLoader.CreateRenderableModel();
            //TODO change to designerLoader.CreateXmlModel();
//			var xmDoc = designerLoader.CreateXmlModel();
//			var modulLoader = new ModelLoader();
//			ReportModel model = (ReportModel)modulLoader.Load(xmDoc.DocumentElement);

            var collectCmd = new CollectParametersCommand(model.ReportSettings);

            collectCmd.Run();
            switch (model.DataModel)
            {
            case GlobalEnums.PushPullModel.FormSheet:
            {
                exportRunner.RunReport(model, (ReportParameters)null);
                break;
            }

            case GlobalEnums.PushPullModel.PullData:
            {
                exportRunner.RunReport(model, (ReportParameters)null);
                break;
            }

            case GlobalEnums.PushPullModel.PushData:
            {
                var cmd = new DataSetFromXsdCommand();
                cmd.Run();
                System.Data.DataSet ds = cmd.DataSet;
                exportRunner.RunReport(model, ds.Tables[0], (ReportParameters)null);
                break;
            }

            default:
                throw new InvalidReportModelException();
            }
            PreviewViewModel previewViewModel = new PreviewViewModel(model.ReportSettings, exportRunner.Pages);

            viewer.SetBinding(previewViewModel);
        }
Exemplo n.º 32
0
		public void OpenPreviewWindow()
		{
			var previewWindow = WindowManager.FindWindow(typeof(PreviewViewModel)) as PreviewViewModel;
			this.PreviewWindowOpen = true;

			if (previewWindow == null)
			{
				previewWindow = new PreviewViewModel();
				previewWindow.Closing = () =>
				{
					this.PreviewWindowOpen = false;
				};
				WindowManager.OpenWindow(previewWindow, this.main);
			}
			else
			{
				WindowManager.FocusWindow(previewWindow);
			}
		}