Merge pull request #4 from matthewrdev/master
Support SkiaFiddle in Visual Studio 8.5
This commit is contained in:
Коммит
753198f06e
|
@ -250,3 +250,6 @@ paket-files/
|
|||
# JetBrains Rider
|
||||
.idea/
|
||||
*.sln.iml
|
||||
|
||||
# MFractor
|
||||
.mfractor/
|
||||
|
|
|
@ -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,11 +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);
|
||||
IdeApp.Workbench.OpenDocument(skiaSharpFiddleView, true);
|
||||
var pad = GetActivePad();
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -3,8 +3,7 @@
|
|||
<TargetFramework>net461</TargetFramework>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MonoDevelop.Addins" Version="0.4.4" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="2.10.0" />
|
||||
<PackageReference Include="MonoDevelop.Addins" Version="0.4.7" />
|
||||
<PackageReference Include="SkiaSharp" Version="1.68.0" />
|
||||
<PackageReference Include="SkiaSharp.Views" Version="1.68.0" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace VS4Mac.SkiaSharpFiddle.Views
|
|||
|
||||
}
|
||||
|
||||
public class SkiaSharpFiddleView : AbstractXwtViewContent, ISkiaSharpFiddleView
|
||||
public class SkiaSharpFiddleView : PadContent, ISkiaSharpFiddleView
|
||||
{
|
||||
static readonly SKColor PaneColor = 0xFFF5F5F5;
|
||||
static readonly SKColor AlternatePaneColor = 0xFFF0F0F0;
|
||||
|
@ -55,25 +55,9 @@ namespace VS4Mac.SkiaSharpFiddle.Views
|
|||
Init();
|
||||
BuildGui();
|
||||
AttachEvents();
|
||||
}
|
||||
}
|
||||
|
||||
public override Xwt.Widget Widget => _control;
|
||||
|
||||
public override bool IsViewOnly
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool IsFile
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public override Control Control => _control;
|
||||
|
||||
void Init()
|
||||
{
|
||||
|
@ -149,8 +133,6 @@ namespace VS4Mac.SkiaSharpFiddle.Views
|
|||
|
||||
void BuildGui()
|
||||
{
|
||||
ContentName = "SkiaSharp Fiddle";
|
||||
|
||||
_headerBox.PackStart(_widthLabel, false, false, 0);
|
||||
_headerBox.PackStart(_widthEntry, false, false, 0);
|
||||
_headerBox.PackStart(_heightLabel, false, false, 0);
|
||||
|
|
Загрузка…
Ссылка в новой задаче