This commit is contained in:
Matthew Robbins 2020-04-13 18:56:07 +10:00
Родитель 3247581d45
Коммит dd21069015
2 изменённых файлов: 43 добавлений и 7 удалений

Просмотреть файл

@ -1,5 +1,8 @@
using MonoDevelop.Components.Commands;
using System;
using System.Linq;
using MonoDevelop.Components.Commands;
using MonoDevelop.Ide;
using MonoDevelop.Ide.Gui;
using VS4Mac.SkiaSharpFiddle.Controllers;
using VS4Mac.SkiaSharpFiddle.Views;
@ -7,12 +10,48 @@ namespace VS4Mac.SkiaSharpFiddle.Commands
{
public class SkiaSharpFiddleCommand : CommandHandler
{
const string PadId = "SkiaSharpFiddler.Pad";
protected override void Run()
{
var skiaSharpFiddleView = new SkiaSharpFiddleView();
var skiaSharpFiddleController = new SkiaSharpFiddleController(skiaSharpFiddleView);
var pad = GetActivePad();
IdeApp.Workbench.ShowPad(skiaSharpFiddleView, "SkiaFiddle.Pad", "SkiaFiddle", "Right", null);
if (pad == null)
{
var skiaSharpFiddleView = new SkiaSharpFiddleView();
var skiaSharpFiddleController = new SkiaSharpFiddleController(skiaSharpFiddleView);
pad = IdeApp.Workbench.ShowPad(skiaSharpFiddleView, PadId, "SkiaSharp Fiddler", "Center", null);
if (pad == null)
{
return;
}
}
pad.Sticky = true;
pad.AutoHide = false;
pad.BringToFront();
}
public static bool IsPadOpen()
{
return GetActivePad() != null;
}
public static Pad GetActivePad()
{
var pads = IdeApp.Workbench.Pads;
foreach (var pad in pads)
{
if (string.Equals(pad.Id, PadId, StringComparison.OrdinalIgnoreCase))
{
return pad;
}
}
return null;
}
}
}

Просмотреть файл

@ -11,9 +11,6 @@ using SkiaSharp.Views.Gtk;
using VS4Mac.SkiaSharpFiddle.Controllers;
using VS4Mac.SkiaSharpFiddle.Controllers.Base;
using VS4Mac.SkiaSharpFiddle.Views.Base;
using MonoDevelop.Components;
using MonoDevelop.Ide;
using MonoDevelop.Ide.Gui;
namespace VS4Mac.SkiaSharpFiddle.Views
{