In a watch app how do you change page programmatically?
I've got 3 WKInterfaceControllers in a page based app and I want to change from one page to another when a user presses a table view cell.
I can present a view controller modally fine but when I try to push the view controller or hook the segue up to the cell controller, nothing happens.
You won't be able to push an interface controller since you're building a page-based app. The only option that you have is to use the WKInterfaceController becomeCurrentPage method on the interface controller you want to switch to. It needs to be one of the three interface controllers already loaded into the page set.
Since you don't actually have a reference to the interface controller that you need to switch to from the table interface controller, you'll need to use a system such as NSNotificationCenter to send a notification to the interface controller that you need to becomeCurrentPage.
This should allow you to switch from one interface controller to another when tapping on a table row.
Related
I am trying to implement UISplitViewController on iPhone similar to the Discover App. The Primary View controller has to semi-overlay on top of the detail View Controller. I have tried the existing frameworks but in all of them the master/primary view controller pushes the detail view controller when the menuItem/Hamburger button on detailView is pressed. Any ideas or resources related to my specific requirement ?
I am trying to implement something similar to the picture
When you click on a certain item in the master , the corresponding view is pushed to the detailView and the master closes
I am trying to send data from one ViewModel to another using Messaging Centre.
I have subscribed the event in 2nd ViewModel's constructor. But the event is not subscribed as the constructor is not compiled until I open the page/view corresponding to the ViewModel.
I am using MVVM Light, until now I had an understanding that the VM's constructor are compiled when ViewModelLocator is called at the app startup.
Can someone help me understand this better and how can I subscribe the event i.e. compile the constructor without the VM being called.
Perhaps you are thinking about this in the wrong way. Without seeing code it's difficult to see what you are trying to achieve exactly, but what you could do is subscribe to the event elsewhere in your app, for example in your App.xaml.cs. When the event fires, at that point navigate to a new page of type ViewModel2 and pass any details required as a navigation parameter.
I have Homepage presenter i want to view what inside it in homepage. how can i open it in webaddress ? i already try to open it
with this http://localhost/sandbox/www/homepage/action it wont open
What the different between method action and render.. forexample i have this two method…
actionOut() and renderOut() in the Homepage Presenter when i route it it nette cannot make any different between two..
This depends on your routing. The default one allows you to access all presenters by pattern <module>.<presenter>/<action>. So the question is if the Homepage presenter is in any module, what's the routing, ... You can take a look at debugbar, where you can find a routing panel that may help you understand which route was matched. Also, you didn't specify, what is the exact error.
I encourage you take a look at the lifecycle of the Presenter. Basically, the action method is run always, even if you redirect in a signal method. The render method is run only when the presenter is going to render the current action. The action method should take care of getting the primary resource and "storing" it to the presenter's property, not the template! The render method takes the resource and pushes it to the template. If the resource method is not available, you should call $this->error() in your action method.
I have a Web API service that I have managed to use to pull values into a ContentPart by using the method outlined here: How to change Orchard record repository.
Now, what I want to do is update the values of the properties on my ContentPart and have the update performed via a Web API call. I think I'm close, but just can't get an update method to fire.
In my Handler, I have added a handler for OnUpdate. I can see my OnUpdate method get registered, but it never executes.
So my question is: Is this the correct handler event to use? And if so, how can I get it to trigger?
I should add that I am accessing the ContentPart through a Controller, as opposed to a Driver.
OnUpdating / OnUpdated get fired whenever you call IContentManager.UpdateEditor(item). In the default scenario this happens when you hit "Save" button when editing your content item.
I don't quite get what you mean by "accessing the ContentPart through a Controller"?
Do you have a custom controller that handles the item editor rendering and it's postback?
Or are you creating and updating some items in code, without using the built-in editors at all?
In the former case, you need to ensure that
IContentEditor.UpdateEditor(item) gets called for the whole content
item inside the POST action (same way it does in the default
controller - Core\Contents\Controllers\AdminController.cs).
In the latter, which I guess might be the case here, OnUpdating /
OnUpdated won't be fired and you need to call the web service on
your own from the controller action, as Bertrand pointed out in the comments.
There is also a third option available and I found it particularly useful in similar cases:
Use LazyField<T> as a backing field for those part properties you need to push to web service after update.
Put the code that calls web service inside that lazy field's setter (set this up during handler OnActivated event).
Now, whenever your property gets updated, a call to web service will be made, ie. the lazy field will act a a transparent proxy between your web service and current code.
For examples how to work with lazy fields take a look into CommonPartHandler class and methods LazyLoadHandlers and PropertySetHandlers.
I am trying to figure out where the appropriate place is to intercept the resolution of what view + controller is being called in ASP.Net MVC 2. I have a situation where I have a controller and a corresponding set of views. I also have the possibility of a customized version of both the controller and N of the views sitting in the project (or we may use something like Portable Views from the MvcContrib project). If the customized version of the controller or view(s) exists at run time, and the user satisfies certain criteria, I need to call the customized controller and use the appropriate customized view. At design/compile time we don't know what customizations may be in place.
My first run at this was by using a custom controller factory that returns a custom controller if it exists. However, this controller is "wired up" to the standard view, and I cannot figure out how to return the customized view if it also exists.
To complicate matters, there may be no customized controller but customized views, and visa-versa.
Sounds like you're on the right track. You've got custom controller selection logic in place, but you need to also have custom View selection logic.
You can override and extend the default ViewEngine to plug into your app that uses your own logic to look for the view locations. Here's a good walkthrough of a simple ViewEngine that does exactly that.