Пример #1
0
        /// <summary>
        /// A yes no dialogue box
        /// </summary>
        /// <param name="title">Dialogue title</param>
        /// <param name="text">Dialogue text</param>
        /// <returns>the button clicked value, Yes or No</returns>
        public static Primitive YesNo(Primitive title, Primitive text)
        {
            DialogueYesNo dialogue = new DialogueYesNo();

            Type GraphicsWindowType = typeof(GraphicsWindow);
            Window _window = (Window)GraphicsWindowType.GetField("_window", BindingFlags.IgnoreCase | BindingFlags.Static | BindingFlags.NonPublic).GetValue(null);

            InvokeHelperWithReturn ret = new InvokeHelperWithReturn(delegate
            {
                return dialogue.Show(title, text, _window);
            });
            MethodInfo method = GraphicsWindowType.GetMethod("InvokeWithReturn", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.IgnoreCase);
            return method.Invoke(null, new object[] { ret }).ToString();
        }
Пример #2
0
        /// <summary>
        /// A yes no dialogue box
        /// </summary>
        /// <param name="title">Dialogue title</param>
        /// <param name="text">Dialogue text</param>
        /// <returns>the button clicked value, Yes or No</returns>
        public static Primitive YesNo(Primitive title, Primitive text)
        {
            DialogueYesNo dialogue = new DialogueYesNo();

            Type   GraphicsWindowType = typeof(GraphicsWindow);
            Window _window            = (Window)GraphicsWindowType.GetField("_window", BindingFlags.IgnoreCase | BindingFlags.Static | BindingFlags.NonPublic).GetValue(null);

            InvokeHelperWithReturn ret = new InvokeHelperWithReturn(delegate
            {
                return(dialogue.Show(title, text, _window));
            });
            MethodInfo method = GraphicsWindowType.GetMethod("InvokeWithReturn", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.IgnoreCase);

            return(method.Invoke(null, new object[] { ret }).ToString());
        }