|
i see.
Now i am designing a application that enable users as server side can configurate some componets on the platform (just a winapplication embedded browser i said first time) the users as client side can watch the results.As you know the client side should comunication with server realtime to get data.
Cmmonly we can refresh the browser to link to the server to get data,but when application need do this per 2 second this method cann't been used.Now i am confused about whether to design web components(how keep communicaion between server and client in background process) or winform component (use DCOM to keep their communicaion?anyother method?) .So, please give me some advice. thank you.
非常感谢您的帮助
|
|
|
|
|
Web Controls are merely server-side controls that are rendered as HTML. This would still require that the client refreshes the browser, or that you initialize a timer with a 2-second delay, or that you use the HTTP header "refresh" (or a META tag using http-equiv="refresh") with the value "timeout;url", where timeout is set to 2 and the url is the same page.
If you use a Windows Forms control, you could use XML Web Service, Remoting, or Enterprise Services (DCOM) to communicate in real-time with the backend with the user needing to do anything, but the client should still poll for data (if using remoting hosted by IIS) because any remoting object hosted by IIS is configured as a Web Service and - because of the HTTP protocol - can only communicate one way (from client to server).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Now,i am decided to design Web component.Just as you say above if we design winfrom component we can use web servers,DCOM and so on,but when i do web component,how can i keep communication between client and server don't use to refresh.For example when i use DataGrid web component ,how can i update its data in client side without using refresh to connect to server side.
感谢你的帮助!!!
|
|
|
|
|
The important thing to remember is that the web browser is not communicating the with server. The server nearly sent the browser a page that contains an embedded object. That object communicates directly with the server as any other application - either embedded or standalone - would, using remoting, DCOM, or whatever. This is up to the implementation.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
thanks you!Now the thing confused my head is that my web component can changed its surface when the data it bound to,but how can i make the same change apperaed in client connected with the server?
您的帮助将使我受益匪浅!
|
|
|
|
|
Here's an ASCII chart:
Web Browser (client) -> Request -> HTTP Server (server)
client <- Response <- server
Embedded Control (client) <-> DCOM/Remoting Server (server) Notice how the embedded control can communicate BOTH ways with the DCOM or Remoting server? See, you're missing the crutial point here and you must understand this or you're really in trouble. HTTP communication is essentially one way. Yes, the browser requests information from the server and the server sends it out, but the server cannot send out information without a request from a client application.
For what you need, you are EMBEDDING a control in a Web page (which requires no refreshing of the web browser - think of it as a stand-alone appliation that just sits there) that talks directly with a DCOM or Remoting server on the server. If the client is not firewalled, the DCOM or Remoting service can make calls on the client as well. It's two-way communication.
For a web browser, if you need to refresh data, you either have to have a javascript or browser behavior fetch data behind the scenes and update the DHTML page (or an ActiveX control or Java applet doing it in the foreground), or you have to refresh the page itself either using some javascript with a timer and window.location.reload() , or use the HTTP-EQUIV="refresh" META tag with the content="timeout;url" syntax. This is all in the MSDN Library and you should read it and understand this basic concept of the Web before you venture down a page blindly. It's crucial.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I was trying to work with this example from MSDN Library to get the filename and path of a file:
if(openFileDialog.ShowDialog() == DialogResult.OK)<br />
{<br />
System.IO.StreamReader sr = new <br />
System.IO.StreamReader(openFileDialog.FileName);<br />
MessageBox.Show(sr.ReadToEnd());<br />
sr.Close();<br />
}
The problem is that when opening large files, at least 400MB it crashes the app. Is there any other way to get JUST the path and filename of large files without actually opening them?
Thanks,
// Steve McLenithan
Cluelessnes: There are no stupid questions, but there are a lot of inquisitive idots.
|
|
|
|
|
Steve McLenithan wrote:
openFileDialog.FileName
This should do it, the dialog itself doesn't actually open the file, it only provides the interface for you to select a specified file.
-Nick Parker
DeveloperNotes.com
|
|
|
|
|
Hmm... When I open the file. The process for the app in taskmanager quickly rises to hogging over 260MB of RAM...
// Steve McLenithan
Cluelessnes: There are no stupid questions, but there are a lot of inquisitive idots.
|
|
|
|
|
Thats because u are trying to dump the entire contents of the file in a message box... The example code obviously expects a one/two line text file.
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
My mistake. Thanks.
// Steve McLenithan
Cluelessnes: There are no stupid questions, but there are a lot of inquisitive idots.
|
|
|
|
|
leppie's right - what would you expect when opening such a large file?
Instead, read the file in blocks (streaming):
StreamReader reader = new StreamReader(openFileDialog1.FileName, true);
int read = 0;
char[] buffer = new char[4096];
do
{
read = s.Read(buffer, 0, buffer.Length);
Console.Write(buffer);
} while (read == buffer.Length); Notice that I also use a StreamReader . Any TextReader or TextWriter derivites are optimized for text. The boolean in the StreamReader constructor actually attempts to determine if the text is ASCII, UTF7 or 8, or Unicode. If you use a stream, you have to know / determine the encoding yourself.
The main point, however, isthat you don't keep the entire file in memory. You dump the buffer and get more. Displaying a 200 MB file will take that much memory plus more - and if you read an ASCII file into a Char array, you'll waste even more memory because .NET stores characters and strings as Unicode - thus taking two bytes per character.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Thanks guys.
// Steve McLenithan
Cluelessnes: There are no stupid questions, but there are a lot of inquisitive idots.
|
|
|
|
|
I am importing Icons into my program to display in my list view.
While the Icons work, and the whole program mechanism is fine, I have a problem with background "noise".
Almost all of the images I import come with messy background colour around the edges that does not show up in any external bitmap or icon viewer.
The colour is not limited to black, and covers a number of shades of brown and dark grey.
This occurs both from importing icons to internal resources, and when openend from file, and persists in both Icon and Bitmap formats.
This is VERY frustrating, as it is ruining my application.
Does anyone know what causes it? And What can I do about it?
20-17 to England!
What a game...
GO JONNIE! Drop goal 20 seconds from end of extra time...
|
|
|
|
|
On XP or 2003, right? The problem is that the icon functions get the best icon to display in Windows. Since XP introduced alpha channels on icons, you're getting the icon with the alpha channel. Unfortunately, unless you bind to common controls 6 (.NET's System.Widnows.Forms controls are just wrappers around these), alpha blending isn't performed and you see the alpha channel as a solid color.
There's a couple different things you can do:- Enable theming in your app (which binds to comctl32 version 6).
- Read the icons and remove the alpha pixels. It's not as simple as it sounds, though. You have to also use an unsafe context for optimal performance. Christian Graus here on CP has several good articles about image manipulation.
As far as enabling theming in your app, if you are using .NET 1.1 call Application.EnableVisualStyles() before calling Application.Run() in your app's entry point (Main ). If you aren't using .NET 1.1 or your app could run on either 1.0 or 1.1, see my article, Windows XP Visual Styles for Windows Forms[^]. You can either embed the manifest file as a Win32 resource (not a .NET embedded resource) or keep it as a separate file that is named myappname.exe.manifest (same convention as .conf files but with a different extension).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Yes, XP.
Hmmm, I understand the cause, but unfortunately, I have only been programming for around a year (any serious ammount).
I'm basicaly using an arraylist to hold icons that I pull from a OpenFileDialog() to an icon list. These icons are pooled, and linked with file extentions in my archive viewer. The viewer uses the file extentions to lookup the Icon index from the list and sets the ImageIndex to that.
I don't know what Theming is, or how to remove the alpha pixels once the icons are read.
I've been deleting the alpha manualy on imported icons, but those that I pull from the dialogbox.
For now, I shall have a look at theming.
Thanks
Tris
|
|
|
|
|
The_Catalyst wrote:
I'm basicaly using an arraylist to hold icons that I pull from a OpenFileDialog() to an icon list.
Use an ImageList - that's what it's for and is much more suited for holding images.
The_Catalyst wrote:
I don't know what Theming is, or how to remove the alpha pixels once the icons are read.
That's why I gave you a link to my article. You type a simple text (XML) file (I give you a complete example) and give it a certain name. This isn't considered "programming" at all. You don't have to write a single line of code.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I am using an image list, but it doesn't offer the functionality I need for editing the images and moving them around that I need, so i store them in an arrayList and port them to an imagelist when i construct the object.
Had a look at the page, and a tinker, but too tired to do the whole thing today.
I have .NET 1.1, but how do i set it to build only in that?
Thanks
Cata
|
|
|
|
|
It already only builds for a particular CLR version, but it can often run on multiple versions of the CLR because of backward and forward compatibility (not always gauranteed - take note of the class library documentation when you're looking through to see what's new and what's obsolete).
To make sure it only runs on a particular version, use a .config file with the <startup> section that lists required and supported runtimes.
In any case, if you want the user to be allowed to run this with .NET 1.0 and it does work regardless of the pixel problem, use the .manifest file because it works in all cases (and with native Windows applications, too).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
hi all,
just wondering if anyone has managed to work out how to list ODBC sources in a drop-down-listbox in C#?
have been able to do it in BCB 5.x and 6.x, but there doesn't seem to be a way to do it in C#...
any help would be greatly apprecitated...
cheers and thanks
nik
Nik Vogiatzis
PhD Candidate: University of South Australia
|
|
|
|
|
It all comes down to APIs. BCB might have APIs or library to help you do this while C# (actually, the .NET Framework base class library) currently does not. If you need this functionality, you need to P/Invoke the right native functions, like SQLDrivers and SQLDataSources . There also could be some .NET assemblies (the source language doesn't matter, remember, since all languages targeting the CLR compile to IL) out there. I haven't seen any, but googling might uncover something.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
hi heath,
thanks for the response...
it don't necessarily believe is has anything to do specifically with BCB's libraries/API's...
more so, my gut feel is that it has something to do with the Win32 API, as the VCL (Visual Component Library) encapsulates much of the Win32API, in the same way that the MFC handles lower level API calls...
there is nothing necessarily problematic with me building a class in C++.NET to do the same thing, but i would have preferred keeping it all in the one language...
i concur with your sentiment that at the end of the day, in .NET everything targets the CLR compile to IL (something this old man needs to start getting used to), but my problem remains, i am used to the VCL which is implemented in BCB (Borland C++ Builder) and don't know the equivalent in Microsoft World...
i tried googling before coming to the forum, i like to do my homework first before bothering anyone... )
cheers and thanks for the suggestions though...
nik
Nik Vogiatzis
PhD Candidate: University of South Australia
|
|
|
|
|
Yes, it has everything to do with APIs. Application programming interfaces are provided by libraries that contain distinct functionality. The .NET BCL does not have these where something in VCL does. This functionality does exist in the ODBC APIs and all VCL is doing is wrapping it. Again, this hasn't been done in .NET (at least in an assembly that Microsoft produces). You would have to do it and you can do it in C#. See the DllImportAttribute for more information on P/Invoke. You're not rewriting anything - just importing a native function into managed code. This is oft-done in many larger applications because of APIs that don't exist in the BCL or other third-party libraries that do exist in various Windows APIs.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Nik, ODBC data sources are stored within the Windows registry. Here[^] is even an article in VB.NET explaining how to read these, it should prove trivial to convert this to C#. HTH
-Nick Parker
DeveloperNotes.com
|
|
|
|
|
hi nick...
greatly appreciated!!
cheers
nik
Nik Vogiatzis
PhD Candidate: University of South Australia
+++++++++++++++++++++++++++
Developing new generation Traffic Micro-simulation Tools for Traffic Engineers
|
|
|
|