How to make my C# windows application lightweight? [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 8 years ago.
Improve this question
Guys I have developed a ticket management system in C# windows forms application. Now this is the first time I have developed any application that might be used in real world (my school may implement it).
As my school is not that rich and mostly run by charity, so the technology they use is pretty old (Pentium 4 pcs with windows XP having maximum of 1 gb RAM), so I need to make my application as light-weight as possible i.e. it should not be resource hungry. (I have developed this app on dual core laptop with 4 gb RAM, and I haven't come up with any errors yet regarding to resources but considering the low config of target PC(s) I want to be sure)
I have about 25 forms in my application, in which 7-8 have DataGridViews in them. Others are just filled with labels and textboxes for taking input or display data - nothing fancy.
As this is my first complete application I am not sure how it will perform in the performance department. I read somewhere that in .Net applications you have to call dispose() method whenever the form is closer or else the garbage wont be collected and same goes for DataGridView. Is that true? because throughout the application I haven't used Dispose anywhere. Should I be worried?
If Dispose() is necessary, where and when should I call it? on FormClosed event? If a form has DataGridView should I dispose it first and then dispose form or is directly disposing the form enough? Also if you "experienced programmers" could point out some good practices to make application less resource dependent and less crash-prone then that would be great.

As far as I'm aware C# (and .NET) is managed. So your code and objects will get disposed of.
A good trick, is to look at using Using blocks. These are especially useful around data connections.
The other obvious piece of advise is to actually run it on the machines you will be using it and, and see how it performs.
Hope this helps.

Related

Best local database for WPF Applications [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 6 years ago.
Improve this question
Referring to this question that's already been answer:
"What is the best local-database solution for WPF applications?"
What is currently my best choice of local database for my program? Currently I am using XML that is automatically created on the computer when the user run my executable for the first time or when the XML is missing.
I am perfectly fine on using XMLs, users of my application would not be required to install any software other than my application and I can do exactly with it, but my problem is with searching.
My application includes a database (the XML) of all their songs in their music library, and of course each track has its own information and search through each track is really slow! since it's a music library, one user can have at least 1000 tracks or more and searching through it is really really terrible.
I am familiar on using SQL database, (i don't know the proper term for it) but one for online database, I use XAMPP and read the database on a website on PHP. And i really like it. So..
Basically, I am looking for a good local-database solution, where user's won't to download and install any other software (but I am okay, if i would have to include a certain dll to my exe in other to run), and also one that is lightweight and fast in terms of searching.
Yes, i've read the included related question as many times as i could for me to understand it myself but i hope someone can explain the advantages and disad of each of them.
No, i am not looking for one that needs to have a server or something in order for it to work
Previous suggestion is correct SQLite will be your best option because WPF operates .NET Framework. It also supports ODBC driver as i recall
I was going to just comment but can't quite yet.
I wouldn't say there's necessarily a 'best' in most cases. In general whatever you go with is unlikely to be that bad of a choice..
Having said that, I could suggest SQLite as an option for you. Lightweight, very fast, certainly good for strictly local-database options.

How to override other windows application's elements? [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
Can you please point me into the right direction?
I want to edit other application textbox or click, programmatically. For example, in a web sites, I can edit elements and invoke button clicks.
I have no idea how to do this, but I can move mouse and use keyboard run time is it possible to edit other application's textbox ?
I have C++, VB.NET, and C# knowledge - any suggestions or sample code?
Thanks.
There is no easy way to do this, but it is possible. You will dig through the Win32 Api to get what you need. There will be a lot code needed for this, too much to put in sample here.
You will need to start with finding the window you want. This could be accomplished with FindWindowEx. When you have the window, you can enumerate the child controls using EnumChildWindows.
When you finally get the handle to the control you need, you can hook up to the windows message subsystem and send a WM_SETTEXT message using the SendMessage function. There is a wrapper function available: SetWindowText but the documentation clearly states that it will NOT work for windows of other applications.
Be prepared for a lot of digging around in the Win Api. You will probably run into issues regarding security in newer windows OS's. When you get it to run the functionality will be highly depending on the OS, UAC settings etc.
I remember doing this once, 15 years ago in Windows 98, even then it was problematic! So good luck!

Is building a CPU-intensive C# application for use on Linux (via. Mono) a bad idea? [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 9 years ago.
Improve this question
I guess what I'm asking is running my application under Mono going to be notably bad for performance? Note that the application is not meant to do or require anything other than access to a local relational database (probably MySQL).
Edit: The application is meant to do in-memory work with data queried from the database. The database itself should not be a bottleneck.
Also, the 'work' will be multi-threaded and (must be anticipated to be) as much "parallel" as "serial", if that makes sense...
Edit 2: Profiling hasn't yet been done as the product is only now coming out of a long planning phase to begin development, but the plan was made with anticipation of likely use making this mostly memory-intensive by design (so as to eventually allow the database itself to be made to do as much work as possible, ideally). However, cases of "serial" work (i.e. number crunching) must be expected to occur by design, but my goal is to eliminate these cases as much as possible.
Edit 3: By number crunching, I mean literally any math formula serialized into the database and called into use for representing some kind of abstract data. Most of my (eventual) work will be to minimize this, however.
Your question indicates that you assume that Mono is some kind of .NET emulation, like wine is a Win32 emulation. This is not the case.
Mono is a native implementation of the .NET framework, so there is no reason why it should be fundamentally and/or generally slower than the implementation of the .NET framework on Windows.
It is a bad idea. I ported my application to mono and it doesn't work well:
1. Mono is not stable when it comes to threads (try to load many threads and see how it goes down)
2. Mono does not behave as expected with Forms
3. You are building CPU intensive app and Mono is very slow (as well as .NET) so use cpp, Python or something else.

Best framework for little 3D application [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 5 years ago.
Improve this question
I want to write simple application with some 3D objects for Windows OS.
The application is very simple, like a gallery where we can move and see some pictures. When users go to the some picture and click on it a window will open and show picture with some information.
Which is the best framework for this task WPF, XNA, or something else? Application will be written in C#.
I can not say which is best, but I have done a while ago some things with the WPF 3D API and I liked it.
It was IMO very simple to use and the rendering seemed to be relatively fast. A really nice thing I found, was that it has an object-model that contains high-level-events such as mouse-down and click. Therefore you don't have to do much math. However, maybe provide also other APIs such high-level services, I don't know.
I would not try to create an action-game with it, but for a small app as you have described, I think it is worth a try.
Unity has been used for similar stuff. It can work on browsers (via a plug-in) or as a program, has a lot of documentation and most of the work involved in creating a 3D environment and interface is already done. Code can be written in Mono (open source C# implementation), JavaScript or a Boo, a modified Python scripting language.
It works in Windows, MacOS, iPhone, iPad and Android. And it is free in the standard version, or really cheap.
XNA is a little lower level, so it will require more work to get things started. It supports Windows, WP7 and Xbox 360.
See this discussion : WPF VS XNA

Simple video editing application - should I use WPF or MFC? [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 9 years ago.
Improve this question
I am about to start making a simple little video editing application, and I was trying to decide what system to create the GUI in. I know a lot about the Windows API, and actually, all of my programs thus far have been written in it. I would really like to use the new WPF framework though; however, I am a bit concerned about the fact that C# may not be ideal for a performance-oriented application. And I'm not positive, but I don't think it is possible to use SIMD instructions in C#?? Of course, my video editing program will use DirectX, and then I've read about problems of using that in C#. So then I had the idea that maybe I'd write the "core" of the program in C++ and somehow link it to its GUI through DLLs or something. Of course, that could be really messy... Any ideas? Thanks!
Why not managed C++ and either winforms or c#/WPF ui?
I wouldn't use MFC.
WPF has a future, and skills learned in it are saleable. Not so sure about MFC...
I wouldn't worry about performance of C# versus C++; there have been several benchmarks that show an approx. 10% speed increase using C++. The major issue is object creation/deletion. Reducing this is one of the main issues with C# performance.

Categories

Resources