Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚀 Feature request: C# code base #8

Open
megastary opened this issue Aug 26, 2021 · 2 comments
Open

🚀 Feature request: C# code base #8

megastary opened this issue Aug 26, 2021 · 2 comments
Assignees
Labels
core functionality A functionality that needs to be implemented enhancement New feature or request

Comments

@megastary
Copy link
Member

Is your feature request related to a problem? Please describe.
The code base can quickly grow into unreadable mess.

Describe the solution you'd like
Design basic structure and document it.

  • MainWindow
    • initializes XAML window
    • initializes WebView handler
    • Initializes PowerShell handler
  • PowerShelllManager
    • Contains class to ReceiveMessage from WebViewManager WebMessageReceived event
      • Based on type of the message
      • Start execution of new PowerShell command
      • Stops current PowerShell command execution
      • Maybe more functions later?
    • Contains reference to all currently running runspaces to be able to kill them
      • Runspace
        • Opens runspace
        • Creates PowerShell object
        • Adds command, parameters
        • Starts async execution
          • Saves reference as UID <-> ProcessId so javascript can refer to it by uid
        • Creates output
        • Hooks event to output dataAdded
          • event either sends data as it receives it to WebView here
          • May at least send number of rows (objects) received status to WebView
        • Hooks event to InvocationStateChanged
          • or event sends data as whole to WebView here
          • Changes status icon of task - running, failed, completed...
        • awaits async result
        • Sends final data to WebView - execution time, data ....
  • WebViewManager
    • Contains method to show alert message - simple string
    • Contains method to send generic JSON as string
    • Contains method to initialize WebView - load correct page, hook up events
@megastary megastary added the enhancement New feature or request label Aug 26, 2021
@megastary megastary self-assigned this Aug 26, 2021
@megastary megastary added the core functionality A functionality that needs to be implemented label Aug 26, 2021
@megastary
Copy link
Member Author

megastary commented Aug 26, 2021

Data sent from javascript will be parsed by PowerShellService ReceiveMessage method

  • Checks if token is valid
  • Based on the data decide what to do next
    • Execute new command - save ref to uid and start executing
    • Kill execution - by uid find process and stop it

Data sent from PowerShell will be serialized to JSON string and sent to WebView to be parsed by javascript

  • Based on type update execution status

  • Based on type receive data

  • Data sent from WebView will be of type WebViewMessage

  • Data sent from PowerShell will be of type PowerShellMessage

megastary added a commit that referenced this issue Aug 26, 2021
megastary added a commit that referenced this issue Aug 26, 2021
@megastary
Copy link
Member Author

megastary commented Aug 28, 2021

We will try to implement whole
https://github.com/DotNetAnalyzers/StyleCopAnalyzers

As this is our first bigger C# project, we will be grateful for having strict rules for code writing.

megastary added a commit that referenced this issue Aug 29, 2021
Working towards implementing proper manager, which utilizes service and provider.
megastary added a commit that referenced this issue Aug 29, 2021
megastary added a commit that referenced this issue Aug 30, 2021
Moving startup code for WebView to provider with proper error handling
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core functionality A functionality that needs to be implemented enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant