Falco
Explore posts from serversDid I implement State Machine Pattern correctly?
Im trying to implement State Machine Pattern for the state of a form, but I feel like it's not right or adding any convenience.
Context:
User fills in a form on my webpage. User then saves the form. Upon saving, the form should get one of the following states:
The state of a form is defined by business rules. For example:
I made an attempt to make a state machine pattern, but I can't seem to understand why it's useful. So maybe im not doing it correctly. Tips are very welcome.
How I implemented the State Machine Pattern:
FormStateService.cs
FormState.cs:
Each State has its own class like this with the business rules defined. For example this is what each stateclass looks like.
WaitForApprovalManagerState.cs
1 replies
How to refer to the mainwindow class from another class.
Creating a WPF app. I have one main class where all the mainwindow controls are operated.
I have a different class that's called FilterManager. In this class I want to operate some data on the mainwindow as well. But I'm not sure how, what's a clean way to refer to the mainwindow from this class?
5 replies
How to create a hotkey so the user can stop/pause the program.
I created a WPF app that automates mouse movements. When the program is active the user cannot press the stop button since the mouse is being used. How do I create a hotkey that can be pressed and stop the programming.
I searched the internet and I found 2 options, but I don't know which is best
1. Use a side thread for the program and a main thread that listens for any hotkeys. Then the main thread either pauses or kills the side thread.
2. Use Task ? But I'm not sure how that works.
18 replies