internal void Initialize(DialogInitializationArguments args, ICancelHandler cancelHandler)
        {
            _onCancelAction = () => OnDialogCancelled(cancelHandler);
            var thread = new Thread(() => InitializeTask(args));

            thread.SetApartmentState(ApartmentState.STA);
            thread.Start();
        }
        public WaitDialog(IServiceProvider serviceProvider)
        {
            _serviceProvider          = serviceProvider;
            Application.Current.Exit += OnApplicationExit;
            _cancelHandler            = new CancelHandler(this);

            if (!(_serviceProvider.GetService(typeof(IThemeManager)) is IThemeManager themeManager))
            {
                return;
            }
            themeManager.ThemeChanged += OnThemeChanged;
        }
    public static int OnCancel(IntPtr l)
    {
        int result;

        try
        {
            ICancelHandler cancelHandler = (ICancelHandler)LuaObject.checkSelf(l);
            BaseEventData  eventData;
            LuaObject.checkType <BaseEventData>(l, 2, out eventData);
            cancelHandler.OnCancel(eventData);
            LuaObject.pushValue(l, true);
            result = 1;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
Exemplo n.º 4
0
 private static void Execute(ICancelHandler handler, BaseEventData eventData)
 {
     handler.OnCancel(eventData);
 }
 private static void OnDialogCancelled(ICancelHandler cancelHandler)
 {
     cancelHandler?.OnCancel();
 }