Skip to content

Commit

Permalink
Disabled node preview for now
Browse files Browse the repository at this point in the history
  • Loading branch information
arnab-sen committed Jan 13, 2021
1 parent bebc32c commit 83744e3
Show file tree
Hide file tree
Showing 3 changed files with 121 additions and 26 deletions.
1 change: 1 addition & 0 deletions ALACore/ALACore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@
<Compile Include="DomainAbstractions\MouseWheelEvent.cs" />
<Compile Include="DomainAbstractions\MultiMenu.cs" />
<Compile Include="DomainAbstractions\ObjectFactory.cs" />
<Compile Include="DomainAbstractions\PopupBox.cs" />
<Compile Include="DomainAbstractions\Scale.cs" />
<Compile Include="DomainAbstractions\SimulateKeyboard.cs" />
<Compile Include="DomainAbstractions\Stopwatch.cs" />
Expand Down
63 changes: 63 additions & 0 deletions ALACore/DomainAbstractions/PopupBox.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using Libraries;
using ProgrammingParadigms;

namespace DomainAbstractions
{
/// <summary>
/// A popup that appears above all other elements.
/// </summary>
public class PopupBox : IEvent // toggle
{
// Public fields and properties
public string InstanceName { get; set; } = "Default";
public Func<UIElement> GetPlacementObject { get; set; }
public PlacementMode PlacementMode { get; set; } = PlacementMode.MousePoint;

// Private fields
private Popup _popup = new Popup()
{
StaysOpen = true
};
private UIElement _childContent = null;

// Ports
private IUI child;

// IEvent implementation
void IEvent.Execute()
{
if (!_popup.IsOpen)
{
if (_childContent == null && child != null)
{
_childContent = child.GetWPFElement();
_popup.Child = _childContent;
}

if (GetPlacementObject != null) _popup.PlacementTarget = GetPlacementObject();
_popup.Placement = PlacementMode;
_popup.IsOpen = true;
_popup.PlacementRectangle = new Rect(new Point(), new Point(10, 10));
}
else
{
_popup.IsOpen = false;
}
}

// Methods

public PopupBox()
{

}
}
}
Loading

0 comments on commit 83744e3

Please sign in to comment.