public void TestBoxAddInstanceMethod()
 {
     var ft = new NativeHelper(0);
     dynamic ftx = Silver.Box(ft);
     [email protected]_me = CompileAndExecute("def add_me(num) { return num + @x; };");
     var ft2 = new NativeHelper(0);
     dynamic ftx2 = Silver.Box(ft2);
     ftx2.x = 15;
     Assert.That(ftx2.add_me(10), Is.EqualTo(25));
 }
        public void TestBox()
        {
            ScriptEngine engine = GetRuntime().GetEngine("IronSilver");
            ScriptSource defsource = engine.CreateScriptSourceFromString("ft.x = 15;");
            ScriptScope defscope = engine.CreateScope();

            var ft = new NativeHelper(22);
            defscope.SetVariable("ft", ft);
            defsource.Execute(defscope);
            dynamic ftx = Silver.Box(ft);
            Assert.That(ftx._fieldTest + ftx.x, Is.EqualTo(37));
        }
 public override string GetDisplayValue()
 {
     return(base.GetDisplayValue() + $" [{v_ClickButton} Click {NativeHelper.GetSearchNameValue(v_NativeSearchParameters)} - Instance Name '{v_InstanceName}']");
 }
        public async override Task RunCommand(object sender)
        {
            var engine        = (IAutomationEngineInstance)sender;
            var browserObject = ((OBAppInstance)await v_InstanceName.EvaluateCode(engine)).Value;
            var chromeProcess = (Process)browserObject;
            var vTimeout      = (int)await v_Timeout.EvaluateCode(engine);

            var vXAdjustment = (int)await v_XAdjustment.EvaluateCode(engine);

            var vYAdjustment = (int)await v_YAdjustment.EvaluateCode(engine);

            User32Functions.GetWindowRect(chromeProcess.MainWindowHandle, out Rect chromeRect);

            WebElement webElement = await NativeHelper.DataTableToWebElement(v_NativeSearchParameters, engine);

            webElement.Value = v_OpenLinkOptions;

            User32Functions.BringWindowToFront(chromeProcess.MainWindowHandle);

            string responseText;

            if ((v_ClickButton == "Left" || v_ClickButton == "Middle") && v_ClickType == "Simulate Click")
            {
                string clickButton = v_ClickButton.ToLower() + "click";
                NativeRequest.ProcessRequest(clickButton, JsonConvert.SerializeObject(webElement), vTimeout, out responseText);
                NativeResponse responseObject = JsonConvert.DeserializeObject <NativeResponse>(responseText);

                if (responseObject.Status == "Failed")
                {
                    throw new Exception(responseObject.Result);
                }

                if (v_OpenLinkOptions == "New Window" && v_ClickButton == "Left")
                {
                    //Create new browser
                    int chromeProcessCount = Process.GetProcessesByName("chrome").Length;
                    var process            = Process.Start("chrome.exe", responseObject.Result + " --new-window");

                    if (chromeProcessCount > 0)
                    {
                        while (process.HasExited == false)
                        {
                            Thread.Sleep(100);
                            process.Refresh();
                        }
                    }
                    //Delay 7 seconds
                    Thread.Sleep(7000);

                    Process[] procsChrome = Process.GetProcessesByName("chrome");

                    foreach (Process chrome in procsChrome)
                    {
                        // the chrome process must have a window
                        if (chrome.MainWindowHandle == IntPtr.Zero)
                        {
                            continue;
                        }

                        process = chrome;
                        break;
                    }

                    new OBAppInstance(v_NewInstanceName, process).SetVariableValue(engine, v_NewInstanceName);
                }
            }
            else
            {
                NativeRequest.ProcessRequest("getcoordinates", JsonConvert.SerializeObject(webElement), vTimeout, out responseText);
                NativeResponse responseObject = JsonConvert.DeserializeObject <NativeResponse>(responseText);

                if (responseObject.Status == "Failed")
                {
                    throw new Exception(responseObject.Result);
                }

                var screenPosition = responseObject.Result.Split(',');

                /* Following are the values returned from extension
                 * screenPosition[0] = element.left, screenPosition[1] = element.top,
                 * screenPosition[2] = element.width, screenPosition[3] = element.height,
                 * screenPosition[4] = chrome toolbar height */
                int xPosition = chromeRect.left + Convert.ToInt32(Convert.ToDouble(screenPosition[0])) + (Convert.ToInt32(Convert.ToDouble(screenPosition[2])) / 2) + vXAdjustment;
                int yPosition = chromeRect.top + Convert.ToInt32(Convert.ToDouble(screenPosition[1])) + Convert.ToInt32(Convert.ToDouble(screenPosition[4])) + (Convert.ToInt32(Convert.ToDouble(screenPosition[3])) / 2) + vYAdjustment;

                User32Functions.SetCursorPosition(xPosition, yPosition);

                if (v_ClickButton == "Left")
                {
                    User32Functions.SendMouseClick("Left Click", xPosition, yPosition);
                }
                else if (v_ClickButton == "Right")
                {
                    User32Functions.SendMouseClick("Right Click", xPosition, yPosition);
                }
                else
                {
                    User32Functions.SendMouseClick("Middle Click", xPosition, yPosition);
                }
            }
        }
Exemple #5
0
        /// <summary>
        /// Gets whether the window corresponding to the given hwnd has the given extended style flag.
        /// </summary>
        /// <param name="hwnd">The hwnd of the window.</param>
        /// <param name="flag">The flag to check.</param>
        /// <returns><c>True</c> if the window has the given flag, <c>False</c> otherwise.</returns>
        public static bool HasExStyleFlag(IntPtr hwnd, uint flag)
        {
            var style = NativeHelper.GetWindowLong(hwnd, NativeHelper.GWL_EXSTYLE);

            return(MatchFlag(style, flag));
        }
Exemple #6
0
 /// <summary>
 /// Sets the owner of the window corresponding to the given hwnd.
 /// </summary>
 /// <param name="hwnd">The hwnd of the window.</param>
 /// <param name="ownerHwnd">The hwnd of the owner window.</param>
 /// <remarks>Only top-level windows might owner. Owner of a window is also a top-level window.</remarks>
 public static void SetOwner(IntPtr hwnd, IntPtr ownerHwnd)
 {
     NativeHelper.SetWindowLong(new HandleRef(null, hwnd), NativeHelper.WindowLongType.HwndParent, ownerHwnd);
 }
Exemple #7
0
 /// <summary>
 /// Adds a custom message to the RealSense log.
 /// </summary>
 /// <param name="severity">The log level under which to write the message.</param>
 /// <param name="message">The message to be logged.</param>
 public static void Message(LogSeverity severity, string message)
 {
     NativeMethods.rs2_log(severity, message, out IntPtr error);
     NativeHelper.ThrowExceptionForRsError(error);
 }
Exemple #8
0
 /// <summary>
 /// Starts logging API notifications to the standard output.
 /// </summary>
 /// <param name="minSeverity">The minimum severity of the messages to be logged.</param>
 public static void ToConsole(LogSeverity minSeverity)
 {
     NativeMethods.rs2_log_to_console(minSeverity, out IntPtr error);
     NativeHelper.ThrowExceptionForRsError(error);
 }
Exemple #9
0
        //public new static explicit operator Blob(IntPtr nativePointer)
        //{
        //    if (!(nativePointer == IntPtr.Zero))
        //    {
        //        return new Blob(nativePointer);
        //    }
        //    return null;
        //}

        /// <unmanaged>void* ID3D10Blob::GetBufferPointer()</unmanaged>
        internal unsafe IntPtr GetBufferPointer()
        {
            //return calli(System.IntPtr(System.Void*), this._nativePointer, *(*(IntPtr*)this._nativePointer + (IntPtr)3 * (IntPtr)sizeof(void*)));
            return(NativeHelper.CalliIntPtr(3, _nativePointer));
        }
Exemple #10
0
 /// <unmanaged>HRESULT IDirect3DVertexBuffer9::Lock([In] unsigned int OffsetToLock,[In] unsigned int SizeToLock,[Out] void** ppbData,[In] D3DLOCK Flags)</unmanaged>
 public unsafe HRESULT Lock(int offsetToLock, int sizeToLock, void **ppbData, D3DLOCK lockFlags)
 {
     //result = calli(System.Int32(System.Void*,System.Int32,System.Int32,System.Void*,System.Int32), this._nativePointer, offsetToLock, sizeToLock, ptr, lockFlags, *(*(IntPtr*)this._nativePointer + (IntPtr)11 * (IntPtr)sizeof(void*)));
     return((HRESULT)NativeHelper.CalliInt32(11, _nativePointer, (int)offsetToLock, (int)sizeToLock, (void *)ppbData, (int)lockFlags));
 }
Exemple #11
0
 public static XArray Pow(XArray x, double scalar) => NativeHelper.Pow(x, scalar);
Exemple #12
0
 public static XArray Hypot(XArray a, XArray b) => NativeHelper.ElementwiseOps(a, b, ElementwiseFunc.Hypot);
Exemple #13
0
 public static XArray Cbrt(XArray x) => NativeHelper.ElementwiseOps(x, ElementwiseFunc.Cbrt);
 public static void KillWindow(IntPtr hwnd)
 {
     NativeHelper.SendMessage(hwnd, NativeHelper.WM_CLOSE, IntPtr.Zero, IntPtr.Zero);
 }
 public void TestBoxAddSingleton()
 {
     var ft = new NativeHelper(0);
     dynamic ftx = Silver.Box(ft);
     ftx.y = CompileAndExecute("def y(num) { return num + @x; };");
     ftx.x = 15;
     Assert.That(ftx.y(10), Is.EqualTo(25));
 }
 public static XArray Erf(XArray x) => NativeHelper.ElementwiseOps(x, ElementwiseFunc.Erf);
Exemple #17
0
 /// <unmanaged>HRESULT IDirect3DVertexBuffer9::Unlock()</unmanaged>
 public unsafe HRESULT Unlock()
 {
     //calli(System.Int32(System.Void*), this._nativePointer, *(*(IntPtr*)this._nativePointer + (IntPtr)12 * (IntPtr)sizeof(void*))).CheckError();
     return(NativeHelper.CalliInt32(12, _nativePointer));
 }
Exemple #18
0
        public override List <Control> Render(IfrmCommandEditor editor, ICommandControls commandControls)
        {
            base.Render(editor, commandControls);

            NativeHelper.AddDefaultSearchRows(v_NativeSearchParameters);
            RenderedControls.AddRange(commandControls.CreateDefaultInputGroupFor("v_InstanceName", this, editor));
            RenderedControls.AddRange(commandControls.CreateDefaultWebElementDataGridViewGroupFor("v_NativeSearchParameters", this, editor,
                                                                                                  new Control[] { NativeHelper.NativeChromeRecorderControl(v_NativeSearchParameters, editor) }));
            RenderedControls.AddRange(commandControls.CreateDefaultDropdownGroupFor("v_Option", this, editor));
            RenderedControls.AddRange(commandControls.CreateDefaultInputGroupFor("v_SelectionValue", this, editor));
            RenderedControls.AddRange(commandControls.CreateDefaultInputGroupFor("v_Timeout", this, editor));

            return(RenderedControls);
        }
Exemple #19
0
 /// <unmanaged>SIZE_T ID3D10Blob::GetBufferSize()</unmanaged>
 internal unsafe PointerSize GetBufferSize()
 {
     //return calli(System.Void*(System.Void*), this._nativePointer, *(*(IntPtr*)this._nativePointer + (IntPtr)4 * (IntPtr)sizeof(void*)));
     return((void *)NativeHelper.CalliIntPtr(4, _nativePointer));
 }
Exemple #20
0
 public override string GetDisplayValue()
 {
     return(base.GetDisplayValue() + $" [{NativeHelper.GetSearchNameValue(v_NativeSearchParameters)} - Option '{v_SelectionValue}' - Instance Name '{v_InstanceName}']");
 }
Exemple #21
0
 /// <summary>
 /// Starts logging API notifications to a file.
 /// </summary>
 /// <param name="minSeverity">The minimum severity of the messages to be logged.</param>
 /// <param name="filePath">The path of the file to log to.</param>
 public static void ToFile(LogSeverity minSeverity, string filePath)
 {
     NativeMethods.rs2_log_to_file(minSeverity, filePath, out IntPtr error);
     NativeHelper.ThrowExceptionForRsError(error);
 }
Exemple #22
0
 /// <inheritdoc/>
 protected override void DestroyWindowCore(HandleRef hwnd)
 {
     NativeHelper.SetParent(childHandle, IntPtr.Zero);
     NativeHelper.DestroyWindow(hwnd.Handle);
 }
Exemple #23
0
 /// <summary>
 /// Gets the owner of the window corresponding to the given hwnd.
 /// </summary>
 /// <param name="hwnd">The hwnd of the window.</param>
 /// <returns>The hwnd of the owner.</returns>
 /// <remarks>Only top-level windows might owner. Owner of a window is also a top-level window.</remarks>
 public static IntPtr GetOwner(IntPtr hwnd)
 {
     return(NativeHelper.GetWindow(hwnd, NativeHelper.GetWindowCmd.GW_OWNER));
 }
Exemple #24
0
 public void Dispose()
 {
     NativeHelper.SetParent(Handle, IntPtr.Zero);
     NativeHelper.DestroyWindow(Handle);
 }
Exemple #25
0
 /// <summary>
 /// Gets the parent of the window corresponding to the given hwnd.
 /// </summary>
 /// <param name="hwnd">The hwnd of the window.</param>
 /// <returns>The hwnd of the parent.</returns>
 /// <remarks>Only child windows might have a parent.</remarks>
 public static IntPtr GetParent(IntPtr hwnd)
 {
     return(NativeHelper.GetAncestor(hwnd, NativeHelper.GetAncestorFlags.GetParent));
 }
Exemple #26
0
        /// <summary>
        /// Forwards a message that comes from the hosted window to the WPF window. This method can be used for example to forward keyboard events.
        /// </summary>
        /// <param name="hwnd">The hwnd of the hosted window.</param>
        /// <param name="msg">The message identifier.</param>
        /// <param name="wParam">The word parameter of the message.</param>
        /// <param name="lParam">The long parameter of the message.</param>
        public void ForwardMessage(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam)
        {
            DispatcherOperation task;

            switch (msg)
            {
            case NativeHelper.WM_RBUTTONDOWN:
                mouseMoveCount = 0;
                task           = Dispatcher.InvokeAsync(() =>
                {
                    RaiseMouseButtonEvent(Mouse.PreviewMouseDownEvent, MouseButton.Right);
                    RaiseMouseButtonEvent(Mouse.MouseDownEvent, MouseButton.Right);
                });
                task.Wait(TimeSpan.FromSeconds(1.0f));
                break;

            case NativeHelper.WM_RBUTTONUP:
                task = Dispatcher.InvokeAsync(() =>
                {
                    RaiseMouseButtonEvent(Mouse.PreviewMouseUpEvent, MouseButton.Right);
                    RaiseMouseButtonEvent(Mouse.MouseUpEvent, MouseButton.Right);
                });
                task.Wait(TimeSpan.FromSeconds(1.0f));
                break;

            case NativeHelper.WM_LBUTTONDOWN:
                task = Dispatcher.InvokeAsync(() =>
                {
                    RaiseMouseButtonEvent(Mouse.PreviewMouseDownEvent, MouseButton.Left);
                    RaiseMouseButtonEvent(Mouse.MouseDownEvent, MouseButton.Left);
                });
                task.Wait(TimeSpan.FromSeconds(1.0f));
                break;

            case NativeHelper.WM_LBUTTONUP:
                task = Dispatcher.InvokeAsync(() =>
                {
                    RaiseMouseButtonEvent(Mouse.PreviewMouseUpEvent, MouseButton.Left);
                    RaiseMouseButtonEvent(Mouse.MouseUpEvent, MouseButton.Left);
                });
                task.Wait(TimeSpan.FromSeconds(1.0f));
                break;

            case NativeHelper.WM_MOUSEMOVE:
                ++mouseMoveCount;
                break;

            case NativeHelper.WM_CONTEXTMENU:
                // TODO: Tracking drag offset would be better, but might be difficult since we replace the mouse to its initial position each time it is moved.
                if (mouseMoveCount < 3)
                {
                    Dispatcher.InvokeAsync(() =>
                    {
                        DependencyObject dependencyObject = this;
                        while (dependencyObject != null)
                        {
                            var element = dependencyObject as FrameworkElement;
                            if (element?.ContextMenu != null)
                            {
                                element.Focus();
                                // Data context will not be properly set if the popup is open this way, so let's set it ourselves
                                element.ContextMenu.SetCurrentValue(DataContextProperty, element.DataContext);
                                element.ContextMenu.IsOpen = true;
                                var source = (HwndSource)PresentationSource.FromVisual(element.ContextMenu);
                                if (source != null)
                                {
                                    source.AddHook(ContextMenuWndProc);
                                    contextMenuPosition = Mouse.GetPosition(this);
                                    lock (contextMenuSources)
                                    {
                                        contextMenuSources.Add(source);
                                    }
                                }
                                break;
                            }
                            dependencyObject = VisualTreeHelper.GetParent(dependencyObject);
                        }
                    });
                }
                break;

            default:
                var parent = NativeHelper.GetParent(hwnd);
                NativeHelper.PostMessage(parent, msg, wParam, lParam);
                break;
            }
        }
Exemple #27
0
        /// <summary>
        /// Installs the azure network driver. This is the driver used to create the
        /// flat network to which containers with static IPs are added.
        /// </summary>
        private bool InstallNetworkDriver(string fabricBinRoot)
        {
            bool success = false;

            DeployerTrace.WriteInfo("Installing the network driver.");

            try
            {
                var pluginFullPath = Path.Combine(Path.Combine(fabricBinRoot, @"Fabric/Fabric.Code"), FlatNetworkConstants.NetworkDriverPlugin);
                DeployerTrace.WriteInfo("Network driver plugin path is {0}.", pluginFullPath);

                bool running;
                int  processId = 0;
                IsProcessRunning(FlatNetworkConstants.NetworkDriverPlugin, out running, out processId);
                if (!running)
                {
                    // Remove the azure vnet sock file if it exists.
                    var command     = string.Format("sudo rm -f {0}", FlatNetworkConstants.AzureVnetPluginSockPath);
                    int returnvalue = NativeHelper.system(command);
                    if (returnvalue != 0)
                    {
                        DeployerTrace.WriteInfo("Failed to execute command {0} return value {1}", command, returnvalue);
                    }
                    else
                    {
                        DeployerTrace.WriteInfo("Successfully executed command \"{0}\".", command);

                        // check ebtables dependency
                        bool ebtablesInstalled = false;
                        if (IsPackageInstalled(FlatNetworkConstants.EbtablesPackageName))
                        {
                            DeployerTrace.WriteInfo("Ebtables package installed.");
                            ebtablesInstalled = true;
                        }
                        else
                        {
                            DeployerTrace.WriteInfo("Ebtables package not installed.");
                        }

                        // start up cns plugin
                        if (ebtablesInstalled)
                        {
                            command     = string.Format("{0} {1}&", "sudo", pluginFullPath);
                            returnvalue = NativeHelper.system(command);
                            if (returnvalue != 0)
                            {
                                DeployerTrace.WriteInfo("Failed to execute command {0} with return value {1}.", command, returnvalue);
                            }
                            else
                            {
                                DeployerTrace.WriteInfo("Successfully executed command \"{0}\".", command);
                                // Check if network driver is installed
                                for (int i = 0; i < 3; i++)
                                {
                                    bool processRunning = false;
                                    int  pid            = -1;
                                    IsProcessRunning(FlatNetworkConstants.NetworkDriverPlugin, out processRunning, out pid);
                                    if (processRunning)
                                    {
                                        DeployerTrace.WriteInfo("Successfully installed network driver.");
                                        success = true;
                                        break;
                                    }
                                    else
                                    {
                                        Thread.Sleep(5000);
                                    }
                                }
                            }
                        }
                    }
                }
                else
                {
                    DeployerTrace.WriteInfo("Skipping installation of network driver since it is already installed.");
                    success = true;
                }
            }
            catch (Exception ex)
            {
                DeployerTrace.WriteError("Failed to install network driver exception {0}", ex);
            }

            return(success);
        }
Exemple #28
0
        bool IKeyboardInputSink.HasFocusWithin()
        {
            var focus = NativeHelper.GetFocus();

            return(Handle != IntPtr.Zero && (focus == Handle || NativeHelper.IsChild(Handle, focus)));
        }
        public override List <Control> Render(IfrmCommandEditor editor, ICommandControls commandControls)
        {
            base.Render(editor, commandControls);

            NativeHelper.AddDefaultSearchRows(v_NativeSearchParameters);
            RenderedControls.AddRange(commandControls.CreateDefaultInputGroupFor("v_InstanceName", this, editor));
            RenderedControls.AddRange(commandControls.CreateDefaultWebElementDataGridViewGroupFor("v_NativeSearchParameters", this, editor,
                                                                                                  new Control[] { NativeHelper.NativeChromeRecorderControl(v_NativeSearchParameters, editor) }));

            RenderedControls.AddRange(commandControls.CreateDefaultDropdownGroupFor("v_ClickButton", this, editor));
            ((ComboBox)RenderedControls[8]).SelectedIndexChanged += ClickButtonComboBox_SelectionChangeCommitted;

            _clickTypeControls = new List <Control>();
            _clickTypeControls.AddRange(commandControls.CreateDefaultDropdownGroupFor("v_ClickType", this, editor));

            RenderedControls.AddRange(_clickTypeControls);

            ((ComboBox)RenderedControls[10]).SelectedIndexChanged += HoverTypeComboBox_SelectionChangeCommitted;

            _openLinkOptions = new List <Control>();
            _openLinkOptions.AddRange(commandControls.CreateDefaultDropdownGroupFor("v_OpenLinkOptions", this, editor));

            RenderedControls.AddRange(_openLinkOptions);

            ((ComboBox)RenderedControls[12]).SelectedIndexChanged += OpenLinkOptionsComboBox_SelectionChangeCommitted;

            _newInstanceName = new List <Control>();
            _newInstanceName.AddRange(commandControls.CreateDefaultInputGroupFor("v_NewInstanceName", this, editor));

            RenderedControls.AddRange(_newInstanceName);

            _cursorAdjustmentControls = new List <Control>();
            _cursorAdjustmentControls.AddRange(commandControls.CreateDefaultInputGroupFor("v_XAdjustment", this, editor));
            _cursorAdjustmentControls.AddRange(commandControls.CreateDefaultInputGroupFor("v_YAdjustment", this, editor));

            RenderedControls.AddRange(_cursorAdjustmentControls);
            RenderedControls.AddRange(commandControls.CreateDefaultInputGroupFor("v_Timeout", this, editor));

            return(RenderedControls);
        }
 public static XArray ACosh(XArray x) => NativeHelper.ElementwiseOps(x, ElementwiseFunc.ACosh);
 public static XArray LGamma(XArray x) => NativeHelper.ElementwiseOps(x, ElementwiseFunc.LGamma);
 public static XArray Sinh(XArray x) => NativeHelper.ElementwiseOps(x, ElementwiseFunc.Sinh);
        private static void WindowShown(IntPtr hwnd)
        {
            if (!HwndHelper.HasStyleFlag(hwnd, NativeHelper.WS_VISIBLE))
            {
                Logger.Debug($"Discarding non-visible window ({hwnd})");
                return;
            }

            Logger.Verbose($"Processing newly shown window ({hwnd})...");
            var windowInfo = Find(hwnd);

            if (windowInfo == null)
            {
                windowInfo = new WindowInfo(hwnd);

                if (Debugger.IsAttached)
                {
                    foreach (var debugWindowTypeName in DebugWindowTypeNames)
                    {
                        if (windowInfo.Window?.GetType().FullName.StartsWith(debugWindowTypeName) ?? false)
                        {
                            Logger.Debug($"Discarding debug/diagnostics window '{windowInfo.Window.GetType().FullName}' ({hwnd})");
                            return;
                        }
                    }
                }

                AllWindowsList.Add(windowInfo);
            }
            windowInfo.IsShown = true;

            if (windowInfo == MainWindow)
            {
                Logger.Info("Main window shown.");
                MainWindowChanged?.Invoke(null, new WindowManagerEventArgs(MainWindow));
            }
            else
            {
                if (windowInfo.IsModal)
                {
                    // If this window has not been shown using a WindowManager method, add it as a top-level modal window
                    if (!ModalWindows.Any(x => x.Equals(windowInfo)))
                    {
                        var lastModal = ModalWindows.LastOrDefault() ?? MainWindow;
                        if (lastModal != null)
                        {
                            windowInfo.Owner     = lastModal;
                            lastModal.IsDisabled = true;
                        }
                        ModalWindowsList.Add(windowInfo);
                        Logger.Info($"Modal window shown. (standalone) ({hwnd})");
                    }
                    else
                    {
                        var index       = ModalWindowsList.IndexOf(windowInfo);
                        var childModal  = index < ModalWindows.Count - 1 ? ModalWindows[index + 1] : null;
                        var parentModal = index > 0 ? ModalWindows[index - 1] : MainWindow;
                        if (childModal != null)
                        {
                            childModal.Owner      = windowInfo;
                            windowInfo.IsDisabled = true;
                            // We're placing another window on top of us, let's activate it so it comes to the foreground!
                            if (childModal.Hwnd != IntPtr.Zero)
                            {
                                NativeHelper.SetActiveWindow(childModal.Hwnd);
                            }
                        }
                        if (parentModal != null)
                        {
                            parentModal.IsDisabled = true;
                        }
                        Logger.Info($"Modal window shown. (with WindowManager) ({hwnd})");
                    }
                    ModalWindowOpened?.Invoke(null, new WindowManagerEventArgs(windowInfo));
                }
            }
        }
 public void TestBoxWithoutSilverScope()
 {
     var ft = new NativeHelper(0);
     dynamic ftx = Silver.Box(ft);
     ftx.x = 15;
     ftx._fieldTest = ftx.x + 10;
     Assert.AreEqual(25, ft._fieldTest);
 }