When to start loading data in VM [closed] - wpf

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
Let's say I have a page with two buttons and a content control. I also have a View-Model defined for this page. When I press each button a specific view-model is bound to a content control, so buttons are used to switch between views. The problem is, when view is switched some data needs to be downloaded (doesn't matter from where, it could be a database) via a view-model - and I don't really have an idea where to put code responsible for that (i.e., code that starts downloading data). Is constructor a good place for it?

Usually the ViewModels have a specific method (mostly called Init), that performs data initialization. Constructor should not be used for these purposes, because it should just construct the object, nothing else. Moreover - you will probably want to perform data loading asynchronously, so constructor is again not very well suited for this.
The Init method should be called just when the navigation is performed, so you can pass your navigation parameters to it.

Related

ADF Internal methods clarity [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
Which internal method is being called when we set the property "AutoSubmit" to "true"?
I tried my best to find, but was not able to get the exact solution which I want.
Can somebody tell me the answer with ADF and JSF life cycle flow of execution?
I presume you are using ADF Business components. If you do (better not use ADF if you don’t):
When setting autosubmit on an input field, the value is propagated to the server the minute user tabs out of the field.
1. The setter of the attribute on your View Object Row Impl is called .
2. The setter of the attribute on your Entity Impl is called.
Any processing or business logic you do on View Object or View Row Impl level. Biggest misunderstanding of ADF: trying to do these kind of processing in backing beans. Every Java developer I’ve seen working with ADF does that.

Maintain selected tab after page reload in React/Redux [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
I have a page with a tab component, with 5 tabs in it.
What would be the best way to maintain the state of which tab was selected after a page reload/refresh in React/Redux?
I can think of two ways to persist this:
Query parameters
Local storage
Are these okay to use or is there a better/more React way to do this?
Let me first say that it's a highly opinionated question and depends on your design and needs.
I would use query parameters if the current tab is an important information on reload, since it could also be a link shared, opened in another browser...
I usually use local storage to store internal state about the application (such as login, show a popup on an element the first time its seen to explain what it does, etc...), not if a tab has been selected or not, since it's quite a versatile information. The user might for example get to the page from another page, later, and still get the second tab open instead of the default one.

How do I create a multiform GTK App [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Hi I have been playing around with C and Gtk trying to learn a thing or two
Now wondering how do I create an application that has more then one form.
Do I just clear the window out or do I create new windows every time I want to have another form or view.
and does anyone know a good place to learn this type of thing?
I assume your goal is to use one window but change (large parts of) the window contents at times?
The widget you are looking for is GtkStack, which is a container that will only show one of its children at a time. You can use a Stack with user visible controls (StackSwitcher) or from your own code.
The Stack was only added in 3.10, so in earlier GTK+ versions you'll need to do the work yourself: Add your "forms" as children of a Box and make sure only one child is shown at a time.
does anyone know a good place to learn this type of thing?
To find out what kind of widgets you have at your disposal, I suggest reading the fine manual: https://developer.gnome.org/gtk3/stable/.

Why is there no $interval in AngularJS? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
AngularJS has a $timeout service which acts as a convenience wrapper around setTimeout.
Why is there no equivalent for setInterval?
Since $timeout is calls scope.apply after each call it can get expensive. However creating a simple interval you can decide what watches and apply calls are needed to keep it clean.
For example, if you interval was running once every minute to check if the user's values had changed and optionally saving it if the values had been changed since the last check. Depending on how you write the code, you may never need to update the web page, so your interval can get by without triggering an update.
That doesn't answer the question directly of why $interval isn't provided by default, but I suspect it is because since it is simple to create your own with you specific requirements, it is better to leave it open for you to enhance, instead of providing a default implementation that is too complex, or too inflexible.

Tab structure best practices [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
When developing a WinForms app that will utilize a tab control to display different sets of data, is it best to add all my controls to the tabs directly, OR create user controls, add my controls to the UC and add the UC to each of the different tabs?
I was informed that the UC approach is best practice, and I understand some of the benefits, but I'm wondering if this is truly the way to go... any explanation either way is greatly appreciated!
I have found that personally I do like the UserControl model, it helps get the code separate by each of the functions (tabs), and helps with UI design time.
You can do it either way, but I have had much better long-term success going the route of UserControl.
In addition to the code separation, I think that adding the UC to a tab control ultimately makes it a lot more flexible. For example, if the UI changes over time and tabs are no longer necessary, it can easily be popped out and placed somewhere else. Or if the UC can be reused in a different context, it won't require a tab control to travel with it.

Resources