C
C#9mo ago
!Zeldris

❔ project help

Basically I made an api in Python I figured out how to import its contents through some conversion to JSON and some Http request and stuff idek I just copied and pasted it lol, Anyways the point is I want to know if its possible in C# WPF to check if theres data and add a column with the data until theres no more data to add
8 Replies
Pobiega
Pobiega9mo ago
You have a python-made API that uses JSON. You want to know if using C# and WPF, you can check "if there is data" and "add a column with the data until there is no more data to add". To solve the "if there is data", yes you can make HTTP requests from C# using HttpClient. To solve the second question, thats harder, because there are very many unknowns here. First, did you mean row instead of column? Also, what controls are you using to display this data? second, "until there is no more data to add" depends on a few things. Should the WPF app show ALL the data from the python API? Can the user add things to the grid themself? Will that data be sent to the API?
!Zeldris
!Zeldris9mo ago
Yes I meant rows instead of colums, something like a ListView For the second, I assume it would be an easy if else If theres more data continue If not stop
Pobiega
Pobiega9mo ago
is your python API paginated? how does it communicate "more data available"?
!Zeldris
!Zeldris9mo ago
My api is static so its not grabbing information anywhere
Pobiega
Pobiega9mo ago
Okay. Well, then just have your app fetch all the data from the API on startup if you want to store this clientside to reduce the amount of data transmitted, you could tag the data with a "lastUpdatedAt:" field and save that too then you can fetch just that update field with another api endpoint and compare it to your local save (this assumes a large and expensive to calculate amount of data, if its small, just fetch it every time)
!Zeldris
!Zeldris9mo ago
The main issue was just creating those rows, when the data gets requested is that simple to do?
Pobiega
Pobiega9mo ago
yes you need some kind of event to let you know when to fetch the data window load, button click, etc then just query the data with HttpClient.GetFromJson<YourType> and create a row for each result
Accord
Accord9mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server
More Posts
❔ Deserializing JSONI'm working on a project where I need to deserialize a JSON api response, and do things with the dat✅ In a WPF application, how do you keep a modal window above all other windows for that app?I only want that window on top of other windows for that application, not on top of everything.✅ Reoccurring times with a possibility to a one time rep in C#Suppose we have an entity which represents irl event, this event can reoccur every week or be one-ti❔ Property vs field?Hi everyone, I have a really basic but also really important question regarding C#. I have been cod❔ [EFCore] What is the right approach to generate hierarchy id for new child entity?I Use SQLServer & EF Core. been struggling to find the right approach to generate new h-id for new ✅ ConstructorsIf Constructors are just a method called when a class is created, how does the new operator in combi❔ Conditional in semantic kernel (skprompt.txt file)Hey guys, I currently using semantic kernel to do stuff related with AI in my console app. In sema❔ Can I/How would I do these things with CefGlue.Avalonia?So im trying to make something, but idk what to do because im not sure how much of this can even be ❔ how can i save flow layout panelim doing a simple video game library with C# but the problem is i cant save them when i add new pane❔ Is it possible to log for the user (not dev) with localization?Given that a multi-lingual app exists And it is currently configured to some language When something