public HdResult ScanHdToCheckLines(string _hd) { // Creating instance of reflex connection so we can work with its HD instance. // This is needed for passing back HD info from reflex connection to ShellViewModel instance of OriginalHD and COunted HD. // TRY TO SET THIS AS PROPERTY OF SHELL VIEW MODELS var reflexConnection = new ReflexConnectionModel(); // IF checks here if we have some data inside reflexConnection.Hd. // If not then this function return HD unknown (false) if (reflexConnection.DownloadHdFromReflex(_hd)) { // Tricky way to copy one hd to another. Needs to go thru properties manually. // There is porobably better way with function CopyOriginalHdToCountedHd(). if (CheckLineAndGrade()) { foreach (var Ipg in reflexConnection.OriginalHdModel.ListOfIpgs) { if (Ipg.Line == IpgToCreate.Line) { continue; } else { return(HdResult.differentLine); } } } //// We still have some data so return true. return(HdResult.hdCorrect); } else { // Hd is unknown return(HdResult.hdUnknown); } }
/// <summary> /// Download HD information /// </summary> public bool ScanHd() { // Clearing info about already working on HD's. Later should after Confirm function return all is done. // Can be moved also to Reset button. You need oto reset anyway when you are scanning the HD. CountedHd.ListOfIpgs.Clear(); // Creating instance of reflex connection so we can work with its HD instance. // This is needed for passing back HD info from reflex connection to ShellViewModel instance of OriginalHD and COunted HD. // TRY TO SET THIS AS PROPERTY OF SHELL VIEW MODELS var reflexConnection = new ReflexConnectionModel(); // IF checks here if we have some data inside reflexConnection.Hd. // If not then this function return HD unknown (false) if (reflexConnection.DownloadHdFromReflex(CountedHd.HdNumber)) { // Tricky way to copy one hd to another. Needs to go thru properties manually. // There is porobably better way with function CopyOriginalHdToCountedHd(). foreach (var Ipg in reflexConnection.OriginalHdModel.ListOfIpgs) { // It is copied to original and counted at once. Question is it will change only counted or also original??? //CountedHd.ListOfIpgs.Add (new IpgModel () {Item = Ipg.Item, Line = Ipg.Line, Quantity = Ipg.Quantity, Grade = Ipg.Grade }); //OriginalHd.ListOfIpgs.Add (new IpgModel () { Item = Ipg.Item, Line = Ipg.Line, Quantity = Ipg.Quantity, Grade = Ipg.Grade }); CountedHd.ListOfIpgs.Add(new IpgModel() { Item = Ipg.Item, Line = Ipg.Line, Quantity = Ipg.Quantity, Grade = Ipg.Grade, Season = Ipg.Season }); } // We still have some data so return true. return(true); } else { // Hd is unknown return(false); } }