public ShellViewModel(HdDataGridViewModel hdDataGridModel, LoginViewModel loginViewModel, IWindowManager windowManager, IEventAggregator events) { log.Info("Constructor ShellViewModel"); #region Events and windows LoginViewModel = loginViewModel; WindowManager = windowManager; HdDataGridModel = hdDataGridModel; _events = events; events.Subscribe(this); #endregion //Location = ConfigurationManager.AppSettings["Location"]; //PrinterIp = ConfigurationManager.AppSettings["PrinterIp"]; Title = $"HdSplit/Check version: {Assembly.GetEntryAssembly().GetName().Version}"; ReflexFile.CheckForFolderAndFile(); InformationText = "Scan HD to start splitting"; ErrorLabelShowRunning = false; SelectedTab = 0; HdTaskIsRunning = false; ScanningState = States.firstScanOfHd; CanCheckLine = true; CheckLine = true; ReflexConnection = new ReflexConnectionModel(); ReflexTerminal = new ReflexTerminalModel(); ReflexTerminal.OpenReflexTerminal(); }
public void DownloadUpc() { // 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(); // First we are going to download and save in a dictionary. var Ean_Upc = reflexConnection.DownloadUpcForItemsAsync(CountedHd.ListOfIpgs); // This: v is returning bindable collection of IPG's foreach (var Ipg in CountedHd.ListOfIpgs) { // Take EAN items from IPG, look for a key in dictionary, and assign it to UPC. Ipg.UpcCode = Ean_Upc[Ipg.Item]; } // Unfortunately needed for updating DataGrid. CountedHd.ListOfIpgs.Refresh(); }
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); } }