|
Gary the Llama posted:I'm currently creating a Windows Forms application and I keep running into pesky UI issues. I'm just not happy with the way the program looks and is used. What OS are you targetting? Vista has 3.0 preinstalled so WPF applications require no extra downloads. If it's XP take a look at targeting the client framework which is much smaller, as mentioned. You might get lucky and 3.5 (which is the first release with a client framework) will be out of beta by the time you release.
|
# ? Jul 15, 2008 06:28 |
|
|
# ? Jun 10, 2024 15:17 |
|
Um... I feel dumb asking this but... how do I get the borders around the tabs from ajax toolkit encompass something that is wider then the page? After years of writing c and python for research purposes I somehow find myself in a ASP.NET developer position. I haven't even owned a windows box in several years.
|
# ? Jul 15, 2008 08:47 |
|
tsunami posted:I've never actually done this on an ASP.NET page so I'm not sure if it's any different, but I have done it with sockets. Anyway, could you spawn three threads that do the DB work and as they return, asynchronously update the page? Something similar to this: http://msdn.microsoft.com/en-us/library/3dasc8as.aspx. Although in that example they wait for all the threads to finish before displaying the results, while, as you said, you'd want to update the page immediately one by one as they finish. Yeah, getting the info out of the database isn't the issue, it's the live updating of the page as the slower responses come back to the user.
|
# ? Jul 15, 2008 08:48 |
|
MORE CURLY FRIES posted:Yeah, getting the info out of the database isn't the issue, it's the live updating of the page as the slower responses come back to the user. I think before AJAX if I wanted something AJAXy to tell the user to wait while we're retrieving data, I'd make use of the Response object. code:
|
# ? Jul 15, 2008 17:23 |
|
Fiend posted:I think before AJAX if I wanted something AJAXy to tell the user to wait while we're retrieving data, I'd make use of the Response object. dwazegek posted:Linq-to-Sql question: Can you show us the two different ways you are doing this in code and maybe we can find a place to make it go a little faster for you.
|
# ? Jul 15, 2008 18:45 |
|
Fastbreak posted:The extender might work, but I am not sure about the response object. My first thought would be to have the 3 threads going and raise events as each one ends, which would update your page that checks every second or so for the status of the search. Make sense? Yeah I think this is heading in the direction that I'm wanting to go, I'll look into it next time I get a minute. Cheers!
|
# ? Jul 15, 2008 18:51 |
|
I need a factory to create a bunch of objects. The way I'd like to do this is to have a static interface that can be implemented, have my factory find all instances of this interface in the Assembly, iterate through them and call the one that can handle the creation. Something likecode:
|
# ? Jul 15, 2008 20:55 |
|
fankey posted:I need a factory to create a bunch of objects. The way I'd like to do this is to have a static interface that can be implemented, have my factory find all instances of this interface in the Assembly, iterate through them and call the one that can handle the creation. I'm pretty new to C#, so take this with a grain of salt. I ran into a similar situation and ended up with code like this: code:
|
# ? Jul 15, 2008 21:16 |
|
Can static methods be overriden? If so, the methods can go in an abstract base class, and your objects that would have implemented ICreator can extend BaseCreator instead. edit: Instead of searching for all instances of an interface, you could also decorate the classes which have those methods with an attribute. You wouldn't have the compile time verification, but the iterating part would be the same.
|
# ? Jul 15, 2008 21:17 |
|
csammis posted:Can static methods be overriden? Nope.
|
# ? Jul 15, 2008 21:26 |
|
Two [likely stupid] questions. 1) Can someone point me in the right direction on having a WPF/C# application minimize to the task-tray? I cant seem to find it. 2) And what about having a C# function in an application run at a set time of day? I want to run scheduledTaskFunction() at 4pm every day, for example. Any tips or resources?
|
# ? Jul 15, 2008 21:43 |
|
Kekekela posted:Nope. Didn't think so Walked posted:Two [likely stupid] questions. There is no notification icon control for WPF. You'll have to use the Winforms class NotifyIcon to present a tray icon, and like any application you'll have to code the "hide on minimize / show on icon click" logic yourself. quote:2) And what about having a C# function in an application run at a set time of day? I want to run scheduledTaskFunction() at 4pm every day, for example. Any tips or resources? Your best bet, honestly, is to use the Windows Task Scheduler to run your application when you want it. Otherwise you'll just have to have a thread wake up every few seconds, see if it's 4PM, if it is do something and otherwise go back to sleep.
|
# ? Jul 15, 2008 22:03 |
|
csammis posted:Didn't think so Going to need to keep the application running rather than task scheduler (at least I'd HEAVILY prefer to do so. Sleep / wake / check is fine I suppose, I'll have to look into that. Sucks about the Tray icon, fortunately it is not vital or really even that important
|
# ? Jul 15, 2008 22:24 |
|
csammis posted:Otherwise you'll just have to have a thread wake up every few seconds, see if it's 4PM, if it is do something and otherwise go back to sleep. edit: and then reset the timer at 4PM for the next day in case the user keeps the app open, obviously.
|
# ? Jul 15, 2008 22:25 |
|
DLCinferno posted:Huh? That seems like a fairly obtuse way of doing it. If you did want to do it in your app, I'd suggest using a timer class (there's a couple - System.Threading.Timer, System.Timer, System.Windows.Forms.Timer). When your app opens, just calculate the length of time between the current system time and 4PM, then set the timer to fire in that amount of time. Awesome! Even better and ought to be rather simple to do.
|
# ? Jul 15, 2008 22:31 |
|
Walked posted:Sucks about the Tray icon, fortunately it is not vital or really even that important 1) Drag-and-drop the notifyIcon to your form. 2) Double-click on notifyIcon and in the method add: code:
code:
edit: I just tried it and double-clicking on the notify icon actually adds a handler for a double-click in the app (unlike most forms controls which add a single-click handler. Regardless, just add subscribe to the MouseClick instead of MouseDoubleClick. Didn't want to confuse you with poor instructions. DLCinferno fucked around with this message at 22:44 on Jul 15, 2008 |
# ? Jul 15, 2008 22:37 |
|
csammis posted:edit: Instead of searching for all instances of an interface, you could also decorate the classes which have those methods with an attribute. You wouldn't have the compile time verification, but the iterating part would be the same.
|
# ? Jul 15, 2008 22:56 |
|
DLCinferno posted:It's really easy to implement: Yes, in Winforms, but he asked about WPF. quote:Huh? That seems like a fairly obtuse way of doing it. I don't know what I was thinking with the polling idea, but timers are going to drift over timespans that long. It's not a great solution. csammis fucked around with this message at 23:16 on Jul 15, 2008 |
# ? Jul 15, 2008 23:08 |
|
DLCinferno posted:Huh? That seems like a fairly obtuse way of doing it. If you did want to do it in your app, I'd suggest using a timer class (there's a couple - System.Threading.Timer, System.Timer, System.Windows.Forms.Timer). When your app opens, just calculate the length of time between the current system time and 4PM, then set the timer to fire in that amount of time. Nothing too significant, but over time it adds up. Also, System.Threading is the best timer to use. If you do a search on the various timers, you should find comparisons that suggest the same. Practically speaking, though, none of these timers is really designed to work over intervals that large. I've made timers work over that interval, but you have to put in some extra work to make sure things run smooth.
|
# ? Jul 15, 2008 23:14 |
|
csammis posted:Yes, in Winforms, but he asked about WPF. csammis posted:I don't know what I was thinking with the polling idea, but timers are going to drift over timespans that long. It's not a great solution. genki posted:Practically speaking, though, none of these timers is really designed to work over intervals that large. I've made timers work over that interval, but you have to put in some extra work to make sure things run smooth. I mean, how else do you guys recommend doing scheduling?
|
# ? Jul 15, 2008 23:31 |
|
DLCinferno posted:Hmm, I haven't really had problems when I've done it in the past. But if you do find it drifting or something, just set the timer for 1 hour or the time until 4pm, whichever is shorter. Then every time it fires, check if it's actually 4pm, otherwise reset the timer again. If it's still drifting, use 1min intervals or something.
|
# ? Jul 15, 2008 23:53 |
|
genki posted:You can set it for intervals that large, but rather than just saying "add 24 hours", you have to say "add 24 hours to this time then see how far off the target time it is then adjust the interval by that amount". code:
|
# ? Jul 16, 2008 00:41 |
|
sure it's small! As long as you're aware of the issue it isn't a huge deal to work around it. I'm not sure what your point is... when I said extra work, I didn't mean it was unnecessarily huge, I just meant you can't assume adding 1 day will correctly give you 4pm every day for a year. The timers aren't exact and will give you anomalous results if you assume they are.
|
# ? Jul 16, 2008 01:07 |
|
genki posted:sure it's small! As long as you're aware of the issue it isn't a huge deal to work around it. I'm not sure what your point is... when I said extra work, I didn't mean it was unnecessarily huge, I just meant you can't assume adding 1 day will correctly give you 4pm every day for a year. The timers aren't exact and will give you anomalous results if you assume they are.
|
# ? Jul 16, 2008 01:15 |
|
fankey posted:I need a factory to create a bunch of objects. The way I'd like to do this is to have a static interface that can be implemented, have my factory find all instances of this interface in the Assembly, iterate through them and call the one that can handle the creation. It's possible to do this. I suggest you look at Windsor container (http://www.castleproject.org/container/index.html). You can use it for inversion of control: code:
To relate it more directly to what you are asking for, the Windor container can be configured to return a newly-created object each time Resolve is called, and you can configure the manor of the object creation. So the IoC can act as your factory. You simply pass the type of object you want created into Resolve.
|
# ? Jul 16, 2008 01:56 |
|
What is the most painless way to display 3d objects with C#? It doesn't have to do anything fancy like textures, fullscreen or even be hardware accelerated. All I need is the ability to enter 3d triangles with colors and project them into 3d with the least overhead possible. I had Direct3d working with managed C++ once, but I can't seem to transfer it over to C#, and the documentation isn't helping. When I look online there seems to be a million engines, and they're all way more than I need.
|
# ? Jul 16, 2008 02:25 |
|
DLCinferno posted:Ahh, I did miss that but you can just use the Winforms one. Add a reference to System.Windows.Forms and one to System.Drawing (for the icon). Works in my test WPF app... DLCinferno, can you send me the test wpf app source in a rar so I can take a quick peek at it? I'm trying to wrap my head around how to use both winforms (havent touched before) and WPF at the same time. Setash@gmail.com If not, no big deal - I am playing around with it and think I can get it together on my own with enough time
|
# ? Jul 16, 2008 04:05 |
|
Walked posted:DLCinferno, can you send me the test wpf app source in a rar so I can take a quick peek at it? I'm trying to wrap my head around how to use both winforms (havent touched before) and WPF at the same time. (To add the reference, it's easy, just go to the Solution Explorer, right-click on References, and from the .NET tab add both System.Windows.Forms and System.Drawing) I'd be happy to help/answer any other questions if I can. Here's the rar (I deleted the actual icon because it was licensed). code:
|
# ? Jul 16, 2008 05:36 |
|
HappyHippo posted:What is the most painless way to display 3d objects with C#? It doesn't have to do anything fancy like textures, fullscreen or even be hardware accelerated. All I need is the ability to enter 3d triangles with colors and project them into 3d with the least overhead possible. http://www.codeproject.com/KB/WPF/Wpf3DPrimer.aspx
|
# ? Jul 16, 2008 05:38 |
|
"genki posted:sure it's small! As long as you're aware of the issue it isn't a huge deal to work around it. I'm not sure what your point is... when I said extra work, I didn't mean it was unnecessarily huge, I just meant you can't assume adding 1 day will correctly give you 4pm every day for a year. The timers aren't exact and will give you anomalous results if you assume they are. If anyone does have a better solution I would actually really like to know because I'm currently working on a project that requires an index rebuild once a night, currently kicked off by a timer.
|
# ? Jul 16, 2008 06:02 |
|
MORE CURLY FRIES posted:Yeah, getting the info out of the database isn't the issue, it's the live updating of the page as the slower responses come back to the user. I'd try splitting this up: one page that is shown to the user, and three that are basically just XML with the data. Using Javascript and a HttpRequest thingie, you can do the requests for data, and attach a callback function to each request. When the data is ready, use Javascript to show it to the user. This is basically Ajax, but done in a rather manual way.
|
# ? Jul 16, 2008 10:03 |
|
DLCinferno posted:It would be no problem, but to be honest, I know jack-all about WPF, although I consider myself mildly experienced in Winforms. Anyway, here's how I did the NotifyIcon in the WPF test app... Hey, thank you very much, this should get me going and do what I need I appreciate it.
|
# ? Jul 16, 2008 13:52 |
|
HappyHippo posted:What is the most painless way to display 3d objects with C#? It doesn't have to do anything fancy like textures, fullscreen or even be hardware accelerated. All I need is the ability to enter 3d triangles with colors and project them into 3d with the least overhead possible.
|
# ? Jul 16, 2008 19:43 |
|
Has anyone used Ruby.NET and would like to share their experience? EDIT: Or IronRuby. Smugdog Millionaire fucked around with this message at 21:39 on Jul 16, 2008 |
# ? Jul 16, 2008 21:13 |
|
Free Bees posted:Has anyone used Ruby.NET and would like to share their experience? I was under the impression it was being abandoned since IronRuby made more sense once the DLR gained traction.
|
# ? Jul 16, 2008 21:27 |
|
Kekekela posted:I was under the impression it was being abandoned since IronRuby made more sense once the DLR gained traction.
|
# ? Jul 16, 2008 21:40 |
|
DLCinferno posted:I found this demo amazingly simple, definitely sparked my interest in WPF, and it's probably worth a look for you. Exactly what I wanted, thank you.
|
# ? Jul 16, 2008 21:42 |
|
Is there any way to see parameter values for methods from the call stack? The use would be in a ThreadException handler, where I can capture any unhandled exceptions in the application and build a custom error report. I can easily use StackTrace for method names, line numbers, etc, but it would really be ace if I could also include parameter values in the report. An initial google indicates that this isn't possible, but I'd love to hear ideas...I can't think of anything besides a logging function called at the beginning of every method that would manually log each parameter value. I really don't want to have to do this, though, if there's a simple solution with Reflection magic or something.
|
# ? Jul 16, 2008 22:54 |
|
code:
Which is great, I even caught the exception where if its not a valid hoestname, it says so. HOWEVER, I still get an exception if the hostname is valid, it has a DNS record, but it times out on the ping - so in the event it can be queried in DNS (or host file), but doesnt reply to a ping, I'm screwed. How can I get the IP address that it send the ping to, in the event it doesnt reply (so I can see where it is going) Half the point of this app is to take note of the IP address a hostname resolves to but does not reply to from edit: full code - please, I know its bad, I've been playing with solutions to make it work, I'll clean it up when I get the right results: code:
Walked fucked around with this message at 02:14 on Jul 17, 2008 |
# ? Jul 17, 2008 02:01 |
|
|
# ? Jun 10, 2024 15:17 |
|
Walked posted:How can I get the IP address that it send the ping to, in the event it doesnt reply (so I can see where it is going) Can't you just call Dns.GetHostAddresses? Fastbreak posted:Can you show us the two different ways you are doing this in code and maybe we can find a place to make it go a little faster for you. code:
The linq solution I posted is much slower, probably because it first pulls an item from the database, then issues a seperate delete command for that item. It doesn't really seem to matter if I change it to collect all the items first and then call DeleteAllOnSubmit. Anyway, it's not really important, I just finished moving our entire database communication to linq-to-sql, and this is the last thing that didn't make the move, so it's more for completeness' sake.
|
# ? Jul 17, 2008 08:20 |