Click here to Skip to main content
15,797,801 members

Comments by elfenliedtopfan5 (Top 18 by date)

elfenliedtopfan5 22-Mar-23 22:08pm View    
i know i doing it wrong and the fact its not updating on ui tryied to do command that when i push update test on button click it runs this,

public void runsql()
foreach (var item in elfendb.Pumps)

that it does work it got 8 values just does not update on UI dont think i need onpropery changed observably has its own inbuilt on property changed

also thank you for being patient with me i know i struggle to explain well what i am doing thank you again for all help you provided it is much appreciated
elfenliedtopfan5 22-Mar-23 22:04pm View    
Really stupid question what would be best way to pass through the constructor pump type?

i understand the concept just not sure how to implement it
elfenliedtopfan5 22-Mar-23 21:03pm View    
should also mention unsure how to hook this up with the viewmodel as all the main code is in the sqlitedb so trying to get pumps.clear()
and pumps.Add()

would have to add a varaible to the sqlitedb.cs
to acess the mainwindowviewmodel.cs to get the Pumps observable collection if that makes sense
elfenliedtopfan5 22-Mar-23 20:58pm View    
thank you for your reply once again you seem to the most active on here for replies to my questions however when trying to implement the

public PumpType GetPumpData()

string getdb = "select * from PumpState";
SQLiteCommand elfeninfo = new SQLiteCommand(getdb, testing);
SQLiteDataReader result = elfeninfo.ExecuteReader();

if (result.HasRows)
while (result.Read())
// Get Fileds here

//var _id = result["ID"];
int _PumpNo = Convert.ToInt32(result["PumpNo"]);
var _State = Convert.ToInt32(result["State"]);
var _stan = Convert.ToInt32(result["Stan"]);
var _GradeId = Convert.ToInt32(result["GradeId"]);
var _GradeName = Convert.ToString(result["GradeName"]);
var _Ppu = Convert.ToInt32(result["Ppu"]);
var _Volume = Convert.ToInt32(result["Volume"]);
var _Cash = Convert.ToInt32(result["Cash"]);
var _MobileTransaction = Convert.ToBoolean(result["MobileTransaction"]);
var _MobileEnabled = Convert.ToBoolean(result["MobileEnabled"]);

yield return new PumpType
(_PumpNo, _State, _stan, _GradeId,
_GradeName, _Ppu, _Volume, _Cash,
_MobileTransaction, _MobileEnabled);



i get the following error
CS1624 The body of 'SQLITEDB.GetPumpData()' cannot be an iterator block because 'PumpType' is not an iterator interface type

CS1579 foreach statement cannot operate on variables of type 'PumpType' because 'PumpType' does not contain a public instance or extension definition for 'GetEnumerator'

sorry its not put in code block for some reason it wont let me do this in a comment
elfenliedtopfan5 16-Mar-23 21:08pm View    
umm unsure to how I answered my own question when the issue is the button text is not updating that is not answering my own question because that issue still persists.
i was giving Graeme_Grant more information based on what he has suggested and the questions he asked