|
Robert Rohde wrote: Generally speaking controls do not 'remember' what has been painted onto them.
On a completely unrelated, yet interesting, tangent...
WPF uses a retained state rendering technique, which means that your control can explain to the system how it should be rendered once, and, in theory, it will never again for the life of the control. It uses vector-based rendering instructions (sort of like metafile) which are cached by the underlying composition engine!
:josh:
My WPF Blog[^]
|
|
|
|
|
|
Judah Himango wrote: Sounds cool.
It's a brave new world, Judah! The whole HWND system is replaced. Everything has changed.
|
|
|
|
|
Josh Smith wrote: The whole HWND system is replaced
Is that right? Are you sure it's not lurking there under the hood somewhere? I assume it is since it has to interop with Win32 based technologies like Windows Forms, MFC, etc.
|
|
|
|
|
Judah Himango wrote: Is that right? Are you sure it's not lurking there under the hood somewhere?
Positive. The only way that HWNDs are involved is in interop scenarios. Other than that, the HWND has no role in WPF. In fact, if you host an HWND-based control in a WPF application, it is not affected by any transforms, animations, etc. It just sits there like a dork in a Lamborghini.
|
|
|
|
|
Josh Smith wrote: In fact, if you host an HWND-based control in a WPF application, it is not affected by any transforms, animations, etc.
Very interesting. Thanks.
Josh Smith wrote: It just sits there like a dork in a Lamborghini.
LOL!
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Goof around music jam with my brothers (with video)
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
I have always been wondering about this subject.
What's the best way to decouple components from different layers?
I have been thinking about a method like the following:
Data access: Components implement interfaces from the Common namespace
Businesslogic: Components refer to the interfaces from the Common namespace
Webservice: Links data access components to the Business logic by assigning them to the right properties (which are typed using the common interfaces).
When not in a distributed environment, you can replace Webservice by a normal servicing layer. It even provides options to make a proxy construction in which the client can choose between the webservice and the local service
Anyone have interesting thoughts on this?
WM.
What about weapons of mass-construction?
|
|
|
|
|
I have been searching the net, the code project en google.
But I just cant find an answer to my question:
I create a ansync sokcet connection adn use BeginRead te read data from the socket.
like this:
private void Receive(){<br />
_Stream.BeginRead(_Buffer, _Offset, _Count, new AsyncCallback( RecieveCallBack ), _Stream);<br />
}<br />
<br />
private void RecieveCallBack( IAsyncResult asyncResult ){<br />
try{<br />
int _ReceivedBytes;<br />
_ReceivedBytes = _Stream.EndRead( asyncResult); <br />
if( _RecievedBytes > 0 )<br />
{<br />
string data = System.Text.Encoding.UTF8.GetString( _Buffer, _Offset, _RecievedBytes);<br />
<br />
FireOnReceive(data);<br />
if ( IsConnected )<br />
Receive();<br />
}<br />
} catch(ObjectDisposedException) {<br />
return;<br />
} catch(System.IO.IOException e) {<br />
FireOnError( new ConnectionException(e.Message , ConnectionErrorType.ReceiveError ) );<br />
}<br />
}
The problem is that it reads only as much as the _Offset allows, this is set 1024 byte.
But if the received is bigger than the offset the socket blocks and i only get half the data i need.
How do I get the complete data form the socket, I looked at some examples on code project bud they all us other method of getting the data form the socket object.
-- modified at 8:29 Friday 21st July, 2006
|
|
|
|
|
Here's a simplified sample for the received callback.
You forgot the resume reading from the stream. This causes the application to stop receiving data. Also you use the offset, this isn't necessary since you simply fill the receive buffer again from the start.
private void dataReceived(IAsyncResult asyncResult) {<br />
_receivedbytes = _stream.EndRead(asyncResult);<br />
<br />
string data = parseData(_buffer,0,_receivedbytes);<br />
<br />
_stream.BeginRead(_buffer,0,_bufferlength,new AsyncCallback(dataReceived));<br />
}
WM.
What about weapons of mass-construction?
-- modified at 8:45 Friday 21st July, 2006
|
|
|
|
|
Greate this will work.
But still i have a question, the _Buffer is byteArray and has en fixed size.
So that buffer does nothing?.
I gues that this is still the array that holds the bytes, but how to makes this one dynamic?
|
|
|
|
|
That buffer functions as a temporary place to store the received data.
You can then decode it using a StringBuilder or write it to a memorystream.
This is much more efficient than making the buffer dynamic, array resizing is expensive
WM.
What about weapons of mass-construction?
|
|
|
|
|
I get that the buffer is only temporary.
But when you call the beginread fuction the buffer needs a size.
Like in you example:
_stream.BeginRead(_buffer,0,_bufferlength,new AsyncCallback(dataReceived));
bufferlength is a int, but how big is it, 1024? But I want te read till the end!
|
|
|
|
|
To what end do you want to read? A network stream potentially has no end.
So this would mean read until you get an error stating the connection was closed.
The method does just that, it will throw an exception when the connection is closed. Normally I would check for a special character during the decoding of the received data to check if I need to close the connection and stop reading.
WM.
What about weapons of mass-construction?
|
|
|
|
|
Well after some searching in the MSDN library I found some thing that does what I want.
The MSDN libraray states that you sould create an state object and this holds the data received.
It will read until the buffer is empty and will then restart the receive procedure.
|
|
|
|
|
I want to play movie on our pc and display on tv using video card.
mean to say playout video (code in c# and vb.net or any .net product)
i wana script
|
|
|
|
|
I think that is called Windows Media Player.
|
|
|
|
|
I need Run Movie On Tv Using Video card
Topic Directx 9
Code In C# or vb.net
i wana script
|
|
|
|
|
hi
How to visible the events associated to control in C#.NET like right side top in vb.NET
If u have any idea regarding this please help me
venky
|
|
|
|
|
i am facing video streaming problem
my requirment is out video mpeg using snazzi video card
code should be in c#,vb.net
Regards,
Shakil Ahmed
i wana script
|
|
|
|
|
I don't have script. You can ask Google for that.
|
|
|
|
|
I tried it, but I don't get any problem. I tried it using ASCII and Unicode, there are no escape sequence in it. I take the sample from MSDN. It use:
reader.WhitespaceHandling = WhitespaceHandling.None;
to remove the space character in it.
What kind of escape sequence did you get ?
|
|
|
|
|
Hi all,
i am trying to change app settings in run time. I wrote the code below:
Properties.Settings.Default.ServerIP = "10.0.0.7";
Properties.Settings.Default.Save();
MessageBox.Show(
Properties.Settings.Default.ServerIP
);
It alerts "10.0.0.7" but does not save the value (default value was 10.0.0.12). And in WindowsApplication1.exe.config file, it is still 10.0.0.12. Does anyone know how can i change this value?
Thanks...
ozgur.nevres
|
|
|
|
|
i found the problem.
If i make any changes in my application, and build it, it re-creates the user.config file in Application Data folder with default values.
can i force the VS to re-create the file with changed values?
thanks...
ozgur.nevres
|
|
|
|
|
Hi,
I'm buidling a forms application in which user settings can be stored and loaded from a file. So far so good. Now I'm trying to load a file of this type made by another user on another computer. It seems this causes some kind security problem:
System.UnauthorizedAccessException: Access to the path 'C:\dotnet\myapp\bin\Debug\settings\defaults.set' is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
at System.IO.File.Open(String path, FileMode mode)
The file in question is created simply as:
Stream stream = File.Open(filename, FileMode.Create);
BinaryFormatter bFormatter = new BinaryFormatter();
stream.Close();
Why am I getting this error and does anyone know how to solve it?
|
|
|
|
|
It most likely inherited rights from the parent folder, and got transfered somehow.
Are you using Vista btw? I have seen the same thing happen there without explaination.
|
|
|
|