Using the MVVM pattern with Unity Engine as front end [closed] - c#

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
I plan to make some applications that will let me organize tasks from home or from somewhere else. For this I need a database server (a virtual one running at home), a backend part (the business logic) and the front end (the view). At school we learned the MVVM via WPF, but to be frank I use it only when it is explicitely required.
There are a lot of benefits in favour of Unity like
Artist friendly
Can compile to mobile, web and desktop
Fast development (in my case at least)
Has a lot of built in features I can harness.
Now, even as simple as I will make an app like this, sometimes I might want to extend it, improve it or change some components entirely.
I know how to use MVVM in WPF but I only have some vague ideas for the Unity implementation which I would like someone skilled to overview.
The front end (Unity) would take care of sound management, fancy animations and the UI itself. But UI button events cannot access directly the database, so I thought of building some bridge classes. Say I want to delete a reminder, as an easy example. In an OnButtonClicked() method I would just call a BridgeClass's PleaseDeleteThis(MyReminder) and inside that method there's the backend solution that actually finds that reminder by id and removes from the database, then sends an everything all right flag back to the front end app so I know it was successful.
What I thought of is that using these bridge classes I wouldn't have to worry about what happens if I change the database server or the front end, as all they have to know is communicating with the bridge. I know the example was over simplified, but how doable would this one be regarding the component integrity and the MVVM pattern?

MVVM has been successfully used by AAA software houses to build games. The makers of Shipbreakers (aka Homeworld: Deserts of Kharak) wrote their code such that the View was a MonoBehavor I believe, VM and M were POCO classes written external to and independent to Unity so as to speed development. They can have their own Views for prototyping external to Unity.
They also wrote their own debugging visualisers and property editors for Unity.
https://www.youtube.com/watch?v=q9aeNtKKXeo
MVVM is about at the 19:18 mark though I do recommend to watch the whole thing as there are some other great things in there.

Related

Can we port android application built on Xamarin(without Xamarin.forms) to iOS ? [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 7 years ago.
Improve this question
I am starting a project in Xamarin. As of now it will be Android only but later I am planning to port it to iOS. Should I start with Xamarin.forms (that will require me to buy an Indie license) or should I first finish up android application and later port it to iOS ?
It depends...
The best way - extract logic to the crosplatform PCL project. Then create 2 solutions for ios and android where you will make UI part + our crosplatform logic.
In any way using Xamarin.forms it's good desicion only for small simple projects, in my opinion in most cases native UI code it's the better solution
Xamarin.Forms is no silver bullet and I would not recommend it for all apps. Maybe, I would even not recommend it for most apps. As mentioned in my comment to your opening question, the answer is primarily opinion based.
To me, Xamarin.Forms is a nice tool to create simple proof of concept apps, also a way of creating prototype apps. However, as soon as you need to do something more complicated. Like, very custom UI or something that inherently is difficult to do on all the supported platforms. Then, you will have to battle the framework and write code for all platforms anyways. So using Xamarin.Forms, at least in my opinion, really depends on the application you are making.
Now, I am super biased towards MvvmCross and the likes, but in any case you should strive to cram in as much logic and behavior into a shared base. For this I usually use the MVVM pattern inside of a PCL. So all my ViewModels, classes for fetching data, behavior etc. goes inside of that PCL.
All views go into the platform specific Application project. So in the end the platform specific project will in best cases only contain UI + some platform specific services such as how to access sensors etc.
There are several MVVM framworks for Xamarin apps. Some of them are MvvmCross, MvvmLight, ReactiveUI and MugenMVVM.
Which approach you take is entirely up to you. However, before you commit to something, consider trying out various things to get a feel for it yourself.

Building an Interactive Map using C# [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
I have a small simple project on building a clickable interactive map of our school.
The challenge is to create a clickable parcel of map and add an animation
directing the user from point A to B using the given roads/hallways on the map. Moreover, I would like to create a database that allows the user to view the information for that specific parcel of map when clicked.
I'm using C# to program this one. My application is Visual Studio 2010
Example Links:
https://www.youtube.com/watch?v=tbinL2pg5Hs
http://www.wayfinderkiosk.com/
QUESTIONS:
What are the processes(step-by-step) on creating this project?
What applications should I need for programming, database, animating, drawing etc.?
Decide on the platform you will be using: WinForms, WPF, WinRT, ASP... If your project description includes the platform then you know; if not keep the question in mind!
Get your resources. Get the map and a list of all the places you will work with. Also all the extras like the descriptions and photos etc. Get this chore out of the way now. It'll help you to get a feeling for the amount of things you will put into the project.
Know your clients. An older kiosk system runs only only a few kiosks. Today maybe you need/want to have it run on the web and on portable devices. This will make a difference in not just for screen sizes but also in the number of possible routes..
Define user input controls. Keyboard? Mouse? Touch? Which buttons? You need a complete list!
Define the user interactions. Completely. Try to make tables of states the system can go through.
Try to decide on how the path finding should work. This anything but trivial, as soon as you want to include more than a few points.. You can have a set of ready made paths or try to find them or build them from a list of partial paths. This may well be the toughest part of it. Some folks believe in 'Hardest First' other in 'Hardest Last'. I believe that the first thing is to understand the hard parts well enough to get a feeling for them and to decide then.
Well that is really just a start, off the top of my head.
Good luck and have fun!!

How to turn windows forms app into native ASP.NET? [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
I have written a windows form app in C#, but I want to turn it into native code for ASP.NET so I can build a webapp around it. However, I've never used ASP.NET and I'm not sure how to approach this. I've looked around and seen libraries such as VisualJS.Net, but it looks confusing and I'm not sure if I can seamlessly integrate it into my app without causing problems later on. Could someone lead me towards the right direction?
Thanks!
So if I well understand, you would like to "transform" a Windows Forms app into a ASP.NET. The problem with this approach, is that those two technologies are like day and night. They don't have the same lifecycle at all. Windows applications are by definition stateful. This means that they keep their state in memory and they don't need to rebuild it often (maybe at the loading of a file). Web applications however are completely stateless. The server receives a request, processes it and returns web content (HTML, JSON and whatever is needed). If the server is again contacted with new information, the state must be rebuilt (with the help of cookies, sessions, etc).*
However, what you can do the ease those problems is the following. If you separate your concerns, you can more easily reuse your business logic and your data and just re-code the view of your application. This means that you must separate what belongs to a View technology (WinForms, ASP.NET) from the model itself. There are numerous patterns to support this : MVC, MVP, MVVM. Respecting GRASP patterns also helps.
With that in mind, you could have three solutions : One containing your common code, one containing the logic that belongs to WinForms and another one that contains your ASP.NET logic. It's easier said than done, but this should be the way to go.
You can't turn an apple into an orange. Those two technologies are so different, that you will be better off rewriting the application from scratch, and taking advantage of all the goodies available in ASP.Net MVC 5.
Technically speaking one could devise some type of a converter, but it would potentially promote bad coding practices, something you should avoid.
Start learning MVC 5, you will be better off in the end.

Developing a program that serves as a web program in C# [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
I'm not sure if I'm going to be able to explain it right since I'm quite sure I don't know the correct terminology involved with it, which is also why I'm having a difficult time Googling for answers.
Essentially, I'm looking to develop a program that serves as a web site. It'll run constantly (like a service) and will return HTML when an outside user sends an HTTP request thru a browser or similar to a specific port on the computer this program runs on. Basically, this program will perform various background errands throughout the day but I want to be able to expose a web front end (almost like how you would with standard WinForms, but I want to be able to access it remotely) to be able to configure it, check the status of tasks, and otherwise interact with it.
I'm looking to use .Net, but I'm open to using something more universal like Java too. Someone with experience in this area would be helpful to explain any pain points you've encountered and suggestions on how to get started.
You can do it in C# with the HttpListener class.
I published an example some time back. See A Simple Http Server.
Although you might consider whether you really want to operate at that low level. I have written a fairly complex server based on HttpListener, and if I had it to do over again I'd probably just bite the bullet and use ASP.NET. There is a bit of a learning curve, but unless your server is incredibly small and simple, an ASP.NET application will be a lot easier to write and will likely be more robust.
Here is a simple example on how to do it in C# using the HttpServer class:
http://www.codeproject.com/Articles/137979/Simple-HTTP-Server-in-C
You are doing at least 2 different things, so you should probably create a Solution in Visual Studio.NET with one project for each purpose (You can have many projects in a solution), probably with at least one Data Access project as well (of type Class Library). If the solution does things at certain times of the day, then those can be Console Applications that run through task scheduler, rather than one of more services. Services are better suited to things other than simple scheduled tasks. A Web Application project can serve up your html.

Converting existing program to MVVM pattern [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 6 years ago.
Improve this question
I have pretty much finished my first WPF project after several weeks.
Now I want to refactor and make my application as clear / reusable as possible.
Does it take a lot of work (meaning would certain logic change entirely?) to change an entire application to the MVVM pattern and would it make the application easier to understand? Also are there other things I should look into except for MVVM?
Basically this application will be used by someone other than myself, so my goal is to make this program more simple since it really got over complicated in certain areas.
The general layout of my program consists of:
10 Classes (1 database class using Singleton)
3 HelperClasses
3 UserControlPages
Singleton in about 3 classes
Does it take a lot of work to change an entire application ?
It's hard to say, cause it depends on the concrete project and how it was coded before, but basically it's never a small amount of work.
would it make the application easier to understand?
Would say: no, but it would definitely make it more testable and more scalable.
Also are there other things I should look into except for MVVM?
It, again, depends on the concrete project (what is target client of your project, who will reuse your code, what is the expected scale of your project...)
Bare in mind that using the MVVM pattern requires a framework, otherwise it is a huge amount of work. I would recommend Caliburn.Micro, and you should investigate the other frameworks available too.
Refactoring effort will depend upon existing code. If you have loose coupling in mind right from start, it should not take much effort.
Following are links to questions related to getting started with MVVM.
Learning WPF and MVVM - best approach for learning from scratch
MVVM: Tutorial from start to finish?
https://stackoverflow.com/questions/2267903/learning-mvvm-for-wpf
If you have any specific question, update the question to mention it.

Categories