diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-07-08 17:55:46 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-07-08 17:55:46 +0300 |
| commit | 36d1edb4f9cc4fbd9c134d3b387bcfec05424537 (patch) | |
| tree | 4f780184ad9d41c0ab84637116c06bcff4c1cb67 /Software/Visual_Studio/PPC/Tango.PPC.Common/Controls | |
| parent | a2cf6c8d62083a63ee193a1cd206ab345368b242 (diff) | |
| download | Tango-36d1edb4f9cc4fbd9c134d3b387bcfec05424537.tar.gz Tango-36d1edb4f9cc4fbd9c134d3b387bcfec05424537.zip | |
Doing some work on PPC + Mirta integration.
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/Controls')
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/AsyncAdornerControl.cs | 48 | ||||
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml.cs | 3 |
2 files changed, 10 insertions, 41 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/AsyncAdornerControl.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/AsyncAdornerControl.cs index b20e93ff9..36779c571 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/AsyncAdornerControl.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/AsyncAdornerControl.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Runtime.InteropServices; using System.Text; @@ -23,39 +24,11 @@ namespace Tango.PPC.Common.Controls public partial class AsyncAdornerControl : ContentControl { private bool _loaded; - - public enum GWL - { - ExStyle = -20 - } - - public enum WS_EX - { - Transparent = 0x20, - Layered = 0x80000 - } - - public enum LWA - { - ColorKey = 0x1, - Alpha = 0x2 - } - - [DllImport("user32.dll", EntryPoint = "GetWindowLong")] - public static extern int GetWindowLong(IntPtr hWnd, GWL nIndex); - - [DllImport("user32.dll", EntryPoint = "SetWindowLong")] - public static extern int SetWindowLong(IntPtr hWnd, GWL nIndex, int dwNewLong); - - [DllImport("user32.dll", EntryPoint = "SetLayeredWindowAttributes")] - public static extern bool SetLayeredWindowAttributes(IntPtr hWnd, int crKey, byte alpha, LWA dwFlags); - private Window _window; public AsyncAdornerControl() { Loaded += AsyncAdornerControl_Loaded; - LayoutUpdated += AsyncAdornerControl_LayoutUpdated; IsVisibleChanged += AsyncAdornerControl_IsVisibleChanged; } @@ -71,11 +44,6 @@ namespace Tango.PPC.Common.Controls } } - private void AsyncAdornerControl_LayoutUpdated(object sender, EventArgs e) - { - SyncBounds(); - } - public Type ViewType { get { return (Type)GetValue(ViewTypeProperty); } @@ -94,6 +62,8 @@ namespace Tango.PPC.Common.Controls { if (!this.IsInDesignMode()) { + var startTime = Process.GetCurrentProcess().StartTime; + if (_loaded) return; _loaded = true; @@ -111,6 +81,11 @@ namespace Tango.PPC.Common.Controls Thread thread = new Thread(() => { + if (DateTime.Now < startTime.AddSeconds(5)) + { + Thread.Sleep(5000); + } + _window = new Window(); _window.WindowStyle = WindowStyle.None; _window.ResizeMode = ResizeMode.NoResize; @@ -129,8 +104,6 @@ namespace Tango.PPC.Common.Controls _window.ShowActivated = false; - //FrameworkElement element = Activator.CreateInstance(type) as FrameworkElement; - var cloned = FrameworkElementSerializer.Deserialize(xaml); cloned.DataContext = dc; @@ -138,11 +111,6 @@ namespace Tango.PPC.Common.Controls _window.Show(); - int wl = GetWindowLong(handle, GWL.ExStyle); - wl = wl | 0x80000 | 0x20; - SetWindowLong(handle, GWL.ExStyle, wl); - SetLayeredWindowAttributes(handle, 0, 128, LWA.Alpha); - SyncBounds(); System.Windows.Threading.Dispatcher.Run(); diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml.cs index f2a90a454..6df09856e 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml.cs @@ -39,7 +39,8 @@ namespace Tango.PPC.Common.Controls { InitializeComponent(); - Loaded += TwineCatalogControl_Loaded; + list.ApplyTemplate(); + list.Loaded += TwineCatalogControl_Loaded; DataContextChanged += (x, y) => { _catalog = DataContext as Catalog; |
