Flakes Construction Yard

YSFlight addon development, questions, tutorials, & more!
User avatar
Flake
Staff
Staff
Posts: 4162
Joined: Thu Feb 10, 2011 8:47 pm
Favorite Aircraft: Honda CBR600RR. Shit I mean Boeing F/A-18A.
Location: Australia
OS: Windows 10 (x64)
Has thanked: 776 times
Been thanked: 1064 times

Re: Flakes Construction Yard

Post by Flake » Sun Dec 31, 2017 1:38 pm

So today I improved the UI a lot more, so I'm not reusing code in places and it's less error prone.

Image
Image

Now console and debug inherit a common abstract console for their code base. Same with the debug/console message types menu.

Improved how richtextstrings are created so that the messages written to the console are less funky when being made and written.

All in all I'm happy with how the console and debug is working for now. Next I'm going to redo all the debug information in MetaData and World, because I'm very sure I've screwed something up there and I want to catch it before I progress any further into the netcode side of things.
Image
Oi. You. Yeah you. Subscribe to my videos. Text your cousins, tell them to do it too!

User avatar
Flake
Staff
Staff
Posts: 4162
Joined: Thu Feb 10, 2011 8:47 pm
Favorite Aircraft: Honda CBR600RR. Shit I mean Boeing F/A-18A.
Location: Australia
OS: Windows 10 (x64)
Has thanked: 776 times
Been thanked: 1064 times

Re: Flakes Construction Yard

Post by Flake » Mon Jan 01, 2018 7:17 am

I'm going to have to redo the UI to use WPF instead of WinForms, as everytime I try and write anything substantial to the form I get a AccessViolation exception due to memory errors in .Net's use of the forms. Fan-freaking-tastic.

EDIT: WPF is actually much easier then I thought it would be. I can design the UI in WPF, then do all the logic in traditional C#, then link it all up and voila. New goal for the next day or three. :)

Image

This works pretty nicely. I like that I can see the output while working on the code, that's a massive help.
Image
Oi. You. Yeah you. Subscribe to my videos. Text your cousins, tell them to do it too!

User avatar
Flake
Staff
Staff
Posts: 4162
Joined: Thu Feb 10, 2011 8:47 pm
Favorite Aircraft: Honda CBR600RR. Shit I mean Boeing F/A-18A.
Location: Australia
OS: Windows 10 (x64)
Has thanked: 776 times
Been thanked: 1064 times

Re: Flakes Construction Yard

Post by Flake » Sat Jan 13, 2018 4:30 am

Image

Gott Dammmmn this took ages to do! :(

WPF is both powerful and sometimes completely useless. After screwing around trying to set bindings, I decided the smartest way to do this would be to just do it all programatically.

I tried DataGrid, ListView, DataGridView, StackPanel...

In the end, it was just easier to use a Grid and then modify the Grid in code behind.

All working now. In fact, now I can have Debug and Console messages in the same window so what I'm going to do now is link those two together, clean up a bit, then stress test. Hopefully WPF is less cancer than WinForms and I can finally get on with it!

All this work for a UI! Christ all mighty! >:|

EDIT: Console and Debug are now one window. Will add checkboxes to choose to see debug messages which will all be off by default.

Image

Unlike winforms, the loading for this is FAAAAAST.
Image
Oi. You. Yeah you. Subscribe to my videos. Text your cousins, tell them to do it too!

User avatar
Flake
Staff
Staff
Posts: 4162
Joined: Thu Feb 10, 2011 8:47 pm
Favorite Aircraft: Honda CBR600RR. Shit I mean Boeing F/A-18A.
Location: Australia
OS: Windows 10 (x64)
Has thanked: 776 times
Been thanked: 1064 times

Re: Flakes Construction Yard

Post by Flake » Fri Feb 16, 2018 9:42 am

Ayy friends, so I've been held up massively by WPF and it's complexities but I'm finally getting the hang of it.

Today I just created a simple sandbox to work on data binding, which is absolutely vital for how the settings will link in.

After much cursing at Microsoft, I worked out how to implement two-way data binding, and how to install Fody and PropertyChanged.Fody which will make UI linking so much cleaner and faster.

So now all I need to do is 3 things:
1. "Settings : INotifyPropertyChanged" and "public event PropertyChanged" on the settings class and Fody will take care of the rest of the UI update noticications, keeping the code clean and easy to read and work with. I don't want to have to mess with UI notifications when updating and changing settings, and this solves that issue.

2. I need to do two other things on the UI: "{Binding Path=<SettingName>, Mode=TwoWay" for each element of the UI, and "DataContext = Com.OfficerFlake.Settings" in the code behind, which will link the UI and Settings together.

3. Create the elements of the UI to control the settings: eg link a menu option to lock/unlock server.

WPF has been an absolute NIGHTMARE to learn, but now I've got the basics down, it's all I need to know as the rest can be sorted out in code behind!

Back to work over the next couple of days and weeks. Thanks for your patience as I learned WPF, it's been REALLY REALLY hard.

Image
Oi. You. Yeah you. Subscribe to my videos. Text your cousins, tell them to do it too!

User avatar
Flake
Staff
Staff
Posts: 4162
Joined: Thu Feb 10, 2011 8:47 pm
Favorite Aircraft: Honda CBR600RR. Shit I mean Boeing F/A-18A.
Location: Australia
OS: Windows 10 (x64)
Has thanked: 776 times
Been thanked: 1064 times

Re: Flakes Construction Yard

Post by Flake » Sat Feb 17, 2018 12:24 pm

Image

On the surface it looks like I've done sweet FA but what you can't see here is a great deal behind the scenes:

1) Settings class is slowly being converted to use INotifyPropertyChanged, and will evenetually be event driven to work with the UI completely. I'm just finishing all that up now.

2) The console output, though it looks no different, is now using a bound DataGrid. This is far less hacky then using a grid and updating with the code behind. Now, to update the UI with a new message, I just do: Messages.Add(...); A massive differernce.

3) I've managed to link up some of the settings already to the settings class. They don't do much but as a proof of concept it all works in both directions now. I can change a setting from the UI, and update the UI from a setting.

These 3 changes are a very big deal for the program now. I spoke with Kujo the other day and what needs to happen from here is:

1) Finish redesigning the settings.
2) Finish adding bits and pieces to the User Interface and link that to the settings.
3) Finish up the remaining packets.
4) Start with beta releases and testing, adding new features as I go.

Also: WPF is hard.

EDIT: Settings complete, but for converting some fields to properties. Quite organised and easy to use now. Logical.

I need tore-work how data comes into the console. I'm converting to objects as the messages come in, where I should instead reference the raw message, and use a converted to put it into textblock format. That should hopefully not take long but I'm ready to be made a fool of.

I'll be quite happy when I have the settings driving the UI fully and vice versa...
Image
Oi. You. Yeah you. Subscribe to my videos. Text your cousins, tell them to do it too!

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest