Developing a server based WPF App - c#

This isn't exactly a code question as much as it is an advice question. I currently working on a program for a small business. This program does a multitude of things from updating their local access database, edits and updates Word and Excel docs, etc. Now I have the WPF/C# based program running on a Windows 8 computer but they would like to be able to run it from multiple computers. My first instinct was to make the project again as a WPF Browser application. My questions is how would one set something like that up? Would I have to dedicate a computer with special software to handle just this program, the database, and their documents? Any Suggestions or tips would be greatly appreciated.

It doesn't have to be a WPF Browser App to run on multiple PCs. I suggest using Click Once deployment, where all users automatically get the latest version from a shared folder on an office server or just one of the other PCs in the office.
If they want all of these instances of your application to connect to a common data source or sources, then you will need one computer that hosts the server application and its database (you'll now have 2 projects: the server application, which might run as a Windows Service and have no UI, and the client application, which is the WPF app).
This computer be an existing Windows server in the office or it can even be just one of the PCs in the office, but that PC must be kept on for others to use the app and if anyone reboots it in the middle of the day others could lose some of the data they were updating.
Fundamentally, you need to alter the WPF application so that it fetches and sends its data from/to the "server," most likely using WCF services.
It is a lot to digest, but in incremental steps you can get there. The biggest hurdle will be getting your first successful WCF communication between server and client. Once you cross that threshold you'll be well on your way!

Related

Using local webpages as an interface in C#

I have a couple of questions regarding a project I recently started working on. This project requires me to discover devices on the network (broadcasting UDP packets on a specific port), store device information into a database, and then display all the data on a local web page. My questions are:
Can I have a C# program that runs in the background that deals with the device discovery and database management while also running a local webpage for users to interact with?
If so, which kind of Visual Studio project would be the best to
implement this project?
If not, how else could I do this?
We had a problem where we needed a long running process that was initiated by a user but which timed out. We resolved this by running a background Windows service which interacted with the database backing the website. We also have other tasks that we wish to run asynchronously following user action. We run three Windows services on the web server; this solution has been running successfully for a number of years. So, in answer to our specific points:
Yes, as a Windows service separate from your website project
There is a specific project type for this; you will also need to set up an installation project
There may be other ways but I would recommend this approach

How to use a Database from a Windows tablet UWP app?

I will soon be deciding on a project for my university course and I had one in mind which is going to be a windows tablet application, using the UWP tools in Visual Studio, as I want to develop skills in C# and the Mobile area.
However I will need to have a database behind my application to submit and retrieve data from. Is this a relatively "simple" and common task to do? I'm not looking for easy, I just want something that I can accomplish though without worrying too much over the basics.
My original thought was to have a database on my PC and then host it for my tablet to connect too, but that would require constant internet connection and for my PC to be hosting. After having done a little bit of research I came across something called SQLite, which people seem to think is a good local database to put into the device.
Having no experience with mobile applications though, I was curious as to how I would develop an application on my PC, and then put it onto the Windows Tablet, both using the same database? Would I need to duplicate the database between systems? Or would I write the code up on my PC and then test it on my Tablet?
Again this is an area i'm still new to, database 'hosting' and mobile applications. Maybe i'm just over thinking things, but just by asking the question I can already tell I sound clueless. My experience has been with small WPF applications, Console Applications and Websites.
I will need to have a database behind my application to submit and retrieve data from. Is this a relatively "simple" and common task to do?
I think the answer is yes. As you mentioned, SQLite is a good local database for you to use. Since there are guidance, samples, teach videos for SQlite with UWP, it should be simple and common task for you to do.
I was curious as to how I would develop an application on my PC, and then put it onto the Windows Tablet,
For this you need to Get started with Windows apps. After you finished developing the app on the PC, you can publish to windows store or Sideload your app package, then you can install the app on your tablet from store or through side loaded package.
Would I need to duplicate the database between systems?
The SQlite database is actually a database file with .db or other suffix saved on the local device. Whether need duplicate depend on where you put the database file on. Since UWP app is sandbox and have limitations for access the folder on the device. By default, all apps can access the following two locations, Application install directory and Application data locations. If you put the database file on Application install directory, once you install the app on one device, the database will exist on the install directory and you don't need copy. But this directory is read only means that if your database don't need update and read only you can use. For another location,Application data location there are LocalFolder,RoamingFolder and TemporaryFolder. If you put the database on LocalFolder it cannot be roamed and you need to manually copy or user a cloud server helper you save it for roaming.If you put the database on RoamingFolder it can roam pay attention it has some restrictions. More details please reference File access permissions. In my option, SQLite is a local database, which is using only for local data will be better, I don't recommend you to use it for roaming. If you need a roaming data base, a database on cloud or server side will be much better.
Having no experience with mobile applications though, I was curious as to how I would develop an application on my PC, and then put it onto the Windows Tablet, both using the same database?
You should get start from this document Intro to the Universal Windows Platform. I believe you'r familiar with C# language, you can use C# to develop UWP apps.
As you mentioned, you could use sqlite as local database in your app. You could use LiveSDk's APIs to synchronous database when you switch from PC to tablet.
Here's a sqlite sample in uwp for your reference.
The OneDrive Photo Browser sample shows you how to get data from cloud, it would be helpful to you.

Creating A Student Information System

I am planning in creating a student information system where multiple computers can access the same server through LAN connection. The server will have a database about the students information. I pretty much have a background in creating a program similar to this but i was only able to make it for 1 computer. I don't know how to connect that database to another computer. Like for instance:
Teacher A uses Computer 1 to access the Student Information System and
Teacher B uses Computer 2 to access it as well. Any modification done
by Teacher A will be updated to the database and it will be seen as
well for Teacher B.
And my other concern is whether I should make it web-based or not. I only have an experience with using WPF Application for this kind of system but someone told me that its easier if i used a web-based instead in this kind of networking idea. Can you tell me the advantages and disadvantages of using a web-based and its counterpart.
to summarize:
How can I connect multiple computers to access a single database system.
Which is better to use if its web-based application or desktop application.
Much appreciated.
Couple of points
Set up a machine for making it a server where your database will be residing. All the machines will be pointing to this server and database using LAN.
You can create both web based and desktop based application. I would prefer to go for web based application so that in future you can extend to access this system outside the college premises.
Both Web based and desktop based application can work for you in this case. For the database you can use SQlServer2008 and share this database over the LAN so that it can be accessed from all the computers in the network.
You must create one server machine for the database which will be accessed by other client machines on your LAN.
It is quite easy you just need to give the ipaddress of sql machine in connection string instead of "." And every thing else will be same .
You will have more than one solution to make the database be used in different locations.
1- Regarding the desktop application we can setup the application on a terminal server (considering the server configurations and how many users will access the server) and the user will access the sever through the terminal service (the application will access only one database for all users in different locations.
2- The desktop application can be run in a several locations accessing a database at the same location, By using the (Database Replication) we will have an updated data in all location.
3- The application that the users access over the internet is called a (web application), it is a software that is accessed through a web browser running on client’s machine called a web application, the application will access only one database for all users.
4- Adding a (web service) to the desktop application will allows different machines to interact with each other through a network.
The question is which is the best solution?
Option (1) is the easiest one because we don't need changing anything in the application but if the internet connection is disabled no one can access the application and if a bad internet connection then we will facing many complaints from the users.
Option(2) is good because we don't need changing anything in the application as well the database server will replicate the information with each other and update the information for all locations.
I prefer option(4) when designing a new application.
I prefer option(2) when the application is old and there is no ability to modify or it will take a lot of time to modify.

Making sure my application is Terminal Services safe

Our company uses a system of which I am the sole developer. It is a C# based desktop application that is run on some 50 workstations or so and all connect to one central SQL Server database.
Our network administrator is now looking at presenting the application through Terminal Services, something that I know nothing about, yet.
As I started Googling around I saw that, apparently, some applications do not work under Terminal Services. MS Paint is mentioned as an example. So this got me wondering, what does a developer need to know to make sure that his/her application works in Terminal Services?
I don't have the time right now to investigate TS in depth but I'm hoping there might be an article somewhere that is written for developers. As in "Things not to do when you develop an application that will be run in Terminal Services".
Terminal Service RemoteApp works pretty well if you application is designed to be multi-user compatible. so you will need to ensure user session related data is not shared, but placed in isolated storage with IsolatedStorageContainment set to DomainIsolationByUser for example.
here are some useful links:
http://www.fmsinc.com/microsoftaccess/terminal-services/remoteapp.htm
https://www.youtube.com/watch?v=Nf20-76dMcg
https://msdn.microsoft.com/en-us/library/3ak841sy%28v=vs.110%29.aspx

best solution for architecture of a enterprise web App, that use hardware & local resources & heavy data entry forms

we have an APP, that uses many local resources, such as windows printing API, windows registry, some Active X to connect to POS devices(to pay money & get receipt, the price is sent from APP), Barcode printer to print labels, RFID devices to read & write some data. The application is written with .Net framework 3.5, and uses some new features of .Net framework (e.g.: WCF). The forms in app are very heavy forms(7 of them are essential), in each form, there are over 100 Textboxes, combos, radio buttons, panels & many other controls, that according to need of user are shown or hidden, disabled or enabled, filled & cleared, many many times.
After the user does the work, prints most be sent to previously selected printer automatically, labels most be printed by barcode printer, RFID & POS devices are called if neede.
The problem is that now we need a web base version of this. the reason is that there are an administration department who needs to be aware of any transactions online (there is a dashboard software). In the WIN APP version, we use WCF to send & receive new data (something like replication happens).
According to my searches, there are 3(even 4), way to accomplish this goal, as below.
Using WPF technology
Using Clickonce
Using Pure html + Active X(meaning asp.net, very heavy javascript & Write Active X)
Hosting windows forms controls in IE
WPF’s XBAP is good, but:
It needs to download all dll’s to local machine & then start the application. This also happens every time a new version is uploaded to server. The sizes of dll’s are about 5meg.
Also there is a risk that a user can disassemble the dll’s. Also we need to sign the assemblies in order to be able to use win API’s, and the user need to add the site to its secure site.
The main disadvantage is that WPF is not actually in Web architecture, I mean, dll’s do calculations on client side & the server is only responsible for saving entities (& does some validations).
refer to https://stackoverflow.com/tags/web-applications/info
Clickonce:
No idea at all, we can deploy App(the WPF version or windows forms version) as a clickonce app, but the server is only responsible for updating new versions of software.
Pure web & HTML + Active X:
This is the time consuming work, everything seems to be ok, but actually we need to be JQuery & AJAX masters & I think most of time is spent on debugging javascript. Also only IE can run the App # all, because of Active X controls in page.
Winform in IE:
Not a good choice at all, but we can do this, the output is works only in IE, also the rendered UI, is in very bad style.
There is also another way, may be a hack, when we develop with pure web, we can write some WCF services to do the hardware part(commiunicating with hardware, local resources & other things) & install them on clients(run for example with cassini). So when we need for example to work with hardware & local resources(POS, RFID, Registry & others), we can call them from our site with the web service call(that points to local host).
Which of these are good choice & what?
Is there any other solution?
any idea can help.
many thanks.
Cleanest solution may be to go WPF for the presentation tier (silverlight will require an additional step to access the local machine) and click-once (just because you are considering click-once doesnt mean your server is now just a distribution mechanism, also correct me if im wrong but you can also include the .Net runtime as part of the click-once distribution package)
Also just because its WPF doesnt mean all your business logic needs to be downloaded with the client, id collect your business logic server side, at least the sensitive stuff and call it via wcf -with security of your choice-.
EDIT
Some useful links
Learning WPF with BabySmash -Manually Managing ClickOnce and some more Designer Goodness
Deploying a WPF Application (WPF)
Silverlight, Wpf Web App (xbap) or Click Once? Pros and Cons
I'm not sure I understand all of your requirements correctly. It looks to me that all you need is a service component that tracks the transactions. Rather than rewriting everything as WPF/SL, why not modify your current application (you didn't mention the technology used nor if you can modify it) to log any transaction to a service endpoint.
The service endpoint records the transactions in a database (e.g., WCF over https, storing data in SQL Server). From there you can either expose the information as part of the dashboard software you mentioned, or you can create your own reporting application using something like ASP.NET MVC.

Categories

Resources