The Official Status Thread
-
@Tsaukpaetra said in The Official Status Thread:
Status: Trying to use a DataGridView control. The data source is a list of objects that need a special constructor. This is all fine, I can add items at will and edit them.
Now, I want to cancel adding an item, but there seems to be no way to tell that this happened at all. The row disappears, the item is removed from the source (which is a List), but since that list is decoupled from the actual source (which is a Dictionary), I can't easily sync the state of the two sources.
Why is this so difficult? grr...
@TwelveBaud said in The Official Status Thread:
@Tsaukpaetra Why do you have a
List
that's decoupled from yourDictionary
? Why not use aBindingList
so you can more easily track changes? Why not use a customIDataAdapter
to create an appropriateDataSet
from your dictionary, and get actual full change control management? If you're using crappy Windows Forms databinding, why aren't you using crappy Windows Forms databinding?is using Windows Forms in the first place. Come over to the XAML side. We have cookies!
-
@pie_flavor said in The Official Status Thread:
@Tsaukpaetra Sounds like you're doing a bit of cargo-cult combined with not RTFMing.
Maybe. I've figured out a workaround for their lack of completeness: the grid has a leave row event that I can check if the row that's being left is the new row or not. If the user actually input data, that row gets incremented, and so if it's still the same I can assume they didn't enter anything and thus delete the object (as it's going to be deleted on the shadowed data source).
Kludgy but works.
-
@GOG said in The Official Status Thread:
Come over to the XAML side
Fuck that noise with a steel-infused cactus-modeled dildo with tamper-evident removal barbs!
The less I need to deal with that the better.
-
@Tsaukpaetra Yer loss, mate.
-
@Tsaukpaetra said in The Official Status Thread:
@GOG said in The Official Status Thread:
Come over to the XAML side
Fuck that noise with a steel-infused cactus-modeled dildo with tamper-evident removal barbs!
The less I need to deal with that the better.
Remember, everything to do with XML is automatically bad, including the use-case that everyone that complains 'you're using XML wrong, it's not meant to be used for data-serialization, it's meant to be used for this' is describing by 'this'. Revel in the belligerence.
-
@pie_flavor said in The Official Status Thread:
everything to do with XML is automatically bad
No, just that I usually spend a few minutes mocking something up in the XML and then a few weeks getting the bindings and code behind to actually make it work.
The only time something went smoothly is when it was literally a window with a textbox and button. Everything else was like designing and executing a hip replacement.
-
@pie_flavor said in The Official Status Thread:
@Tsaukpaetra said in The Official Status Thread:
@GOG said in The Official Status Thread:
Come over to the XAML side
Fuck that noise with a steel-infused cactus-modeled dildo with tamper-evident removal barbs!
The less I need to deal with that the better.
Remember, everything to do with XML is automatically bad, including the use-case that everyone that complains 'you're using XML wrong, it's not meant to be used for data-serialization, it's meant to be used for this' is describing by 'this'. Revel in the belligerence.
What is XML if it isn't data serialization?
-
@topspin said in The Official Status Thread:
@pie_flavor said in The Official Status Thread:
@Tsaukpaetra said in The Official Status Thread:
@GOG said in The Official Status Thread:
Come over to the XAML side
Fuck that noise with a steel-infused cactus-modeled dildo with tamper-evident removal barbs!
The less I need to deal with that the better.
Remember, everything to do with XML is automatically bad, including the use-case that everyone that complains 'you're using XML wrong, it's not meant to be used for data-serialization, it's meant to be used for this' is describing by 'this'. Revel in the belligerence.
What is XML if it isn't data serialization?
It's a descriptor of information, totally different!
-
-
@Tsaukpaetra said in The Official Status Thread:
@pie_flavor said in The Official Status Thread:
everything to do with XML is automatically bad
No, just that I usually spend a few minutes mocking something up in the XML and then a few weeks getting the bindings and code behind to actually make it work.
The only time something went smoothly is when it was literally a window with a textbox and button. Everything else was like designing and executing a hip replacement.
Presuming you meant to say XAML there, if this is the case you're
(and if you're doing code behind in a XAML-based framework, you're really
)
-
@GOG said in The Official Status Thread:
if you're doing code behind in a XAML-based framework
Hence why I avoid the wrong tool for the job, QED.
-
@Tsaukpaetra Why would you want to use code-behind, though? Unless jamming noodles is your thing, but I thought there was only one of you here.
-
@topspin said in The Official Status Thread:
@pie_flavor said in The Official Status Thread:
@Tsaukpaetra said in The Official Status Thread:
@GOG said in The Official Status Thread:
Come over to the XAML side
Fuck that noise with a steel-infused cactus-modeled dildo with tamper-evident removal barbs!
The less I need to deal with that the better.
Remember, everything to do with XML is automatically bad, including the use-case that everyone that complains 'you're using XML wrong, it's not meant to be used for data-serialization, it's meant to be used for this' is describing by 'this'. Revel in the belligerence.
What is XML if it isn't data serialization?
What do the M and the L in XML stand for?
-
@pie_flavor XML
-
@Mingan Instead of XML?
-
@dkf Or, XML
-
-
Dear Amazon, if you say you've shipped something and give an estimated arrival date, it might be hard to actually make that estimate if you don't give the package to the courier on or before that date
-
@GOG said in The Official Status Thread:
@Tsaukpaetra Why would you want to use code-behind, though? Unless jamming noodles is your thing, but I thought there was only one of you here.
Perhaps I'm not understanding what you mean by "code behind".
I have an object that represents my data structure. I want (in this instance) to display/edit it without much fuss.
WPF/XAML has never made this easy or straightforward.In any case, the issue has been resolved and I've moved onto more important things, like trying to figure out why error messages are being output twice when I only asked for them once...
-
@hungrier Haha, wow. Just after I submitted that post, I got an "out for delivery" notification for that package
-
@hungrier said in The Official Status Thread:
@hungrier Haha, wow. Just after I submitted that post, I got an "out for delivery" notification for that package
Amazon is secretly using portals.
-
@Tsaukpaetra said in The Official Status Thread:
@GOG said in The Official Status Thread:
@Tsaukpaetra Why would you want to use code-behind, though? Unless jamming noodles is your thing, but I thought there was only one of you here.
Perhaps I'm not understanding what you mean by "code behind".
I have an object that represents my data structure. I want (in this instance) to display/edit it without much fuss.
WPF/XAML has never made this easy or straightforward.In any case, the issue has been resolved and I've moved onto more important things, like trying to figure out why error messages are being output twice when I only asked for them once...
WPF takes a moment to wrap your head around - mostly because nobody does a very good job of explaining it - but the "get your model data bound up and displayed without much fuss" part is exactly why I recommend XAML/MVVM these days. Being able to do all the heavy lifting in code that's decoupled from the View is a bonus.
-
@pie_flavor said in The Official Status Thread:
@topspin said in The Official Status Thread:
@pie_flavor said in The Official Status Thread:
@Tsaukpaetra said in The Official Status Thread:
@GOG said in The Official Status Thread:
Come over to the XAML side
Fuck that noise with a steel-infused cactus-modeled dildo with tamper-evident removal barbs!
The less I need to deal with that the better.
Remember, everything to do with XML is automatically bad, including the use-case that everyone that complains 'you're using XML wrong, it's not meant to be used for data-serialization, it's meant to be used for this' is describing by 'this'. Revel in the belligerence.
What is XML if it isn't data serialization?
What do the M and the L in XML stand for?
Markup Language? Presumably for, you know, “data“ in a broad sense?
-
@GOG said in The Official Status Thread:
the "get your model data bound up and displayed without much fuss" part is exactly why I recommend XAML/MVVM these days.
Yeah, which is strange because I've had precisely the opposite of success in doing it.
-
@Tsaukpaetra Not surprised, given my initial experiences (as I said: nobody does a good job of explaining it).
For 90% of my use cases I use two dead-simple base classes: a
ViewModelBase
that just implementsINotifyPropertyChanged
and does nothing else and aDelegateCommand
that implementsICommand
through delegates, so you can setExecute
andCanExecute
to whatever you need in your specific instance.After that, all you need is to expose your model as properties in a View Model, create your commands either as separate classes (if you want reusability) or simply by setting the delegates to methods within your View Model (the quick and dirty way), call
NotifyPropertyChange
whenever your model has changed, set theDataContext
of your View to your View Model, bind up your properties and commands and you're done.
-
@GOG said in The Official Status Thread:
dead-simple
That's a whole lot of shit to do when all I want is a user-editable grid of stuff and a way to get back the edited data when the user clicks a button....
My current flow is:
- Get the dictionary and transform it into a list
- Shove the list into the dataSourceThingamabob
- Let the user fuck with it
- Grab the list and convert it back into the dictionary
- Profit.
It took about ten minutes of work, after figuring out the wackiness with how it adds new rows but doesn't notify that it's deleting the added row.
-
@Tsaukpaetra I can't really see how your way is simpler given that you still have to feed your view data and you still have to implement the commands. The base classes I mentioned are something you keep in a library, so they're strictly a write-once-use-everywhere option.
One advantage of what I outlined is you don't have to faff about with converting dictionaries to lists and vice versa. Just expose the dictionary directly - the
ItemsSource
on allItemsControl
derived classes (anything you'd use to display a list of items, basically) takes anIEnumerable
. Have all your commands operate on the dictionary directly and just notify the view that it has changed when you've committed the changes.
-
Status: I think I'm going to start a conspiracy theory that Merriam-Webster deliberately uses obscure words in its definitions to make people using their dictionaries to look up words spend even more time using their dictionaries and looking up words.
I mean, just look at this:
"Flagrantly wicked or impious". Yeah, that's definitely going to help the person who doesn't know what "nefarious" means.
-
@GOG said in The Official Status Thread:
Have all your commands
That's the crux: There is no command. It's "Load" and "Save". There are no other functions that modify the data at all.
But all this is besides the point.
Please, if you may, continue the discussion over yonder: https://what.thedailywtf.com/topic/27334/tsaukpaetra-s-bindings-to-a-grid/
-
@GOG said in The Official Status Thread:
For 90% of my use cases I use two dead-simple base classes: a
ViewModelBase
that just implementsINotifyPropertyChanged
and does nothing else and aDelegateCommand
that implementsICommand
through delegates, so you can setExecute
andCanExecute
to whatever you need in your specific instance.Both of these are available in Prism library (used to be official MS product, now it's more like Boost in C++03 - so common it could've as well been part of standard library). So you don't even need to implement them yourself. Their "ViewModelBase" is called
BindableBase
.
-
@Gąska said in The Official Status Thread:
@GOG said in The Official Status Thread:
For 90% of my use cases I use two dead-simple base classes: a
ViewModelBase
that just implementsINotifyPropertyChanged
and does nothing else and aDelegateCommand
that implementsICommand
through delegates, so you can setExecute
andCanExecute
to whatever you need in your specific instance.Both of these are available in Prism library (used to be official MS product, now it's more like Boost in C++03 - so common it could've as well been part of standard library). So you don't even need to implement them yourself.
That's how I found them in the first place. The only reason I rolled my own was that I try to minimize third-party dependencies where possible and these two are really basic.
-
@Tsaukpaetra said in The Official Status Thread:
trying to figure out why error messages are being output twice when I only asked for them once...
I thought we moved away from Community Server ages ago!
-
Battery Status: Successfully didn't burn my house down... yet.
There are four more not in this picture, currently on the charger.
-
@hungrier Huh, that holder model doesn't seem to be very efficient.
-
@Tsaukpaetra Those were the holders that originally held the things in place in the HP battery module. They have screws (pictured) to hold them inside the case, and they also had some goop on them and metal tabs connecting the batteries to each other. I kept the plastic bits because they're convenient to keep them together and upright
-
Status: Wondering why loads of tabs, that automatically started playing videos while installing a system update, were all subsequently invisible unless they had another non-youtube page in the same window. Moreover, once the offending windows were found (from the Chrome Task Manager) then it was impossible to minimise them after opening them; the tabs had to be moved to a separate window.
There's quite a few
s there in juxtaposition.
-
@hungrier said in The Official Status Thread:
originally
Ah, thought perhaps you had 3d-printed them.
-
@hungrier said in The Official Status Thread:
Successfully didn't burn my house down... yet.
I see no lemons.
-
@error said in The Official Status Thread:
My doctor is now 45 minutes late for my televisit.
Edit: now 1 hour
Filed under: Yeah, I'm with you on this one, spellcheck.
Are you in the wrong time zone?
-
@BernieTheBernie duh. He lives in USA, all their timezones are wrong
-
Status: Making tea for much-needed caffeine requires not just boiling water and a mug; it requires putting tea leaves into the boiling water.
Filed under: Caffeine
-
@HardwareGeek Should'a used coffee, that doesn't require any tea leaves
-
Battery Status Update: First cell tested at 1159 mAh, pretty much what I expected. Too bad the testing cycle takes a few hours per cell so it'll be a while before I know the capacity of all of them.
-
@hungrier said in The Official Status Thread:
@HardwareGeek Should'a used coffee, that doesn't require any tea leaves
- I possess tea leaves. I do not possess coffee beans (whole, ground, or in any other form).
- It would still require putting the {tea|coffee} in the water. This was the step that was (almost) omitted in my caffeine-deficient state.
-
I drink cold brew now. It's great; you can just grab it out of the fridge and drink it. It comes in bottles, cans, or you can brew it yourself.
-
Status: Amused.
-
-
-
@HardwareGeek said in The Official Status Thread:
@error said in The Official Status Thread:
cold brew ... drink it
No.
E_COFFEE_NOT_TEA
Eww.
-
status: I find myself in a dark and empty place...