|
From Google and experiment, you can, because you can add a reference to a CF DLL to a full .NET project, so it is possible provided you only need to reference stuff from the CF.
|
|
|
|
|
Plan your project with CF only. It will automatically work with full .net.
|
|
|
|
|
That's what I said.
Yeah, you can make a .DLL that will work on both, PROVIDED you don't use anything that won't work in CF. In that case, what's the point? All you're doing is writing code for the least functional framework. You're not actually targeting different frameworks. You're targeting the CF only, and the resulting .DLL just happens to work on the full .NET CLR.
|
|
|
|
|
Dave Kreskowiak wrote: what's the point?
Well, code re-use, ease of maintenance, etc etc etc. If you don't need anything that isn't in the CF then I would say there's a LOT of point, especially if like me you have classes and data structures that you need to use on both.
|
|
|
|
|
If only it was that easy. There's a LOT more to it than just adding a reference and making sure you don't call a method in the class that isn't supported on CF.
I'll leave it up to you to try a quick test and find out. It shouldn't take you but more than 20 minutes to put together a class in the full .NET class library project, then try it in a CF app.
|
|
|
|
|
Is it possible to create a graphics object in the constructor of a normal calss in order to measure a string? Not using a form or control?
Graphics g = ?
m_nodeSize = g.MeasureString(m_name, nodeFont);
Thanx George
|
|
|
|
|
Graphics g = Graphics.FromImage(new Bitmap(80, 80));
Give that a shot.
|
|
|
|
|
Thank you Kevinnicol
That worked great, i was looking for something like that.
public static SizeF MeasureString(string s, Font font)
{
SizeF result;
using (var image = new Bitmap(0, 0))
{
using (var g = Graphics.FromImage(image))
{
result = g.MeasureString(s, font);
}
}
return result;
}
Did see this example but preffer the below:
Graphics g = Graphics.FromImage(new Bitmap(80, 80));
m_nodeSize = g.MeasureString(m_name, nodeFont);
Thanx George
|
|
|
|
|
gwithey wrote: Graphics g = Graphics.FromImage(new Bitmap(80, 80)); m_nodeSize = g.MeasureString(m_name, nodeFont);
Sorry, did you mean to say that you prefer this version? If so, please don't - use the version above it instead as that disposes of managed resources instead."WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Message Closed
modified 23-Nov-14 6:41am.
|
|
|
|
|
Thank you stancrm
I saw this however couldnt find a solution as:
Graphics g;
g = this.CreateGraphics();
Only works in a control or on a form. Not in a normal C# class
Thanx George
|
|
|
|
|
Hi all,
I have an issue and I'd like to find a cleaner solution (as, right now, my work around is dirty beyond recognition ).
This is the structure
"Search" (A web service method) is called by Web Site
"Search" calls two other Web Service methods Asynchronously
Each Async method calls a "Completed" method (one each) and each "Completed" method checks if the other one was finished before it
Once both Async calls have been finished another method ("Connect Results") is called by the last finished "Completed" method
"Connect Results" gathers data from two files (saved from each async method) and joins them into one instance of a class "Final Result" which needs to be returned
BUT since the method "Search" needs a return and because the return line is reached before any of the threads have finished executing, the return is always empty.
So I inserted a while loop (which checks that "Final Result" is not empty) before the last "return" line of "Search" which does nothing except wait for the class to be filled!
I'm sure there's some other way to do this... something cleaner but I can't seem to find it.
Thanks for your help and sorry for the long post...In life truth does not matter. What really matters is what others believe to be the truth. (The Up and Comer - Book)
|
|
|
|
|
Hei,
I want to make an installer which can do the following task;
1. Install Dot net fram work 3.0
2. Install CR Merge module 11
3. Install MSDE
4. Create Databes
5. Install Application
what is the best practice or any idea?
thanksSyed Shahid Hussain
|
|
|
|
|
Use the Windows Installer and create MSI files. That's your best bet.
|
|
|
|
|
i have a basic question in linq.
Lets say i have a list of student collection
List<Student> lstStudents = new List<Student>();
Now when i use the where method, i can either specify
List<Student> lstFilteredStudents = lstStudents.where<Student>(...);
or i can specify
List<Student> lstFilteredStudents = lstStudents.where(...);
Now my question is wat is the difference between calling these two methods internally?modified on Wednesday, March 3, 2010 6:45 AM
|
|
|
|
|
None really. The first one is explicitly specifying that the where clause is working against a generic of type Student, where the second version will infer it."WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
As far as LINQ is concerned, there is no difference between either of those calls. In fact, there is only one version of that Where method which is generic and looks like Where<TSource>(Func<TSource, int, bool> predicate)) .
In your first call, you are explicitly stating the type to be used in place of TSource and in the second one you are letting the compiler infer the type from the type of the collection.Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
Welcome back Scott. I take it the book writing has gone well."WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Thanks Pete! Good to be back! Yes, the book writing has gone very well. Four chapters left to be tech reviewed and then the actual publishing process starts. Should be on the shelves in a few months!Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
Cool. I bet you're glad to have your life back."WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Yes. The entire family is glad. Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
Hi all,
I have a question regarding web services and configuration files.
Platform:
.Net Framework , code behind c#.
Scenario:
I have a web service which when i publish, creates a bin folder. All normal. Now, in that bin folder i have a dll which is effectively my data access layer, CRUD for databases etc. Now i use ConfigurationManager.GetSection("AppConfig") within this dll in order to get database connection strings, which the dll brings out from the web service web.config file.
File Structure:
<My Web Service Folder>
--><AppData>
--><bin>--><My Data Access Layer DLL>
--><web.config(includes data access layer variables)>
Within my development environment, this works like a charm, using ConfigurationManager.GetSection("AppConfig") from my dll to get out the appconfig section from my web.config and then searching the nodes in order to find the right key.
Example of web.config:
<AppConfig>
<Configs use="true">
<add key="Databases" use="true" />
</Configs>
<!-- Web Service Configuration Settings-->
<Databases>
<ConnectionStrings>
<add key="<MY KEY NAME>" providerName="System.Data.SqlClient"
value="<MY CONNECTION STRING>" />
</ConnectionStrings>
</Databases>
</AppConfig>
So far so good.
Now i am testing a deployment of this system on a virtual pc. I copy and paste the c:\initpub\<mywebservice> folder into the c:\inetpub of the virtual pc. I try and run it and it fails. After inserting debugging into the code to see where it is failing, I found out that ConfigurationManager.GetSection("AppConfig") is actually returning null instead of the appconfig section from the web.config. Does anybody know why this is happening ?
Please excuse the length of the post but was needed to explain the situation.
James
|
|
|
|
|
Hi,
I want to be able to send commands to a running application from the command line. Is there a simple way to do this?
Thanks in advance for any help.
Ted- Life would be so much easier if I had the source code!
- If C# had true garbage collection, most applications would delete themselves upon execution
|
|
|
|
|
Is the application already running on the commandline, or are you starting a console-application?
If you're starting the proces yourself (using Process ) then you could redirect the Standard Input[^] device.I are Troll
|
|
|
|
|
Perhaps it needed a little bit more explanation.
In Delphi, I wrote a program for clients that listened to UDP. On the server I sometimes started a broadcaster (from the command line) to send a message to the clients (after sending the message the broacast app shuts down again).
Now in C# I'm gonna rebuild this program. The client will be the same, but on the server the application will keep running because of added functionality.
So, the app is a GUI app (dont know if it will be winforms or wpf yet) which will be running constantly. I just want to send some kind of command from the command line to the server and have the server app handle the messaging to the clients. Ofcourse, I could also split the server app in 2 programs (the original broadcaster) and another app to do the extra stuff. But the server app will also log the messages sent, so thats why i wanted to build one tool for the server which does all the work..
Better explained this way? or even more vague?
Ted- Life would be so much easier if I had the source code!
- If C# had true garbage collection, most applications would delete themselves upon execution
|
|
|
|