|
Hello,
I have building a download/update file for a C# desktop application in pieces. Now, I am at the following point; the application determines if the new file is required. If so, it forces a download to a local file folder inside the application that is already running (this works perfectly). NOW...how do I shut down the application and run the update and then restart the application, or can it be done without a restart? Can this all be done automatically and without user input? Or perhaps I should place the file in an external folder and force a restart and then force the program to run the file? If so, how is this done? I am confused. Any suggestions would be appreciated. Thank you....Pat
|
|
|
|
|
There are many possible solutions. One of the most elegant is to use a "plug-in" system.
At the other side a real easy way is to create a "SplahScreen" like app that checks for new
updates, installs them and starts the actual app. If no updates found, it just starts the app.
As for actual code especially for the elegant one is just too much to provide.
Google or search inside CP for "program/application updates".
|
|
|
|
|
If you had used ClickOnce the application could already be configured to download and install updates prior to starting. Of course you can do this by hand by using a starter app, like a splash screen, that performs the update.
Another way is to use shadow folders to run the app from and copy the updates to the installed location to be used the next time the app starts. Microsft uses this approach for .net framework assemblies to allow them to be updated while an application may be using them. I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hi,
i am developing an app that prints on label sheets, this requires setting the data in the OnPrintPage from pixel 0,0.
When i draw the document on the OnPrintPage in all looks ok with a PrintPreviewControl, but when i actually print the page with a printer it start printing with a margin, how do i get the printer to print the exact same as the PrintDocument and if the printer is not capable to print the margins then he should just ignore these pixels?! does it have with any margin settings? PageBounds?
|
|
|
|
|
I've run into similar problems and honestly haven't found a good way around them. You see, in my case, people can change the printer selection and so my program doesn't really know what margins a printer may have, etc. The best I can tell, you can specify margins, etc, but the system doesn't enforce them automatically. At least with the lower level functions, it's up to your code to enforce the margins.
My solution kludge was to compute the page margins in pixels for each device and then blank the margin rectangles after drawing and before printing each page. Don't forget that the PixelsPerInch numbers can be pretty strange for different devices.
Perhaps someone else has a better solution.CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
Thanks for the reply.
The strange thing is that when i print to a PDF file with BullZip and from there to my printer he will ignore the margins just like i want. and if BullZip can so can we! BUT HOW?
|
|
|
|
|
I have my WebBrowser, tha is create in Windows,I load in this webbrowser a pdf like this form:
this.WebBrowser.Navigate("C:/Tmp/abc.pdf")
The problem that I have is that when I close this Form
in this event
private void frmSirMosDocPdf_FormClosed(object sender, FormClosedEventArgs e)
{
System.IO.File.Delete(("C:/Tmp/abc.pdf");
}
this part generted a error, it says you can´t access to this file, because is running with ohter process, please help me, how can i do, to give a solution.
Thanks.
|
|
|
|
|
not sure its easy to solve - in older pdf's/acrobat versions, when you opened a pdf in a browser and then closed it, acrobat would often still be left running as a process in the background. The only way to release the pdf was to kill all 'lurking' acrobat processes ..
have a look on your system, when you close the form, is acrobat still lurking there as a background process ?
(there are other utilities, do a google for 'sysinternals', now part of Microsoft, that show file usage/processes accessing etc - possibly discmon or psfile)
[edit] possibly 'Process Explorer or 'Handles' from sysinternals would doa better job of identifying whats 'locking' the file, but dont disregard the comments made by others here either [/edit]
'g'modified on Thursday, February 11, 2010 7:01 PM
|
|
|
|
|
As the other poster said, there is stuff still running in the background, though in my experience it is the WebBrowser Component. As it wraps an unmanaged resource you must ensure you Dispose of the WebBrowser when yoiu dispose of the Form. ie. in the Form Dispose method call Dispose on the WebBrowser, or it will remain in the background and hold a pointer to the PDF.
We had a similar problem with the WebBrowser retaining local cached copies of pages when we thought we had closed it down, all because we had not called Dispose.
|
|
|
|
|
Hi,
while the WebBrowser is showing a file, it might keep it open, preventing you deleting it; so you may have to navigate away from x in order to delete file x. One way should be to assign a dummy page, maybe like this:
myWebBrowser.DocumentText="<html><head></head><body></body></html>";
although
myWebBrowser.DocumentText="";
probably works equally well.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
Hi,
sorry, my previous approach does not work.
while the WebBrowser is showing a file, it does keep it open, preventing you deleting it; so you must navigate away from x in order to delete file x. It works like this:
myWebBrowser.Navigate(anotherPage);
... wait a while
File.Delete(previousPage);
If you don't have anotherPage available, you can create a local one, hence:
string anotherPage="C:\temp\dummy.html";
File.WriteAllText(anotherPage, "<html><head></head><body></body></html>";
myWebBrowser.Navigate(anotherPage);
... wait a while
File.Delete(previousPage);
This works for me.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
Hi everybody.
There is a property, it's named ImageFullPath1
public string ImageFullPath1 {get; set; }
I'm gonna fire an event whenever its value changed. I know I can beware of changing with INotifyPropertyChanged , but I wanna do it with events.
I don't know how I should do it.
Could you please guide me?
Thanks.
|
|
|
|
|
INotifyPropertyChanged uses events and is there just for what you are asking. I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I just hate the fact that it uses a string, however.
|
|
|
|
|
Use the alternative approach with the same result. You need a specifically named event with the default eventArgs the name must be YOURPROPERTYChanged . For best practice also supply and OnYOURPROPERTYChanged method as well. e.g.
private string _MyProperty;
public string MyProperty {
Get { return this._MyProperty; }
Set {
If (this._MyProperty != value){
this._MyProperty = value;
this.OnMyPropertyChanged(EventArgs.Empty);
}
}
}
public virtual void OnMyPropertyChanged(EventArgs e){
if (this.MyPropertyChanged != null){
this.MyPropertyChanged(this, e);
}
}
public EventHandler MyPropertyChanged;
|
|
|
|
|
I don't recall asking a question to which this was the answer.
|
|
|
|
|
Sorry, replied at the wrong level in the thread.
My appologies
|
|
|
|
|
Posted in reply to the wrong message earlier. Apologies.
Use the alternative approach with the same result. You need a specifically named event with the default eventArgs the name must be YOURPROPERTYChanged . For best practice also supply and OnYOURPROPERTYChanged method as well. e.g.
private string _MyProperty;
public string MyProperty {
Get { return this._MyProperty; }
Set {
If (this._MyProperty != value){
this._MyProperty = value;
this.OnMyPropertyChanged(EventArgs.Empty);
}
}
}
public virtual void OnMyPropertyChanged(EventArgs e){
if (this.MyPropertyChanged != null){
this.MyPropertyChanged(this, e);
}
}
public EventHandler MyPropertyChanged;
|
|
|
|
|
|
hi,
in my case, i have a lan using sql server as data server, now one client insert or update some important data that it's highly recommended to another clients understand this operation, is there any way to make a remote delegate on all clients or something like this
ty
|
|
|
|
|
My first thought is that you'd probably have to setup a communications system with a central server that performed the database operations, and then notified all of the clients of the change..45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
thanks for ur answer,
u right, look im going to do this as easy as possible, bcoz fee for this work is only 50$.
|
|
|
|
|
|
thanx for ur answer, in my case I have 1milion record in my cached table in my form, so if 1 record has changed,then by using sqldependency 1milion record must be retrived again! is it possible to understand which record has been changed?
|
|
|
|
|
1 million? I doubt that.
Have you read the documentation? Have you actually tried it? I know the language. I've read a book. - _Madmatt
|
|
|
|