Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DependencyProperty value inheritance
Message
From
12/06/2009 07:41:35
 
 
General information
Forum:
ASP.NET
Category:
Windows Presentation Foundation (WPF)
Environment versions
Environment:
C# 3.0
Miscellaneous
Thread ID:
01405435
Message ID:
01405448
Views:
34
>>I would if I could - you're way ahead
>
>Not far enough :-{
>I've solved it for now by changing the command handler that I use to set ControlMode from a context menu. e.g.:
void cbEditData_Executed(object sender, ExecutedRoutedEventArgs e)
>{
>     LLCanvas lla = MethodToGrabCurrentCanvas();
>     MenuItem mi = e.Parameter as MenuItem;
>     if (mi != null)
>     {
>          if (mi.IsChecked)
>               lla.ControlMode = ControlMode.DataEdit;
>          else
>              ((DependencyObject)lla).ClearValue(CMProp.ControlModeProperty);
>    }
>}
but it feels like a kludge - there should be some way of doing this within the dependency property callbacks......

As I said, you're way ahead

On a side note...

I've been chewing on the design of an abstract class + (generics, Interfaces, ...) that would do a search

First two simple subclasses I would implement are a Blind Depth First Search and a Blind Breadth First Search
[ there are more sophisticated search algorithms. Heuristic searches, bidirectional searches, ...]

The aim is to take the algorithms out of sight - ie write the class once and reuse them afterwards

The input for a simple blind search algorithm is

(1) a start State (TState is a generic type)
(2) an Expand() delegate which expand a give state and give a list/queue/whatever back of all the successors
Each of the expanded states indicate whether that state is a goal state
(3) Max Depth of the search
(4) max time to spend on the search
(5) an event handler (called for each solution = goal state) that accepts an eventhandler class comprising
- a bool Cancel (if set to true, the search terminates)
- a queue with all the state transitions (= solution path) from the initial state to the goal state

So, such an object would search the solution space (calling Expand()) and 'raise' an event for each solution found.
You can continue the search if you are intrested in all the possibilities

Next step would be to put that in a separate thread which you can pause/resume/abort



Interested in reviewing the code/design once I get that far [without the separate thread] ?
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform