public ScannerDataViewModel ( IElementManager <Camera> cameraManager, IElementManager <Lens> lensManager ) { Title = "Scanner Data"; Informations = ""; CamerasManager = cameraManager; LensesManager = lensManager; cameraManager.LoadData(_camerasPath); Cameras.AddRange(cameraManager.GetList()); lensManager.LoadData(_lensPath); Lenses.AddRange(lensManager.GetList()); LeftLine = new Line() { X1 = 0, X2 = 0, Y1 = 0, Y2 = 0 }; RightLine = new Line() { X1 = 0, X2 = 0, Y1 = 0, Y2 = 0 }; MinValue = 150; MaxValue = 600; ActualValue = 300; ActualAngle = 0; AddData(); }
public bool DeleteLense(string lense) { var item = Lenses.Find(l => (l.Name == lense)); if (item != null) { Lenses.Remove(item); return(true); } return(false); }
public void TestLenses() { var file = @"..\..\..\Assets\Lenses\lenses.data"; var set = new Lenses().Parse(file); var tree = set.BuildTree(); tree.DisplayTree(); foreach (var instance in set.Instances) { Assert.That(Tree.ProcessInstance(tree, instance).Value, Is.EqualTo(instance.Output.Value)); } }
public bool AddLense(Lense newLense) { var lense = Lenses.Find(l => (l.Factor == newLense.Factor)); if (lense == null) { //create a new lense Lenses.Add(newLense); return(true); } else { return(false); } }
public void UpdateHistory(string productLabel, int quantity) { var lens = Lenses.Where(l => l.ProductLabel == productLabel).Include(m => m.Material).ToList(); LensHistory lensHistoryToUpdate = new LensHistory { ProductLabel = lens[0].ProductLabel, Sphere = lens[0].Sphere, Cylinder = lens[0].Cylinder, AntiReflectiveCoating = lens[0].AntiReflectiveCoating, Transitions = lens[0].Transitions, Material = lens[0].Material, Quantity = quantity, RemainingCount = lens[0].RemainingCount, InsertDate = DateTime.Now }; LensHistory.Add(lensHistoryToUpdate); SaveChanges(); }
public Lense GetLense(string lense) { return(Lenses.Find(l => (l.ToString() == lense))); }
public bool ValidateLens(string productLabel) { return(Lenses.Any(l => l.ProductLabel == productLabel)); }
public Lens Get(string productLabel) { Lens v = Lenses.FirstOrDefault(l => l.ProductLabel.ToLower() == productLabel.ToLower()); return(v); }