Hello.
I create simple windows form application in powershell
Add-Type -AssemblyName System.Windows.Forms
$Form = New-Object system.Windows.Forms.Form
$Form.ShowDialog()
How to add this code to it?
In C# windows form application it look's like that:
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Timers;
using System.Windows.Forms;
using System;
namespace WindowsFormsApp1Csh
{
public partial class Form1 : Form
{
private void Form1_Load(object sender, EventArgs e)
{
t = new System.Timers.Timer();
t.Interval = 10;
t.Elapsed += OnTimeEvent;
t.Start();
}
private void OnTimeEvent(object sender, ElapsedEventArgs e)
{
Invoke(new Action(() =>
{
Console.WriteLine("Hello");
}));
}
}
Can i semohow create a public void metho or something like that?
Thanks for help.
Yes compared to using Visual Studio the use of a plain editor (including Visual Studio Code for this) and command-line compiling would be inconvenient in many ways. Compared to using PowerShell it would be easier, such as the source code would be the same as if Visual Studio were used whereas with PowerShell the source code is different.