How to referesh one view UI from other view UI - mvvm

I have two Views called UserView and RoleView.
UserView.xaml contains RadGridView which contain three columns
UserID (Label) | UserName (Label)| Role (Dropdown).
RoleView.xaml contains one TextBox where i can add Roles into database.
Role (Textbox).
Step 1. Now first i open the UserView.xaml and it will display
records from database with appropriate roles.
Step 2. Now i open new page RoleView.xaml (minimize UserView.xaml).
Step 3. I have added one role. (AdminRole)
Step 4. Now i open UserView.xaml (it is already in memory, so just i
navigate to this page)
Step 5. Now i double click to any of the row with Role (Dropdown
column) it will comes into edit mode and populate list of roles.
**but it will not display recently added role (AdminRole) in dropdown. because of the data source will not getting referesh.**
If i am closing the UserView.xaml and reopen this page then it will display recently added role (AdminRole) in dropdown.
Note: my requirement is like, i have to update or notify all opened views once any of the change from anywhere.
I am using
Silverlight 4 (MVVM)
PRISM
telerik RadGridView
Your help/comment/suggestion would be highly appreciated!
Thanks,
Imdadhusen

Prism comes with an Event Aggreator. Where you have publishers and subscribers to these events, which we'll call "messages". Have a look at the MDSN link below:
http://msdn.microsoft.com/en-us/library/ff921122(v=pandp.20).aspx
What this means is you can have each view subscribe to an update message and have them update whenever they receive this message. So you could send an "update" message each time a view changes.

Related

Maui Shell Uri Navigation, Multiplate pages on stack and backwards navigation

I am developing a warehouse management application using Maui.
At the moment, I am using the GoToAsync method to navigate between pages, however, I have encountered a problem.
The structure of my pages:
Main menu with several buttons, select the first one:
Location ->
search location ->(after scanning the code)
3.List of products on the location ->(after selecting the product)
4.List with operations to perform (each one displays a different page) -> select the first one
5.Move the product to another location
etc.
Depending on the button selected in point 4, a different number of pages can be put on the stack, for example, after selecting the operation in point 5, 3 or 4 or 5 more pages can be put on the stack.
This is how I register my pages:
Routing.RegisterRoute(nameof(MenuPage), typeof(MenuPage)); Routing.RegisterRoute(nameof(ProductSearchPage), typeof(ProductSearchPage)); Routing.RegisterRoute(nameof(ProductListPage), typeof(ProductListPage)); Routing.RegisterRoute(nameof(ProductDetailsPage), typeof(ProductDetailsPage));
So as you can see I don't create a hierarchy of Uri addresses e.g. Page1/Page2/Page3 because, pages like the code finder, or the product list can be accessed from different places in the program.
What I'm trying to do is go back to one of the pages set aside on the stack. In the example given above, I would like each operation selected in item 4 to, in effect, backtrack me to the list of products from level 3. I am unable to determine this using GoToAsync("../../../...") because I do not know how many pages have been set aside.
I would also like to mention that a page like a search engine or a list sends a message about the selected code or item has a list, and this is handled on one of the pages on the stack ( that is why I do not know how many pages I have to backtrack)
I tried GoToAsync(Page3) however it takes me to a new instance of that page, and additionally puts another page back on the stack.
Any ideas how I could approach such an issue?
Is Shell Uri navigation the right mechanism for this type of project?

Including list view of relationship entity on update page

I am trying to extend an update view to include a list view of some related items below the edit form.
I have two models, Publishers and Volumes, which have a many to many relationship. What I am trying to do is this.... when a user clicks on the edit button for a publisher, I want them to go to a page with the standard edit fields, but also have a list view below the form that lists all of the volumes that are connected to that publisher via their relationship.
Is there an easy way to do this?
I hope this makes sense.
As #tabacitu mentioned, Backpack doesn't currently have an built in solution for this. That said, this could maybe work for you:
This would allow you to use all functionality of the nested list view including interacting with the entities without conflicting at all with the parent
Step 1, Build your normal CRUDs
Build out two normal CRUDs, one for Publishers, and one for Volumes
Step 2, Make a frameless layout
copy vendor/backpack/base/layout.blade.php
name it frameless-layout.blade.php
remove #include('backpack::inc.main_header') and #include('backpack::inc.sidebar')
Step 3, Make a custom list view
copy vendor/backpack/crud/list.blade.php
name it sub-list.blade.php
change the top line to #extends('backpack::frameless-layout')
Step 4, Make a custom field
Create a custom form field that contains an iFrame
Inside your custom field template, have it set the url of the iFrame to the "list" url of the related resource
You'd also need to utilize List Filters and a method for setting them dynamically so that the sub-list shows only the records related to the parent
Step 5, Configure and use the field
In your crud controllers, use the addField to add the the configuration for the new field and its related model
Indeed, there's no standard functionality to do that in Backpack. It's a pretty unusual way to do things. But it's not too difficult to achieve it.
If there aren't too many Vendors for one Publisher (as I expect it's the case here), I would keep it simple and NOT try to include the entire Backpack list view (with ajax, buttons, filters, etc) on top of the form. I would add a standard HTML table with the entries (and optionally buttons to Edit Vendor with target=_blank).
Here's how I would go about it:
In the Publisher CRUD, I would use a custom view for the Edit operation; you can do that using $this->crud->setEditView('edit_publisher_with_vendors') in your setup() method;
In that custom edit view (edit_publisher_with_vendors.blade.php in my example), I would copy-paste everything inside the edit.blade.php view that Backpack/CRUD is using, and add a table with the Vendors on top of the Edit form; notice you have the current entry as $entry in this view; since there's a relationship on the model, you would be able to check if it has vendors using $entry->vendors()->count(), and get the vendors using $entry->vendors.
Hope it helps.

Working with a form in Add mode

please bear with me while I try to explain my problem. I am opening a form in Add mode; the form is bound to a single table but contains a subform linked to another table - the 2 tables have a 1 to many relationship. I enter some data which triggers the autoref to populate on the main form, and create a linked record on the subform. I then click a button on the main form to open another form. Using vba on the OnClick event of this button, I save the record on the current form and create a new record in a different table. This table is the data source for the 2nd form, and I open the form filtered to the newly created record. I enter some data in this secondary form and then click a button which takes a calculated value and populates a field on the main form and then closes the second form. The problem is that when it returns to the main form it seems to have lost the original record, as if it's back in Add mode. However, if I enter data on the main form and then simply close it, I can re-open it (in Edit mode) and open the 2nd form and back again without any problem. Sorry for the long-winded explanation but hope someone can help.
I've been programming Access for almost 20 years, and I've never found a use for Add mode. In other words, it has always been more trouble than it is worth.
Since you are coding already, I would just use DoCmd.GoToRecord , , acNewRec where needed to take you to a new record. Just make sure AllowAdditions is set to Yes in form properties.
Since this question is very general, it is hard to get any more specific than this. But if you do run into a specific problem that you can demonstrate in your code, update your question and I'll take a look.

Wicket DefaultDataTable - Refresh it on browser back button

In my application I am using DefaultDataTable with SortableDataProvider which has LoadableDetachableModel as the model.
I used it to display a set of records ( say RecordList page). When I add or remove some records and load the page RecordList again, it displays the changes. However, if I use the back button of the browser and go the RecordList page which was rentered earlier ( before adding/ removing the records ). The DefaultDataTable still has the old sets of records. This is a big issue when records are deleted.
For example, If I delete a record and press back button then the page fails as the record it is trying to show does not exist in the database. Adding does not create an issue because it simply does not get listed in the set of records.
In another page, I just have PageableListView with LoadableDetachableModel. It works fine with out an issue.
There are one or two things that you can do about this.
First please check whether the data provider has the latest data.
Secondly make sure that the set of records with the Data provider is refreshed when the browser back button is hit. Ensure that the data fed to the Data Provider is refreshed in a method other than constructor. Because constructors will not be called when you hit back. So you would need to use a separate method. Ideally you could use the same method, but called from both constructor and when back button is pressed.

How to view updated data on one property page updated by another property page without closing the properties in eclipse plugin?

I am facing a strange issue!!
I have a set of property page with same storage file.
The scenario is as follow..
For the first time opening the properties by right clicking on the project, list of property pages are viewed. I click on the first property page and make changes then apply the changes to the file.
Now I select the second page, it shows the changes that were applied from the first page.
But now without closing the properties i go back to first page and make changes then apply the changes.
Then again I go to second page it wont show the updated data. The changes that were applied are not viewed until I close the properties and reopen then by right clicking on the project.
My question is
"Is there any way to reflect changes on the pages without closing the properties??"
I appreciate your valuable time you will give for reading and replying..
Plz help
Your problem seems to just absent of reliable model which can notify problem.
If the properties are related IProject.
You should use ScopedPreferenceStore as model.
IScopeContenxt scope = new ProjectScope(myProject);
IPreferenceStore store =
new ScopedPreferenceStore(scope, "myProperties(qualifier)");
IPreferenceStore can manipulate primitive data, default value. And it support property change event. You can create multiple instances of IPreferenceStore, If they have same scope and qualifier then automatically synchronized. So individual page can retrive input model without coupling.