Пример #1
0
        public static void RegisterCallbacks(OpenDialogDelegate openDialogCallback,
                                             OpenWindowDelegate openWindowCallback)
        {
            if (DialogService.openWindowCallback != null)
            {
                throw new InvalidOperationException("it is not allowed to call DialogService.RegisterCallbacks() again, after DialogService was already initialized.");
            }

            DialogService.openDialogCallback = openDialogCallback ?? throw new ArgumentNullException("openDialogCallback");
            DialogService.openWindowCallback = openWindowCallback ?? throw new ArgumentNullException("openWindowCallback");
        }
Пример #2
0
        /// <summary>
        /// Open a window (for example Moving Pictures, MP-TV Series, etc.),
        /// invoke on GUI thread if called from a different
        /// thread than UI thread
        /// </summary>
        /// <param name="windowId"></param>
        public static void OpenWindow(int windowId)
        {
            if (GUIGraphicsContext.form.InvokeRequired)
            {
                OpenWindowDelegate d = OpenWindow;
                GUIGraphicsContext.form.Invoke(d, new object[] { windowId });
            }
            else
            {
                GUIGraphicsContext.ResetLastActivity();
                GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_GOTO_WINDOW, 0, 0, 0, windowId, 0, null);

                GUIWindowManager.SendThreadMessage(msg);
            }
        }
Пример #3
0
        /// <summary>
        ///     Register a window for a specific data type.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        public static void RegisterWindow <T>(OpenWindowDelegate openWindowCallback)
        {
            var callback = GetOpenWindowCallback(typeof(T));

            RegisteredWindows[typeof(T)] = openWindowCallback;
        }