internal void ProcessInputs(int?qty, string barcodeText) { if (!qty.HasValue) { return; } if (!TryParseBarcode(barcodeText, out ulong bCode)) { return; } var skuDesc = _skus.FindDescription(bCode); if (skuDesc.IsBlank()) { Alerter.ShowError("Unregistered Barcode", $"Barcode is not in Products Master List:{L.f}“{bCode}”"); return; } var row = new ItemCountRow { TimeScanned = DateTime.Now, Quantity = qty.Value, Barcode = bCode, Description = skuDesc, }; row.DeleteCmd = R2Command.Relay(() => ItemCounts.Remove(row)); ItemCounts.Insert(0, row); }
private bool TryParseBarcode(string barcodeText, out ulong bCode) { var ok = ulong.TryParse(barcodeText, out bCode); if (!ok) { Alerter.ShowError("Invalid barcode value", $"Not a valid number:{L.f}“{barcodeText}”"); } return(ok); }
private object TryResolveMainWindowVM(ILifetimeScope scope) { try { return(ResolveMainWindowVM(scope)); } catch (DependencyResolutionException ex) { Alerter.ShowError("Resolver Error", ex.GetMessage()); return(null); } }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); SetDataTemplates(); var win = new MainWindow(); try { win.DataContext = GetMainWindowVM(e); win.Show(); } catch (DependencyResolutionException ex) { Alerter.ShowError("Resolver Error", ex.GetMessage()); win.Close(); } }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); var win = new MainWindow(); try { using (var scope = Repo2IoC.BeginScope(this, "testDownloader1_open")) win.DataContext = new MainWindowVM(scope, e.Args); win.Show(); } catch (DependencyResolutionException ex) { Alerter.ShowError("Resolver Error", ex.GetMessage()); win.Close(); } }
protected virtual void OnError(Exception error) => Alerter.ShowError($"Error on task : “{_origLabel}”", error.Info(false, true));