Hi =), I want to draw the content of a pdf or postscript file on on a graphics object. I searched already, but i just found nothing useful. Does anyone of you know how to do that ? thanks in advance.
MarkPhB
Posts
-
How to draw a pdf or postscript files to a graphics object -
Expose Objects through Remoting with Windows servicesDeusche Version: (für die deutschsprachigen unter uns) Hi, Ich möchte eine Anwendung schreiben die aus einem Windows Dienst (Server) und einer Desktopanwendung (Client) besteht. Der Dienst erstellt dabei eine Instanz von einr Klasse, die selbstständig, mit meheren Ressourcen, über dem SerielPort und TCP/IP, arbeitet. Die Desktopanwendung soll sich nun irgend wie mit dem Dienst in Verbindung setzten und dieses Instance abrüfen können um bestimmte Events zu behandel, Eigenschaften abzufragen und methoden auszuführen. Soweit ich weiß gibt es da eine möglichkeit mittels remoting. Aber bei dem was ich bisher gesehen hab, wird das Object, erst durch den Abruf durch eines Clients erstellt. Ich brauche das Object aber bereits beim Start des Dienstes und nicht erst wenn es irgend jemand abruft. Daher meine Frage: Wie ist es möglich ein Objekt welches ich selbst erstellt hab, einer Desktopanwendung zur Verfügung zu stelllen ? -------------------------------------------------- english version: Hi, I want to write an application with a windows service as server and a desktop application as client. The service creates an instance of class which works independently with serveral resources on the SerielPort and the TCP/IP. The desktop application must be able to connect to the service and get the afore created instance and may handle events, invoke properties and perform methods. As far as I know there is a possibility using Remoting. But with what I've seen so far, the instance will first created on a demand by a client. But I already need the object on the start of the service and not only when someone demand it. Thats why my question: How is it possible to expose or provide an instance, which I've created on my own, for a desktop application ?
-
How to determine the Type of a null-Reference ?no such thing but i thought there would be some reflection methode wich can tell me this
-
How to determine the Type of a null-Reference ?no this doesn't work
( ( ( MyClass ) null ) is MyClass )
returns false.
-
How to determine the Type of a null-Reference ?Hi can anybody tell me how i determine the Type of a null-Reference ?
MyClass mc = null; mc.GetType() // throws a NullReferenceException typeof(mc) // work only with Classnames
I just want to know the Type of "mc" when it is null.
-
How to access the explicit interface implementation of a base class from a dervied class ?Because i couldn't implement the interface explicit ;)
-
How to access the explicit interface implementation of a base class from a dervied class ?Is there a way to access the explicit interface implementation of a base class from a dervied class without using reflection ? Because the following lines wont compile, and i dont understand why i shouldn't.
public interface ISomeInterface {
void SomeMethode();
}
public class BaseClass : ISomeInterface {
object SomeInterface.SomeMethode{ ... }
}
public class DerivedClass : BaseClass, ISomeInterface {
object SomeInterface.SomeMethode{ ( ( ISomeInterface ) base ).SomeMethode(); // CS0175 - Use of keyword base is not valid in this context }
}
-
explicit interface implementation of ICollection in Generic ClassesSimon Stevens wrote:
nasty horrible programmers who don't like you might write a program that reflects on your assembly, and takes a lock on your public lock object
Well in that case you have no chance. If someone uses reflection then there is no way to protect it. With Reflection someone can do everything, unimportant whether the lockObject is private or public. ;)
Simon Stevens wrote:
Public lock objects are bad practice
OK, but how shall i lock the ConnectionList for an external enumeration ? ...or shall i copy the entire ConnectionList befor i enumerate it ? :^)
-
explicit interface implementation of ICollection in Generic Classesthank you for the good answer =) But in the case of the TcpServerClass....I have two possiblilities P#1 - I provide a lock-object with a collection to synchronize with it ( SyncRoot - ;)) or P#2 - I provide a lock-object from the class which wrap the collection ( TcpServer.SyncLock). But for P#2 i would have to do this everytime i use a collection whereat for the P#1 the lock-object would just come with the collection. :) I understand you when you say... lock object should really be private ...but in a development, you should know what you are doing. So, thats why it is not really necessary, i think :)
-
explicit interface implementation of ICollection in Generic ClassesHi, :) I have a generally question that bother me. Let me explain it with an example, so that you understand the question. Let's say we have simple TcpSerer-class which a ConnectionList and looks like this
public class TcpServer { public List ConnectionList { get; } public void start () { } public void stop () { } private void client_Connected ( TcpClient client ) { ConnectionList.Add( client ); } private void client_Disconnected ( TcpClient client ) { ConnectionList.Remove( client ); } }
So, as you can see, this class is not thread-safe. Because an exception will thrown when i enumerate the ConnectionList while some Client connect or disconnect. Thats why i need an object to provide a possibility to lock the ConnectionList while i enumerate it. OK so far so good. :) Now i thought just take the SyncRoot-Property from the ICollection Interface implementation. But someone told me, i should not use that Object for synchronization with the list. Because the SyncRoot-Property was a mistake from Microsoft and decoy the developers to use it without thinking about synchronization. :^) But the same one told me, that there is no differenc between the object from the SyncRoot-Property and the object i could provide with a derivation of the List<T>. :doh: Thats why my questions: Q#1 - Is it true that the SyncRoot-Property was a mistake from Microsoft and shoundnt be used for synchronization. ? :confused: Q#2 - If Q#1 is true then - Why ? :confused: Q#3 - What its the recommended pattern to lock / synchronize any collection.:confused: Thanks in advance. P.S.: I asked this question already in the msdn-forum but it doesn't satisfy me. Link: http://forums.msdn.microsoft.com/en-US/netfxbcl/thread/3d760576-7cd2-44d5-936e-969ff5213648/[^]
-
Whats wrong with DebuggerDisplay in Visual Studio 2008Ok and how do we inform Mircosoft about that bug ?
-
Whats wrong with DebuggerDisplay in Visual Studio 2008Hi, i discoverd the DebuggerDisplayAttribute don't work in Visual Studio 2008, at leat in mine. In Visual Studio 2005 did that work
[DebuggerDisplay( "{FirstName} {LastName}" )] class Person { public String FirstName { get; set; } public String LastName { get; set; } }
i searched for that problem already but i didnt found something about that. That why my question: Can you acknowledge that bug ? -
How to start a form maximized in the right wayHi, i want to start a form in Maximized-WindowState. So i found the following possibilities: #1 Setting the WindowState Property to Maximized in the Designer -> thats bad because the the form will be showed at Form_Load and that is too early. :( #2 Setting the WindowState Property to Maximized in the Form_Load-Event -> thats bad because i see how the form is resizing at the start. :( #3 Setting the WindowState Property to Normal in the Designer and set the Size-Property to the screenbounds -> thats bad because when i change the WindowState at runtime then there is no different between the WindowStates Normal and Maximized. :( So my question ist there a way to start a form maximized without that problems i mentioned ? :^)
-
What about the other use of generic base class und generic polymorphism ?Mark Churchill wrote:
If you are dealing with DataTables then you are dealing with objects, casting and constant invalidcastexceptions anyway, so I wouldnt worry too much [Wink]
Not quite :) i use the range-class to built a sqlstatement and to determine whether i have to ask a Id-Colum or a DateTime-Column from a table ;)
-
What about the other use of generic base class und generic polymorphism ?yea, i didn't tought about that way :) thx but what if, i have a class wich contain a range that can be a range of DateTime and a range of ULong. In that case i must use the object type as basis :^)
Class SomeClassName{ public **object** RangeProperty{get; set; } public SomeClassName( object range ){ RangeProperty = range; } public DataTable SearchForDatabaseEntries(){ if( RangeProperty is Range<DateTime> ){ // Range can be used to search for entries with DateTime info ( for example: CreationTime ) } else if( RangeProperty is Range<ULong> ){ // Range can be used to search for entries with Numeric info ( for example: SerialNumber ) } ... } }
Do you understand my intension now ? :) -
What about the other use of generic base class und generic polymorphism ?Mark Churchill wrote:
No, its not possible.
that's right, its not possible, but it should be, in my opinion. :)
Mark Churchill wrote:
Range< int > and Range< float > are two completely seperate types.
that's right as well, that's why IMO there should be a posibility to use generic classes as basis.
List<> list = new List<>(); // T should be assumed as Object or as the type limited through the where contrain
By the way i forgot to declare the Range<T> class as abstract. Its just a base class and must be inherited because we can not implement some methods, for example IsBetween(T value);
Range<> range = Range<>(); range.Start // <- from type object range.End// <- from type object range = new IntRange(); range.Start // <- from type int range.End// <- from type int range = new DoubleRange(); range.Start // <- from type double range.End// <- from type double
Mark Churchill wrote:
class Range< t > : BaseRange.
What would that bring? :^) The property Start and End would be ever from the type Object and can't take another type, except we override them with new.
-
What about the other use of generic base class und generic polymorphism ?What about this use of generic base class und generic polymorphism ? I found on the internet some Articles wich deal with generic base class and polymorphism but not in the following way. I know its not possible at the momenten but it should, i think. Lets say we have class declarations like this
public class Range<T> { public T Start { get; set; } public T End { get; set; } } public class IntRange : Range<Int32> { } public class DoubleRange : Range<Double> { } public class DateTimeRange : Range<DateTime> { }
then we could use it in this way
Range<> range = new Range(); range = new IntRange(); range = new DoubleRange();
and so far the T contrain is naked then the compiler should assume the Property are from Type Object.
range = new IntRange(); object obj = range.Start; // should compile int obj = range.Start; // don't compile int obj = (int) range.Start; // should compile
or the T contrain is limited to a inheritance of ValueType.
public class Range<T> where T : ValueType { public T Start { get; set; } public T End { get; set; } } ... range = new IntRange(); int obj = range.Start; // should compile
So i think that should be possible, or what you think ?
-
OOP QuestionThx, i knew i was right =)
-
OOP Questionyea thats my opinion too but my friend say: "Only the class knows what it can be done with it" for his example: "An object knows how it can be saved in a database". So he means: Object.Save() and not Database.Save( Object )
-
OOP QuestionHi i had a discussion with my friend about OOP and now i want to ask some of you. The question is: Knows a file how it can be printed or knows a printer how it can print a file ? or Knows a car how it can be repaired or knows a car repair shop how it can repair a car? or Knows a clothes how it can be washed or knows a washmaschine how it can wash a clothes or generally when have a class a specific ability on its own and when have only another class a specific ability and need another class to do it according to a example above: File.Print( ) or Printer.Print( File ) ? Car.Repair( ) or CarRepairShop.Repair( Car ) ? Clothes.Wash( ) or WashMaschine.Wash( Clothes ) ?