|
use Environment.NewLine when writing a line to the stream. It will work for you.
string.Format("{0}{1}",'your Variable', Environment.NewLine)
Krishna
|
|
|
|
|
Hi, i'm looking for a way to bind a BindingList<customerviewmodel>
to a grid... (allow adding a new row in the grid).
If i'll use BindingList<customermodel>, i know it will work...
but binding to he ViewModel allows me to add additional presenation logic to the class.
How did you solve this?
Thanks in advance,
Erik.
|
|
|
|
|
Hi,
First I implemented a bindinglistview which inherits from the BindingList and implements all necessary interfaces such as IEditableObject, etc. From there I used this in a custom collection that takes care of the Adding New logic. All of this came from the Data Binding with C#2 book but I cannot remember the author at the moment. Great indepth discussion in a single chapter on how to bind with objects. It also works well with the Interface during design time.
Happy Coding
|
|
|
|
|
Thanks for the helpful reply! =)
I've explored this subject some more, and came across the CSLA.NET framework,
As it seems the framework implementation does exacly that =)
I'm still learning it, but it looks promising...
Did anyone use this framework and implemented the Presentation Model pattern???
It seems rather cumbersome to wrap the CSLA entities with ViewModels, because them the ViewModel will have to implement all the interfaces and forward any calls to he CSLA entities...
(And of course the ViewModel will have additional logic to help support the UI and DataBinding)
BTW,
If i'm not using the Presentation Model Pattern, and I have this rule for example:
The row of a customer in a grid must be green if the customer ordered more than 10 items, at a price higher than 20$.
If i'm using Presentation Model, then my customer's ViewModel will have a property OrderedMoreThanTenItemsAt20DollarsEach (for example), which will implement this logic and the view will use DataBinding to bind the rows color property.
How will i implement this using the Supervising Controller pattern?
(I guess passive view will just iterate through the rows in the grid).
Thanks in advance,
Erik.
|
|
|
|
|
The CSLA Framework from Rocky has been around a long time. Rocky has updated this for many years and a lot of companies use it. My understanding is that it is very good. There are other frameworks as well that might be used such as Smart Client Software Factory, Web Client Software Factory, ASP.NET MVC and the brand new PRISM for WPF and Silverlight. Personally, I have been sticking to the Microsoft Patterns and Factories. Then my model, my presenter, my view and/or controllers can be reused between them.
All of these have things in common. The model, the view and the presenter or the controller. I personally like MVP since it truly encapsulates the actions, rules, transitions and translators into a reusable framework that can be used and easily adjusted as requirements change. If there is one thing for certain in this world - requirements change as the users or management see things evolve. The ability to know where to go to make these changes without Spagetti Coding is crucial to success.
It appears that you have a good handle on the tiers here and their requirements. So here is my take. This is only my take and not a definitive answer. So if it is usable then hey use it, if not applicable to your case, file it away for later. The supervising controller is used to centralize the methods between views. All events that can be shared should be fired up to this controller and the controller in turns then fires commands back to interested views. It is very useful for keeping the views of data synchronized on the same class. So supervising controllers listen to events and fire commands to controllers which in turn fire the view events. Now you have a loosely coupled set of views that can be reused between modules without having any dependencies to any one parent container. The supervising controller handles the work and the actions, the view is merely a container with very few methods and the controller for the view has specific methods and interfaces to make the view do things. The controllers talk to the model and obtain most of the data then rearrange it as necessary using LinQ to Objects or if you are using generic list then use the predicates to handle the where clause etc.
All views in turn should handle the same interface so the controllers fire things in a coordinated fashion. It keeps you from getting confused as to what to do. Over time you will see exactly how to do this and it will become automatic.
Some of the model patterns that I use are the abstract factory pattern for the repository objects, a command pattern for reusable commands, a facade pattern for the method calls to make it easier to move this. Regardless of which framework you use the repository and the model do not change significantly. Now you can loosely couple everything and hook up the data with Enterprise Factory, nHibernate, LinQ to SQL or ADO.NET Entity Framework.
Finally, all UI classes should be wrapped with a BindingListView<t> so that all interfaces to the classes are exposed in a single location in the correct way.
I hope that this helps.
Best regards and keep working on it - this is definitely worth it in the long run.
|
|
|
|
|
my actual task is to read the EULA from the .exe file and copy it to another file. i hope this question relates to this forum. please help me to solve this.
|
|
|
|
|
There is no EULA in calc.exe.. Lots of applications consist of multiple executables, and they load libraries that might have their own license. I'm using a spellchecker in my executable that's licensed under the CodeProject-license, but the main executable isn't.
An assembly might be licensed, but I doubt that the complete text will be embedded as a resource. I'm not going to say that it can't be done, but it would be at least challenging to do such a thing.
I are troll
|
|
|
|
|
thanks for ur reply. i just want read the EULA using my program from the softwares that are asking for the user acceptence while instaling them. hope you get my point.
|
|
|
|
|
Yeah, all too well. I was a fanatic World-of-Warcraft player, and Blizzard has the brilliant idea that every player needs to accept three licenses, for each and every update! Needless to say they update a lot, and you can't click it away - you need to scroll to the end to ensure that "everyone reads it". I'm sure that all those kids read it and carefully review the advantages and disadvantages of each license
There's lots of software on my system, and since I don't speak the law-lingo, I can't make heads or tails out of them. Unfortunately, there isn't a common place to put them.
Even hooking (to catch all installers) wouldn't give you all the licenses.
..but, you can get a list of currently installed software. You might not get the license automagically, but you could start working on a database that holds the licenses for the most common software. It would actually be sweet if there were a website where one could retrieve the license that goes with a software-package, along with a "human readable translation".
That would indeed be awesome
I are troll
|
|
|
|
|
hi thanks for your valuable information and for sugestions too. see you soon with more douts
|
|
|
|
|
HI All,
i have an windows application Add.exe . it is stored at in USB drive as follows
DriveLetter:\MyApplication\Add.exe
now I want to provide an auto launch for Add.exe, so that whenever My USB drive is connected to any PC Add.exe should initiaite.
Regards,
ashok
|
|
|
|
|
You'll need to add an "autorun.inf" file to the root of your USB-drive. As simple example of this file;
[autorun]
open=myexecutable.exe
icon=someicon.ico
For a list of all options look here[^]. If you wants an editor, look here[^].
I are troll
|
|
|
|
|
Hii,
After searching on for auto update feature to suit my needs/project, i started developing my own auto update feature.
This application basically compares the version of my file and any difference in it, it will download the newest version of that file.
Now problem is , i want to fire or start an .exe application/my main application whenever i find that there is no version update . And close auto update application before starting my different application .
I tried out using system.process.Diagnostic.Process method
But didnt succeeded.
Can anyone show me how i can open different application from my current application and close the current application before starting different application.
Aspiring Techie,
Vishnu Nath
|
|
|
|
|
Proces.Start is the easiest way to start a program.
Vishnu Nath wrote: But didnt succeeded.
Did you get an error? If so, what was the message? Can you post the code you used?
I are troll
|
|
|
|
|
Now i have changed the way i used the code.
Now i use my process.start code in Program.cs file.
But it is behaving in a different manner.
static void Main()
{
string appPath = applicationPath();
try
{
if (checkInternetConnection() == true)
{
if (setXML() == true)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Update());
}
else
{
Process.Start(appPath);
}
}
else
{
Process.Start(appPath);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
Process.Start(appPath);
}
appPath is the path of main application retrieved from applicationPath() method.
and setXml() is a method returning boolean value.
Now if update is available.
the application will fire Update Form else it will start my main app.
But instead the application runs , but its control and text are not visible.
When Update Form runs, Form is blank without any controls in it.
I m unable to understand what happens that my controls and heading form becomes invisible during runtime.
Can u sort out the problem?
Aspiring Techie,
Vishnu Nath
|
|
|
|
|
I can't see any reason here why the Update-form would hide it's controls, unless there's some kind of weird exception.
I wouldn't change the Program.cs, instead, I would have put the Process.Start code somewhere in the Update-form. Perhaps that any of the other members see a potential source of the error?
I are troll
|
|
|
|
|
Since i want either of the form to open. i.e either Update form if update is available or else my main app if there is no update.
Hence i chose it to include process.start code in program.cs file.
Aspiring Techie,
Vishnu Nath
|
|
|
|
|
Vishnu Nath wrote: Since i want either of the form to open.
The check might take a while, depending on connectivity. I'd still recommend showing a form with a message "Hold on, checking for new cool stuff!".
Alternatively, this worked for me;
Program.cs
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
if (true) <- perform update check here :)
{
System.Diagnostics.Process.Start("Calc.exe");
}
else
{
Application.Run(new Form1());
}
}
I are troll
|
|
|
|
|
Eddy Vluggen wrote: Update-form would hide it's controls
i got my mistake, i got the reason why Update form hided its control.
Its because by mistake i commented out the InitializeComponent() method in Update's constructor, that led to hiding of the controls in the form.
Aspiring Techie,
Vishnu Nath
|
|
|
|
|
we have done one project in windows application.we want give our software project to our clients.Now our problem is we have give Authentication premission four system or five system.
eg; we are giving software to one client,but they are taking our software for four or five system.
How to resit for four or five system .
thank's in adv
lavan
|
|
|
|
|
Hello All,
Ive got a difficulty regarding opening files in their respective editors...I have to develop an application where I need to say open a pdf file in AcrobatReader,doc file in Word,image in image editor...
Please do let me know if ne1 has solution to this....atleast reference to what i can do to solve this...
|
|
|
|
|
Each file-extension has a binding to a program that is used to open them. That's how the Windows Explorer knows that it should start "WordPad" for ".doc" files if you don't have Microsfot Word installed. Once Word is installed, it will use Word, as this gets associated with the file-extension during the installation.
If you just want to "open" the file with the correct editor, then you can simply use "Proces.Start" to start the document - it will open the document with whatever editor the user has associated with the file-extension.
If you want to display the editor-name in, say, a listbox, you'll have to dig deeper.
I are troll
|
|
|
|
|
bhagyashri.biyani wrote: I have to develop an application where I need to say open a pdf file in AcrobatReader,doc file in Word,image in image editor
Why do you have to develop that app when Windows Explorer already does that and comes free with Windows OS?
|
|
|
|
|
i need validations for textbox in my windows form .
pls help.
Swap
|
|
|
|
|
You will need to write your own code in the Validating event.
The word "politics" describes the process so well: "Poli" in Latin meaning "many" and "tics" meaning "bloodsucking creatures."
जय हिंद
|
|
|
|