public void OpenFile(string File) { var vm = new ScanViewModel(this); vm.OpenFile(File); DataContext = vm; //if (File == null) //{ // var dialog = new OpenFileDialog() { Filter = "Scan Files (*.pxml)|*.pxml|All|*.*" }; // if (dialog.ShowDialog() != System.Windows.Forms.DialogResult.OK) // return; // File = dialog.FileName; //} //var alerts = ScanAlertCollection.Load(File); //if (alerts == null) // return; //var vm = new ScanViewModel(this); //vm.CreateAlertViewModels(alerts); //DataContext = vm; }
public ScanActionPage() { InitializeComponent(); BindingContext = new ScanViewModel(); ScannerSupport.OnScanData += OnScannedData; ScannerSupport.OnArrival += OnDeviceArrived; ScannerSupport.OnRemoval += OnDeviceRemoved; var vm = (ScanViewModel)BindingContext; var soundEnabled = vm.IsSoundEnabled; vm.PropertyChanged += Vm_PropertyChanged; Device.StartTimer(TimeSpan.FromSeconds(1), () => { vm.UpdateElapsedTimeCommand.Execute(null); return(true); }); Device.StartTimer(TimeSpan.FromSeconds(10), () => { vm.UploadScansToServerCommand.Execute(null); vm.GetCurrentLocationCommand.Execute(null); return(true); }); }
public ScanPage() { InitializeComponent(); BindingContext = viewModel = new ScanViewModel(); //Scanner.IsScanning = true; //Scanner.IsTorchOn = true; //Marche pas sur android ? }
public MainPage() { this.viewModel = new ScanViewModel(); this.InitializeComponent(); this.files = new Dictionary <string, string>(); this.NavigationCacheMode = NavigationCacheMode.Required; this.DataContext = this.viewModel; }
public ScanPage() { InitializeComponent(); BindingContext = _vm = DependencyService.Resolve <ScanViewModel>(); _vm.Navigation = Navigation; _vm.OpenCameraCommand.Execute(null); }
public MainViewModel( ScanViewModel scanViewModel, ConnectedDevicesViewModel connectViewModel, ServerViewModel serverViewModel) { this.Scan = scanViewModel; this.ConnectedDevices = connectViewModel; this.Server = serverViewModel; }
public void Scan_HappyFlow_RaisesPropertyChangedOnAccountNumbers() { var viewModel = new ScanViewModel(); string propertyName = null; viewModel.PropertyChanged += (s, e) => { propertyName = e.PropertyName; }; viewModel.Scan(Resources.FileWith1Entries); Assert.IsNotNull(propertyName); Assert.That(propertyName, Is.EqualTo("AccountNumbers")); }
public async Task StartQrScanner_QrCodeScanner_CallsStart() { // Arrange _scanViewModel = new ScanViewModel(_navigationManager, _qrCodeScanner.Object, _qrCodeValidator.Object); // Act await _scanViewModel.StartQrScanner(); // Assert _qrCodeScanner.Verify(callTo => callTo.Start(), Times.Once); }
public void SetCameraNotFound_ErrorMessage_SetCorrectly() { // Arrange _scanViewModel = new ScanViewModel(_navigationManager, _qrCodeScanner.Object, _qrCodeValidator.Object); // Act _scanViewModel.SetCameraNotFound(); // Assert Assert.That(_scanViewModel.ErrorMessage, Is.EqualTo("No cameras found")); }
public void SetCameraNotOpen_ErrorMessage_SetCorrectly() { // Arrange _scanViewModel = new ScanViewModel(_navigationManager, _qrCodeScanner.Object, _qrCodeValidator.Object); // Act _scanViewModel.SetCameraNotOpen(); // Assert Assert.That(_scanViewModel.ErrorMessage, Is.EqualTo("Allow camera access to scan tickets")); }
public IActionResult Scan(int?id) { var Volume = db.Volumes.Where(v => v.VolumeId == id).SingleOrDefault(); var Manga = db.Mangas.Where(m => m.MangaID == Volume.MangaId).SingleOrDefault(); var model = new ScanViewModel { MangaVolume = Manga, Volume = Volume }; return(View(model)); }
public void SetCameraIsOpen_IsStreaming_SetToTrue() { // Arrange _scanViewModel = new ScanViewModel(_navigationManager, _qrCodeScanner.Object, _qrCodeValidator.Object); // Act _scanViewModel.SetCameraIsOpen(); // Assert Assert.That(_scanViewModel.IsStreaming, Is.True); }
public ViewModelLocator() { if (!DesignerProperties.GetIsInDesignMode(new DependencyObject())) { MainViewModel = new MainViewModel(); ScanViewModel = new ScanViewModel(); CustomersViewModel = new CustomersViewModel(); DetailsViewModel = new DetailsViewModel(); CheckInsViewMode = new CheckInsViewModel(); SettingsViewModel = new SettingsViewModel(); } }
public ScanView() { InitializeComponent(); WindowStartupLocation = WindowStartupLocation.CenterScreen; var viewModel = new ScanViewModel(); this.DataContext = viewModel; if (viewModel.CloseAction == null) { viewModel.CloseAction = new Action(this.Close); } }
// private ListView _listView; public ScanHistoryPage() { InitializeComponent(); BindingContext = new ScanViewModel(); //var db = new SQLiteConnection(dbPath); //StackLayout stackLayout = new StackLayout(); //_listView = new ListView(); //_listView.ItemsSource = db.Table<Scan>().OrderBy(s => s.Id).ToList(); //stackLayout.Children.Add(_listView); //Content = stackLayout; var vm = (ScanViewModel)BindingContext; vm.UpdateHistoryCommand.Execute(null); }
public async Task <IActionResult> Login(ScanViewModel model) { if (ModelState.IsValid) { // 创建用户登录标识,Cookie名称与IServiceCollection中配置的一样即可 var identity = new ClaimsIdentity(CookieAuthenticationDefaults.AuthenticationScheme); // 添加之后,可使用User.Identity.Name获取该值 identity.AddClaim(new Claim(ClaimTypes.Name, model.Nick)); // identity中还可以添加自定义数据 identity.AddClaim(new Claim("qq", model.Number)); // var customValue = User.Claims.SingleOrDefault(s => s.Type == "qq").Value; await HttpContext.SignInAsync(new ClaimsPrincipal(identity)); return(Redirect("~/")); } return(RedirectToAction(nameof(Login))); }
public void TestClearFilters() { // init test data var idFileReader = IdFileReaderFactory.CreateReader(idFile); var ids = idFileReader.Read(); var idList = ids.ToList(); foreach (var id in idList) { id.LcMs = null; id.RawFileName = Path.GetFileNameWithoutExtension(rawFile); } var prsms = idList; // init scan vm var scanVm = new ScanViewModel(new TestableMainDialogService(), prsms); scanVm.ClearFilters(); // add filters ////scanVm.AddFilter("Sequence", "EAQ"); var sequenceFilter = scanVm.Filters.FirstOrDefault(x => x.Name == "Sequence") as MultiValueFilterViewModel; Assert.NotNull(sequenceFilter); sequenceFilter.Values.Add("EAQ"); /////scanVm.AddFilter("Protein", "YLR"); var proteinFilter = scanVm.Filters.FirstOrDefault(x => x.Name == "Protein Name") as MultiValueFilterViewModel; Assert.NotNull(proteinFilter); sequenceFilter.Values.Add("YLR"); // Sanity check: there should be fewer PrSms than before Assert.True(scanVm.FilteredData.Length < prsms.Count); // Clear filters scanVm.ClearFilters(); // All prsms should now be showing Assert.True(scanVm.FilteredData.Length == prsms.Count); }
public void QrCodeValidator_OnValidQrCode_NavigationCalled() { // Arrange var redirects = new List <string>(); _navigationManager.NavigationRaised += (sender, uri) => redirects.Add(uri); _scanViewModel = new ScanViewModel(_navigationManager, _qrCodeScanner.Object, _qrCodeValidator.Object); // Act _qrCodeValidator.Raise(callTo => callTo.OnValidQrCode += null, null as EventArgs); // Assert Assert.Multiple(() => { Assert.That(redirects, Has.Count.EqualTo(1)); Assert.That(redirects, Has.One.EqualTo("../")); }); _navigationManager.NavigationRaised -= (sender, uri) => redirects.Add(uri); }
public ActionResult Index(String Url,String Cookie) { //Primesc request-ul si initializez modelul ScanViewModel model = new ScanViewModel(); model.scannedUrl = Url; model.cookie = Cookie; try { //Verific ca am primit un URL absolut Uri uriResult; bool result = Uri.TryCreate(Url, UriKind.Absolute, out uriResult) && (uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps); if (result == false) { model.Message = "Introduceti un URL valid!"; return View(model); } //Instantiez clasa Scannner lista pe puncte de injectie Scanner scanner = new Scanner(); List<InjectionPoint> injectionPoints = new List<InjectionPoint>(); //Pornesc scanarea, care imi produce ca rezultat de return vulnerabilitatile ca si lista, //iar prin parametrul referinta pot sa folosesc si lista de puncte de //injectare model.rezultateScanare = scanner.StartScan(Url, Cookie, ref injectionPoints); model.injectionPoints = injectionPoints; } catch (Exception e) { model.Message = "Eroare=" + e.Message; } //Atasez modelului si trimit catre view return View(model); }
public void TestHideUnidentifedScans() { // init test data var idFileReader = IdFileReaderFactory.CreateReader(idFile); var ids = idFileReader.Read(); var idList = ids.ToList(); var lcms = PbfLcMsRun.GetLcMsRun(rawFile); foreach (var id in idList) { id.LcMs = lcms; id.RawFileName = Path.GetFileNameWithoutExtension(rawFile); } var scans = lcms.GetScanNumbers(2); foreach (var scan in scans) { idList.Add(new PrSm { Scan = scan, LcMs = lcms, RawFileName = Path.GetFileNameWithoutExtension(rawFile), Score = double.NaN }); } var prsms = idList; // init scan vm var scanVm = new ScanViewModel(new TestableMainDialogService(), prsms); scanVm.ClearFilters(); Assert.AreEqual(prsms.Count, scanVm.FilteredData.Length); ////scanVm.HideUnidentifiedScans = true; Assert.True(prsms.Count > scanVm.FilteredData.Length); }
public ScanWindow() { this.viewModel = new ScanViewModel(); this.InitializeComponent(); this.DataContext = this.viewModel; }
public ScanView() { InitializeComponent(); DataContext = new ScanViewModel(); }
public ScanView() { InitializeComponent(); BindingContext = new ScanViewModel(_navigationService, _scanService, _toddlerService, _tripService, _teacherService); }
/// <summary> /// Initializes a new instance of the MainWindowViewModel class. /// </summary> /// <param name="dialogService">Service for view model friendly dialogs</param> /// <param name="dataReader">Service for reading raw files, id files, and feature files</param> public MainWindowViewModel(IMainDialogService dialogService, IDataReader dataReader) { this.dialogService = dialogService; this.dataReader = dataReader; // Initialize child view models DataSets = new ReactiveList <DataSetViewModel> { ChangeTrackingEnabled = true }; CreateSequenceViewModel = new CreateSequenceViewModel(this.dialogService); ScanViewModel = new ScanViewModel(this.dialogService, new List <PrSm>()); // Remove filter by unidentified scans from ScanViewModel filters ScanViewModel.Filters.Remove(ScanViewModel.Filters.FirstOrDefault(f => f.Name == "Hide Unidentified Scans")); // Create commands for file operations OpenDataSetCommand = ReactiveCommand.CreateFromTask(async _ => await OpenDataSetImplementation()); OpenRawFileCommand = ReactiveCommand.CreateFromTask(async _ => await OpenRawFileImplementation()); OpenTsvFileCommand = ReactiveCommand.CreateFromTask(async _ => await OpenIdFileImplementation()); OpenFeatureFileCommand = ReactiveCommand.CreateFromTask(async _ => await OpenFeatureFileImplementation()); OpenFromDmsCommand = ReactiveCommand.CreateFromTask(async _ => await OpenFromDmsImplementation()); // Create command to open settings window OpenSettingsCommand = ReactiveCommand.Create(() => this.dialogService.OpenSettings(new SettingsViewModel(this.dialogService))); // Create command to open isotopic profile viewer OpenIsotopicProfileViewerCommand = ReactiveCommand.Create(OpenIsotopicProfileViewer); //this.OpenIsotopicProfileViewer(new object()); // Create command to open about box OpenAboutBoxCommand = ReactiveCommand.Create(() => this.dialogService.OpenAboutBox()); // Create command to open new modification management window OpenManageModificationsCommand = ReactiveCommand.Create(ManageModificationsImplementation); // Create MSPathFinder search command RunMsPathFinderSearchCommand = ReactiveCommand.Create(RunMsPathFinderSearchImplementation); // Create export command ExportResultsCommand = ReactiveCommand.Create(ExportResultsImplementation, DataSets.WhenAnyValue(x => x.Count).Select(count => count > 0)); // Create export command QuitProgramCommand = ReactiveCommand.Create(() => this.dialogService.QuitProgram()); ShowSplash = true; // When a data set sets its ReadyToClose property to true, remove it from dataset list DataSets.ItemChanged.Where(x => x.PropertyName == "ReadyToClose") .Select(x => x.Sender).Where(sender => sender.ReadyToClose) .Subscribe(dataSet => { ScanViewModel.RemovePrSmsFromRawFile(dataSet.Title); DataSets.Remove(dataSet); }); // If all datasets are closed, show splash screen DataSets.BeforeItemsRemoved.Subscribe(x => ShowSplash = DataSets.Count == 1); // If a dataset is opened, show splash screen DataSets.BeforeItemsAdded.Subscribe(x => ShowSplash = false); // When the data reader is reading an ID file, show the loading screen this.dataReader.WhenAnyValue(x => x.ReadingIdFiles) .Subscribe(readingIdFiles => IdFileLoading = readingIdFiles); // When a PrSm is selected in the Protein Tree, make all data sets show the PrSm ScanViewModel.WhenAnyValue(x => x.SelectedPrSm) .Where(selectedPrSm => selectedPrSm != null) .Subscribe(selectedPrSm => { foreach (var dataSet in DataSets) { dataSet.SelectedPrSm = selectedPrSm; } }); // Warm up InformedProteomics Averagine using arbitrary mass Task.Run(() => Averagine.GetIsotopomerEnvelopeFromNominalMass(50000)); }
/// <summary> /// Raises the <see cref="E:System.Windows.Application.Startup"/> event. /// </summary> /// <param name="e">A <see cref="T:System.Windows.StartupEventArgs"/> that contains the event data.</param> protected override void OnStartup(StartupEventArgs e) { FrameworkElement.LanguageProperty.OverrideMetadata( typeof(FrameworkElement), new FrameworkPropertyMetadata(System.Windows.Markup.XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag))); Thread.CurrentThread.Name = "MainThread"; base.OnStartup(e); // Init logger log4net.Config.XmlConfigurator.Configure(); // Register handler for unhandled exceptions this.DispatcherUnhandledException += new System.Windows.Threading.DispatcherUnhandledExceptionEventHandler(this.App_DispatcherUnhandledException); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(this.CurrentDomain_UnhandledException); // Build var mainViewModel = new MainViewModel(); this.startViewModel = new StartViewModel(); var scanViewModel = new ScanViewModel(); var previewViewModel = new PreviewViewModel(); var previewNoFilesViewModel = new PreviewNoFilesViewModel(); var synchronizeViewModel = new SynchronizeViewModel(); var synchronizeNoFilesViewModel = new SynchronizeNoFilesViewModel(); var resultViewModel = new ResultViewModel(); var synchronizer = new Synchronizer(new FileLogger()); var startAction = new StartAction(); var scanAction = new ScanAction(synchronizer); var previewAction = new PreviewAction(); var previewNoFilesAction = new PreviewNoFilesAction(); var synchronizeNoFilesAction = new SynchronizeNoFilesAction(); var synchronizeAction = new SynchronizeAction(synchronizer); var resultAction = new ResultAction(); var mainWindow = new MainWindow(); // Bind startAction.Synchronize += scanAction.Process; scanAction.Preview += previewAction.Process; scanAction.PreviewNoFiles += previewNoFilesAction.Process; scanAction.Canceled += startAction.Process; previewAction.Synchronize += synchronizeAction.Process; previewAction.SynchronizeNoFiles += synchronizeNoFilesAction.Process; previewAction.Canceled += startAction.Process; previewNoFilesAction.Ok += startAction.Process; synchronizeAction.Result += resultAction.Process; synchronizeNoFilesAction.Ok += startAction.Process; resultAction.Ok += startAction.Process; // Inject startAction.Inject(mainViewModel); startAction.Inject(this.startViewModel); scanAction.Inject(mainViewModel); scanAction.Inject(scanViewModel); previewAction.Inject(mainViewModel); previewAction.Inject(previewViewModel); previewNoFilesAction.Inject(mainViewModel); previewNoFilesAction.Inject(previewNoFilesViewModel); synchronizeNoFilesAction.Inject(mainViewModel); synchronizeNoFilesAction.Inject(synchronizeNoFilesViewModel); synchronizeAction.Inject(mainViewModel); synchronizeAction.Inject(synchronizeViewModel); resultAction.Inject(mainViewModel); resultAction.Inject(this.startViewModel); resultAction.Inject(resultViewModel); mainWindow.Inject(mainViewModel); // Run this.startViewModel.LoadDefaultJobList(); this.MainWindow = mainWindow; startAction.Process(); this.MainWindow.Show(); }
public MainViewModel() { this.Scan = new ScanViewModel(); }
public ScanPage() { InitializeComponent(); BindingContext = new ScanViewModel(); }
public void Setup() { _navigationServiceMock = new Mock <INavigationService>(); _sut = new ScanViewModel(_navigationServiceMock.Object); }
public void Dispose() { BindingContext = null; viewModel.Dispose(); viewModel = null; }
public ScanPage() { InitializeComponent(); BindingContext = viewModel = new ScanViewModel(); OnSubmitAsync(); }