✅ Representing an ongoing conversation in XAML and recording it

I'm working on an application in WPF that will show on going conversations much like what you see here. The conversation could go back in history infinitely far back in time (or at least to when it started). I also want to save it to a file. As posts in the conversation get older, it might be worth allowing garbage collection to remove them from memory until the user tries to scroll that far back. I also want a log file for the user to browse and search, if desired, with tools like GREP or PowerShell. Unfortunately, I don't think a human readable format will store enough information. So I may need a JSON log as well that I'd reload conversations from. All this needs to be shown with XAML. If the conversation is too short, I'd like some filler for the space above (below?) the existing posts until the posts fill the window. Any suggestions on how to implement that?
31 Replies
Denis
Denis8mo ago
How Discord Stores Trillions of Messages
Engineer Bo Ingram shares insight into how Discord shoulders its traffic and provides a platform for our users to communicate.
Will Pittenger
Will Pittenger8mo ago
Unfortunately, that may be of limited help. It's Rust. This is C#. That's backed by SQL. All I have is a pair of text files. Plus, I was talking more about in memory representation and how to display it in WPF.
Denis
Denis8mo ago
My general workflow when planning a project is to figure out the foundational architecture. Yes, the article might be about rust and your target is C#, but at this stage the programming language is irrelevant. The scale of your application wasn't quite clear from your description. When saying "infinite number of messages" I assumed truly tons of messages, so in-memory storage didn't even occur to me. Your first step is to research what kind of database is best suited for storing a chain of objects representing chat messages. Is it best in NoSQL or SQL? Can it be done with EF Core? What data do you want to support - text, rich text, images...? Define the big picture and work your way down by answering each question and asking new ones. If you want to keep it simple, the use an in memory or sqlite database to store chat text based messages. Each message will have a channel id and send date (that defines the message order). Don't really understand the text files tbh. If you wish to keep a copy of the text files that replicate what you are storing in the database, then... I guess you need to somehow figure out how you want to structure your data Can't really answer that for you.
Denis
Denis8mo ago
Stack Overflow
WPF Datagrid: Lazy Loading / Inifinite scroll
I fill the Datagrid with 250 rows. When the user scrolls down using the scrollbar (below 75% for example), I want to fetch the next 250 rows from the database, and so on. The idea is that the grid ...
Denis
Denis8mo ago
This is another puzzle piece for your app
Will Pittenger
Will Pittenger8mo ago
Well, one text file is meant for people. Think of the logs recorded by IRC clients like HexChat. A sample of what it could look like is below. This isn't a Discord client, but rather IRC.
Sep 27 07:02:12 --- Channel #inkscape created on Wed May 19 07:19:34 2021
Sep 27 07:02:53 <WillPittenger> Does Inkscape still come with a way to export or save an SVG to XAML? I can't find it in 1.3.
Sep 27 07:06:55 <WillPittenger> Found https://gitlab.com/inkscape/inkscape/-/issues/4502.
Sep 27 07:17:29 <WillPittenger> I found https://gitlab.com/inkscape/extras/extension-xaml but can't figure out how to install it.
Sep 27 07:02:12 --- Channel #inkscape created on Wed May 19 07:19:34 2021
Sep 27 07:02:53 <WillPittenger> Does Inkscape still come with a way to export or save an SVG to XAML? I can't find it in 1.3.
Sep 27 07:06:55 <WillPittenger> Found https://gitlab.com/inkscape/inkscape/-/issues/4502.
Sep 27 07:17:29 <WillPittenger> I found https://gitlab.com/inkscape/extras/extension-xaml but can't figure out how to install it.
I'm also trying to avoid a DBMS for now as it's only a mockup at this stage. What's EF Core? A lot of it is mostly thinking of how to implement the real thing. Would we go with a DBMS then? I hope not. As for "infinite" messages, all would be kept locally. We don't have a server. But 20 years from now, the user might want to view messages received shortly after we release our first version. As for the mockup, I would like to the memory structures to represent the real needs so we can see if they meet our needs. For the UI, I was thinking of a stack panel inside a scroll viewer. But I haven't gotten much further. Most likely, for the mockup, I'll be hard coding the conversations it'll display.
Denis
Denis8mo ago
20 years from now? Is this a real product or just an open source hobby project? If you wish to avoid using an established database, for whatever reason, you'd end up basically creating one yourself, only based on files. At this stage of the project, your focus should completely exclude the UI, that part is the least important and can be left for later. EF Core is an ORM, it allows you to store data in memory or in a database. I'm trying to steer you in the right direction. I understand that you can't write out your entire plan here in discord, but at this stage I feel like your planning requires more thinking. You can't be focused on development when you haven't completed your analysis, that'll lead to a very messy, unmaintainable application. Again, sorry if you already have this done, just seems to me that this is missing.
Will Pittenger
Will Pittenger8mo ago
As for excluding the UI, well, I need something to show people that aren't programmers.
Denis
Denis8mo ago
I do not mean exclude it entirely I mean that for now, you should focus on getting a solid backend the foundation of your application Here is my basic rundown for a project: 1. Strategic analysis - target demographic, expected project lifespan 2. Domain analysis - in what domain (e.g., manufacturing parts, music theory, word processing...) is this project? What aspects of the domain will it cover? What does the target demographic usually need when working in this domain? What can be optimized/automated? 3. Domain refinement - talk to experts in the given domain field. They will provide useful information for refining your domain analysis and will help you better understand what you need to develop 4. Feature definition (the what) - identify what your product should provide to its target demographic 5. Use case definition (the how) - define specific use cases for each feature 6. Technical stack - research available technologies that suit your defined requirements 7. Proof of concept - play around with the selected technologies to verify whether they are truly suitable 8. Retrospective - talk to your stakeholders. Describe what you came up with, get their approval, use their notes to refine your plan 9. Development - fingers on keyboard go tap tap 10. QA - you test the hell out of it 11. Beta - stakeholders test it 12. Release The preparation for development is commonly overlooked. If you want a solid product, you need to understand what you are building, who it is for, what they need. You can't ask stakeholders what they need directly, very often they themselves don't know it.
Will Pittenger
Will Pittenger8mo ago
Unfortunately, a lot of would be users think they're happy with existing clients. But those haven't been developed actively (beyond bug fixes) for years or even a decade. Some, not even that. So when I wasn't seeing what I wanted, I started something more like what I wanted. Initially, I wanted to have something to show other programmers to get them involved in the project. Unfortunately, I only have one other developer currently. She doesn't know C#, but is used to JS. My JS skills are clumsy at best. Plus, she's facing personal issues currently. As for requirements, we do have https://github.com/ChatZilla-Replacement-Project. That was the first thing I did.
Denis
Denis8mo ago
This is very good. Have you done any research on available .NET GUI frameworks? If you wish to be on the web, desktop, mobile... maybe WPFis not the best option? that is #6 of my list
Will Pittenger
Will Pittenger8mo ago
Well, a mobile app might be mostly unrelated or at least use a different UI. You'll note a TUI was mentioned. Windows WPF is what I can develop now. It's what I know along with Windows Forms. (I'd be rusty, but I could probably dig out my old MFC knowledge too.)
Denis
Denis8mo ago
Take this for consideration Hybrid Blazor apps
Will Pittenger
Will Pittenger8mo ago
Web option requires a server we don't have. That was listed because the existing program mentioned in the project's title was developed as a part of the old Mozilla suite and later became a browser. The feasiblity of doing something like that is helped by Electron JS and other PWA plaforms.
Denis
Denis8mo ago
Blazor is a modern web UI framework on .NET You can wrap it into a desktop client like WPF, WinForms or better yet, Avalonia (cross-platform) Blazor can be both a desktop app, and run on the web as a PWA Additionally, you have .NET MAUI It provides mobile app support and can also wrap blazor Your colleagues, who is acquianted with web dev, shouldn't feel too alien with Blazor And neither should you, as it is web dev for c# devs, no JS, laser focused on C# and HTML ofc, you can use JS if you really want it
Will Pittenger
Will Pittenger8mo ago
Is it like ASP.net?
Denis
Denis8mo ago
yep only it can use MVVM
Will Pittenger
Will Pittenger8mo ago
I wasn't terribly interested in what I saw of ASP.net, JSP, or JSF. They seem to rely on the app being small. But then, 95% of what I've worked on were drill-down thick client applications. TypeScript was a little more interesting ,especially combined with something like React JS. But it doesn't ensure type safety as it still allows plain JS to be used.
Denis
Denis8mo ago
Maybe that was true for old ASP.NET but now we have ASP.NET Core and Blazor Where you have type safety
Will Pittenger
Will Pittenger8mo ago
In my C# code, I dont' even use var. I want to be able to see the type right there.
Denis
Denis8mo ago
Don't see how this is relevant? But in general I disagree with not using var. Your class members and variables should be descriptive enough to understand what is going on without seeing the type All in all, I see the iirc project as a very interesting one. All I'm trying to say is that what you need is a solid "theoretical" foundation before you go "practical
Will Pittenger
Will Pittenger8mo ago
Well, if you'd like to join, let me know. We could use you. Though our main communications is via Libera, not Discord. I'd need your GitHub ID.
Denis
Denis8mo ago
Not interested, I have a lot on my hands right now
Will Pittenger
Will Pittenger8mo ago
😉 Most of what I've done in my carreer is UI design. So I know little of the backend needs.
Denis
Denis8mo ago
Check out what existing iirc clients use front an architectural point of view don't look at whether they use c++ or whatever. Look at whether they have persistence. What kind? Are they using a database? Do they offer user authentication?
Will Pittenger
Will Pittenger8mo ago
Well, that JS developer I mentioned knows a lot of how ChatZilla works internally.
Denis
Denis8mo ago
Then find the respective solutions for that in the world of .NET
Will Pittenger
Will Pittenger8mo ago
But cZ supports SASL, but it doesn't seem to work outside a browser. In fact, it was this developer that wrote that script.
Denis
Denis8mo ago
I'm not well acquianted with the IIRC domain, so I do not know what these abbreviations mean. Then you figure out how to run in locally
Will Pittenger
Will Pittenger8mo ago
SASL is Software Authentication Security Layer.
Accord
Accord8mo 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.