scripts moved from wiki to folder
This commit is contained in:
@@ -47,11 +47,6 @@ namespace mpvnet
|
|||||||
case "add-files-to-playlist": OpenFiles("append"); break; // deprecated 2019
|
case "add-files-to-playlist": OpenFiles("append"); break; // deprecated 2019
|
||||||
default: Msg.ShowError($"No command '{id}' found."); break;
|
default: Msg.ShowError($"No command '{id}' found."); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
MainForm.Instance.BeginInvoke(new Action(() => {
|
|
||||||
Message m = new Message() { Msg = 0x0202 }; // WM_LBUTTONUP
|
|
||||||
WinAPI.SendMessage(MainForm.Instance.Handle, m.Msg, m.WParam, m.LParam);
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void InvokeOnMainThread(Action action) => MainForm.Instance.Invoke(action);
|
public static void InvokeOnMainThread(Action action) => MainForm.Instance.Invoke(action);
|
||||||
|
|||||||
@@ -715,6 +715,13 @@ namespace mpvnet
|
|||||||
ShownTickCount = Environment.TickCount;
|
ShownTickCount = Environment.TickCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnActivated(EventArgs e)
|
||||||
|
{
|
||||||
|
base.OnActivated(e);
|
||||||
|
Message m = new Message() { Msg = 0x0202 }; // WM_LBUTTONUP
|
||||||
|
WinAPI.SendMessage(MainForm.Instance.Handle, m.Msg, m.WParam, m.LParam);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnResize(EventArgs e)
|
protected override void OnResize(EventArgs e)
|
||||||
{
|
{
|
||||||
base.OnResize(e);
|
base.OnResize(e);
|
||||||
|
|||||||
26
scripts/examples/key-binding.cs
Normal file
26
scripts/examples/key-binding.cs
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
using mpvnet;
|
||||||
|
|
||||||
|
class Script
|
||||||
|
{
|
||||||
|
public Script()
|
||||||
|
{
|
||||||
|
string content = "ctrl+ö script-message my-message-1 my-argument-1";
|
||||||
|
string sectionName = Assembly.GetExecutingAssembly().GetName().Name;
|
||||||
|
mp.commandv("define-section", sectionName, content, "force");
|
||||||
|
mp.commandv("enable-section", sectionName);
|
||||||
|
mp.ClientMessage += ClientMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ClientMessage(string[] args)
|
||||||
|
{
|
||||||
|
switch (args[0])
|
||||||
|
{
|
||||||
|
case "my-message-1":
|
||||||
|
Msg.Show(args[1]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
17
scripts/examples/observe-property-and-draw-text-on-screen.cs
Normal file
17
scripts/examples/observe-property-and-draw-text-on-screen.cs
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
|
||||||
|
// Draws text on screen when full screen property changes.
|
||||||
|
|
||||||
|
using mpvnet;
|
||||||
|
|
||||||
|
class Script
|
||||||
|
{
|
||||||
|
public Script()
|
||||||
|
{
|
||||||
|
mp.observe_property_bool("fullscreen", FullscreenChange);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FullscreenChange(bool value)
|
||||||
|
{
|
||||||
|
mp.commandv("show-text", "fullscreen: " + value.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user