Today to the bookstore to see a book called "C # Internet of Things Programming fundamentals " books, interested in the internet of things I grabbed to see, the book is the project is the host computer development projects, simpler, if the Internet of things development is just this, it seems that I do IoT development is more than enough. I looked at this book for more than 10 minutes, and the technical mishap made me face it. This book says using WPF to write programs, but in addition to creating a WPF project, using WPF to write the interface, and WPF does not have any relationship, the code is written in the background, the background code is still written in WinForm way. Does the author have any misunderstanding about WPF?
Using WPF to write you don't use the MVVM pattern to write? Well, even because it's a small project, it's not written in the MVVM mode, and the backend code is written in WPF? For example, commands, bindings, value converters, and so on, here are a few examples of books to show you the technical flaws in this book.
This defines an entity class, and since the entity class is defined, is it difficult to use the MVVM pattern for layering?
Implement function Btncollect_click, so that the button on the display "Start acquisition", "Stop acquisition" There are many elegant ways, why in such an ugly way to achieve? Since this book says that it is written in WPF, the Boolean type of iscollecting is also defined in the class, directly using the WPF value converter, defining a property, binding the value conversion of this property on the button, the function btncollect_click a sentence code can be implemented, It also allows the reader to understand what is the wpf,wpf of the fine rhyme. And even if it is like the way in the book to implement function Btncollect_click, is it difficult to write a variable? First, the "Start Acquisition", "Stop Acquisition" is given two different string variables, and then called here can not? A man with no experience may feel superfluous. But imagine that when you need to have this button show "Start Acquisition" and "Stop acquisition" in another function, is it a lot easier to give a variable a way? And when the "Start acquisition" text is to be modified to "start" or other characters, you do not have to change the text in several places, only the value of the string variable should be modified. Some may say that this is a small project, so do superfluous. But good habits should start with the beginning of contact programming. If the programming habit of the book is used in the project, the light is getting yelled at and the heavy is dismissed.
If you are using WPF to implement function page_loaded, like in the book, the way is to be sprayed-the book is the standard WinForm practice. The practice of WPF is to define a collection or class of serial ports, baud rates, and then bind to the drop-down box list control Cmbport, Cmbbaudrate, respectively.
If there is a problem with the background code when you write the background code with WPF, the following is the question that the author uses WPF to decorate the interface:
1, the common style of the control is written in the control and not written in the common style, if the Intern dare to write a stick to kill.
2, the height of the WPF control, the width is generally not height, but with MinHeight, maxheight to define the minimum height, the maximum height, so that the control to achieve a different window size of the adaptive-this is the WPF writing interface advantages, and the author abandoned, With WinForm thinking to achieve, interface code is flooded with a lot of margin is also the embodiment of WinForm thinking.
Perhaps the author explains: the introduction of a large number of WPF features increases the cost of learning. Then you can divide it into WinForm projects and WPF projects. The WinForm project is part of the standard in the book, and the WPF project is read as an extension, allowing people who are interested in real WPF technology to learn. Instead of saying "This book uses WPF" and abruptly has been writing the project in WinForm Way, this could lead to a misunderstanding of WPF that could mislead readers.
Finally, I wish the "C # Internet of Things Programming fundamentals " The next version of a qualitative leap!
About the technical flaws in the book "C # IoT Programming Fundamentals", if you are going to read a book, please come in and see!