private bool RecipeChanged() // return false if no change in recipe name. { if (isUpdating) { return(false); } if (recipeUpdate == null) { recipeUpdate = new ServerItemUpdate(); recipeUpdate.IsUpdated(ServerItemUpdate.ItemsEnum.RaMOSRecipe, omniView.GetItemUpdate()); } // Get which items in the server has updated... ServerItemUpdate currentItemUpdate = omniView.GetItemUpdate(); if (omniView.CommunicationUp() == triState.True && recipeUpdate.IsUpdated(ServerItemUpdate.ItemsEnum.RaMOSRecipe, currentItemUpdate)) { ramos.Recipe = omniView.GetRaMOSRecipe(); if (string.IsNullOrEmpty(recipeName)) { recipeName = ramos.Recipe.RecipeName; } if (recipeName != ramos.Recipe.RecipeName) { recipeName = ramos.Recipe.RecipeName; updateDatapool = true; logger.Debug($"Recipe updated, different recipe selected."); return(true); } updateDatapool = true; } return(false); }
public static void Init() { T = new Timer(); T.Interval = 5000; // 5 sec 5*1000ms T.Enabled = true; T.Elapsed += new ElapsedEventHandler(onElapsedEvent); Ramos = new BOSCtrl(null); Ramos.SolveReport.UpdateEvent += SolveReport_UpdateEvent; ServerItemUpdate = new ServerItemUpdate(); ServerItemUpdate.IsUpdated(ServerItemUpdate.ItemsEnum.UpdateProduct, OmniView.GetItemUpdate()); }
private static void onElapsedEvent(object sender, ElapsedEventArgs e) // Runs every T (timer) seconds. See Init() for T value. { var results = OmniView.GetRaMOSFeederSetup(); if (results == null) { return; } foreach (var feeder in SimpleIoc.Default.GetInstance <ApplicationViewModel>().Feeders) { feeder.IsManual = results[feeder.FeederNumber].Enabled && results[feeder.FeederNumber].ReadFixedRateFromDatapool && results[feeder.FeederNumber].FixedRateEnabled; foreach (var source in feeder.Sources) { if (!results.Items.Any(x => x.SourceEstimateName == source.SourceEstimateName)) { feeder.Sources.Remove(source); } } foreach (var source in results.Items.Select(f => new { f.SourceEstimateName, f.Index })) { if (!feeder.Sources.Any(x => x.SourceEstimateName == source.SourceEstimateName)) { feeder.Sources.Add(new SourceData(source.SourceEstimateName, source.Index)); } } } ServerItemUpdate currentUpdate = OmniView.GetItemUpdate(); if (OmniView.CommunicationUp() == Thermo.Communication.Communication.ClientCom.triState.True) { if (ServerItemUpdate.IsUpdated(ServerItemUpdate.ItemsEnum.RaMOSSolveReport, currentUpdate)) { Ramos.SolveReport.Assign(OmniView.GetRaMOSSolveReport()); } if (ServerItemUpdate.IsUpdated(ServerItemUpdate.ItemsEnum.RaMOSRecipe, currentUpdate)) { Ramos.Recipe.Assign(OmniView.GetRaMOSRecipe()); } } }