I'd like to apply the MVC pattern to a GUI we are developing for an embedded system. In this case my understanding is we would need to provide the underlying framework for listener/event actions between the Controller and View. Also, I have seen some examples where the Model send an event to the View, but perhaps that is not correct. Does that seem correct?
Does anyone know of a framework targeted to embedded devices that may have this capability?
If your embedded device supports Java, eRCP would be the best GUI framework in that case.
Check out: http://www.eclipse.org/ercp/
Model sends event to view is a way to notify the view updated about things has been changed in model. It's normal communication between M & V in MVC. However, the "view" here should be a generic view which is bound via an "observable" interface, not a concrete one.
For example:
Abstract View: Clock (generic interface)
Concrete View: Digital Clock, Analog Clock <--implementation of Clock
Model: Time <-- "knows" Clock but not Digital or Analog...
I could suggest the Qt Toolkit. But you don't give any mention of your platform capabilities.
If you are working on a linux platform. Try Enlightenment the best GUI I have ever seen.....
Related
I have read the two other questions on SO regarding this and I wanted to know if there is a good solution for that now / best practice.
Long story short, we use an SDK which is written natively and we've wrapped it so that it works on Xamarin.Android and Xamarin.iOS. It has asynchronous callback methods. I need to call a method in the shared code when a callback is received in the Android project for instance.
There's a lot of info for doing the opposite - using DependencyService. How about in my scenario? Does anyone have experience with an app like this and what's the best approach to keep code clean and do this using MVVM?
The options I know are:
Using a static App instance - this is what we currently do.
MessagingCenter
Anything else?
Actually I've never seen anyone recommend usage of MessagingCenter for anything else than communication between ViewModels so I am not sure it is recommended here. Also, I need to know the sender object type so I need a reference to the class in the platform specific project.
I would recommend you to use messagingCenter to pass data or call method between shared project and platform project. You can just send a new object instead of the class in the platform specific project.
Also, have a look at using eventhandler as I mentioned in this answer may help someone who want to call from the shared project into the platform specific one.
BTW, I mean you can even pass an object as TSender if it is not necessary to use:
MessagingCenter.Send<Object>(new object(), "Hi");
MessagingCenter.Subscribe<Object>(new object(), "Hi", (sender) =>
{
// Do something whenever the "Hi" message is received
});
I am developing an Android app that connects to a device and send command to get its information such as version number.
I am building it using the Bluetooth LE sample code which has DeviceScanActivity, DeviceControlActivity and BluetoothLeService.
I am trying to understand the structure so I can make the code separate from GUI and low level operations.
Is DeviceControlActivity equivalent to View + Control in MVC model? Is BluetoothLeService equivalent to Model?
I want to have a class separate from GUI that has functions to operate the device. eg. contains a function called getVersion(). Does this class belong to Model as well? How should I implement this class along with BluetoothLeService?
Basically I want to have a hierarchy as UI->a Class of functions->Bluetooth rx & tx.
I created an instance of the class of functions and I derived command data from it.
Then I sent this command to BluetoothLeService.
I use the web (ie free) edition of Alteras FPGA IDE. According to the documentation, it hosts at least some of the Altera megafunctions. A response to an earlier tech forum enquiry indicates that it does.
I’ve tried to use them, but without success. When I ‘create’ an instance using the Altera Megafunction guide, all that comes out is something like a ‘pure virtual function’ for a COM object, ie. a function prototype / data structure. I can’t seem to be able to actually instantiate a working function, and can’t find any actual working Verilog code. It would be great if someone could point me to some information that might help.
Specifically, if using megafunctions, is code created in an accessible form such as Verilog, or is the functionality in the form of a netlist or some other non-user-accessible format?
Megafunction is softcore and hardcore IP, and It is not accessible as verilog code, at some level u can see. but can't able to decode full IP core RTL.
Yes!, it is some other non-user-accessible format. click here for megafunction import procedure.
This document might help you : Altera Doc it is about RAM megafunctions but there is some informations about how to instantiate a megafunction (ie page 24/64)
We always use event driver programming to create desktop applications with user interfaces. In such frameworks we only associate functions to events. But we can never see how does it work in the background. How does the real application generated by the framework look like. What does the main function contain. I imagine something like the following :
int main()
{
while(true)
{
wait_for_an_event();
handle_the_recived_event();
}
}
If you have any clarifications, details about this, I would be so greatuful
Based on your comment about using .NET
Events on .Net are a way to signal notifications to clients of a class. They are also built in and are fairly easy to implement.
You can read about them here: Events Tutorial
I want to dynamically change the layout, based on whether the user is accessing the site from a mobile device or not. I have a few questions on the subject.
I would like to change the layout once it's determined, but before the view is rendered. That is, is there some hook I can use where I can change layout.cshtml to layout.mobile.cshtml "recursively" for any nested layouts that there might be.
Is overriding RazorViewEngine's CreateView method enough? It takes a masterPath parameter, so maybe I could implement a custom RazorViewEngine and override this method, right?
The second question would be regarding mobile browser detection. I don't really care that much about specific devices. I just want to differentiate desktop from mobile. Is something like WURFL a necessity in this case?
Is checking something like Request.Browser.ScreenPixelsWidth and ScreenPixelsHeigth ridiculous? (since most I'd be changing would be using or not jQuery.mobile and it's data-attributes.
This functionality is built-into ASP.NET MVC 4 so you get it out-of-the-box.
Scott Hansleman blogged about how you could achieve the same in ASP.NET MVC 3 and be ready for the upgrade because the NuGet he suggested is spec-compatible with ASP.NET MVC 4.
If you can, use ASP MVC 4 as Darin Dimitrov pointed out. It supports this out of the box.
If you are stuck on MVC 3, here's how we do it in our product:
1) Install WURFL
2) Implement an HttpCapabilitiesProvider which calls WURFL and resolves device capabilities; stuff resolved caps into the result. Be sure to add a property called isMobileBrowser (wurfl exposes this)
3) Tell .NET to use your capabilities provider instead of default HttpCapabilitiesBase.BrowserCapabilitiesProvider = new YourBrowserCapabilitiesProvider(_wurflManager);
4) Create a CustomViewEngine (inherit RazorViewEngine). Override FindPartialView & FindView. These should look at controllerContext.RequestContext.HttpContext.Request.Browser.Capabilities["isMobileBrowser"] and map to appropriate name, eg myView.cshtml.mobile. You need to resolve both viewName and masterName.
4.1) Still in CustomViewEngine's FindPartialView & FindView, search search ~/Views/{0}/{1} and ~/Views/Shared/{0}/{1} where {0} is the controller (controllerContext.RouteData.GetRequiredString("controller")) and {1} is your mapped view name
4.2) Return return new ViewEngineResult(CreateView(controllerContext, viewPath, masterPath), this);