Working on power button for Android device.

This commit is contained in:
Lars Brubaker 2017-03-03 16:31:25 -08:00
parent 8be2e81d6e
commit 3dc0381d46
3 changed files with 16 additions and 0 deletions

View file

@ -100,6 +100,11 @@ namespace MatterHackers.MatterControl
public static bool IsLoading { get; private set; } = true;
public static void RequestPowerShutDown()
{
// does nothing on windows
}
static MatterControlApplication()
{
if (OsInformation.OperatingSystem == OSType.Mac && StaticData.Instance == null)

View file

@ -34,6 +34,8 @@ using MatterHackers.Agg.UI;
using MatterHackers.Localizations;
using MatterHackers.MatterControl.PrinterCommunication;
using MatterHackers.MatterControl.CustomWidgets;
using MatterHackers.Agg.PlatformAbstract;
using MatterHackers.Agg.ImageProcessing;
namespace MatterHackers.MatterControl
{
@ -56,6 +58,15 @@ namespace MatterHackers.MatterControl
footerRow.AddChild(cancelButton);
cancelButton.Text = "Back".Localize();
#if ANDROID_T7X
headerRow.AddChild(new HorizontalSpacer());
var powerImage = StaticData.Instance.LoadIcon("power.png", 24, 24);
var powerButton = new TextImageButtonFactory() { FixedHeight = 32, Margin = new BorderDouble(0), borderWidth = 0 }.GenerateTooltipButton("", powerImage);
powerButton.Click += (s, e) => MatterControlApplication.RequestPowerShutDown();
powerButton.VAnchor |= VAnchor.ParentCenter;
headerRow.AddChild(powerButton);
#endif
}
}

BIN
StaticData/Icons/power.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB