Exemple #1
0
 private void onExitConfirmationClicked(DPrompt.ButtonFlags pressed)
 {
     if (pressed == DPrompt.ButtonFlags.YES)
     {
         ShutdownHelper shutdownHelper = new ShutdownHelper(this);
         shutdownHelper.Shutdown();
     }
 }
Exemple #2
0
 private void onShowQuitAppPromptCallback(DPrompt.ButtonFlags pressed)
 {
     showingPrompt = false;
     if (pressed == DPrompt.ButtonFlags.YES)
     {
         ShutdownHelper shutdownHelper = new ShutdownHelper(this);
         shutdownHelper.Shutdown();
     }
 }
Exemple #3
0
 private void coutdownTimer_Tick(object sender, EventArgs e)
 {
     Win32.ForceFocus(Handle);
     if (currentSeconds-- <= 0)
     {
         ShutdownHelper.Shutdown();
     }
     else
     {
         lblCountdown.Text = currentSeconds.ToString();
     }
 }
Exemple #4
0
    /// <summary>
    /// Dynamically generates a class that will load the "fbembed.dll" given in <c>dllName</c>, and that
    /// also implements <see cref="IFbClient"/>, which you can use to call the library.
    /// </summary>
    /// <param name="dllName">The name of the DLL to load (e.g. "fbembed", "C:\path\to\fbembed.dll", etc)</param>
    /// <returns>A class that implements <see cref="IFbClient"/> and calls into the native library you specify.</returns>
    public static IFbClient Create(string dllName)
    {
        if (string.IsNullOrEmpty(dllName))
        {
            dllName = DefaultDllName;
        }
        var createdNew = false;
        var result     = cache.GetOrAdd(dllName, s => { createdNew = true; return(BuildFbClient(s)); });

        if (createdNew)
        {
            ShutdownHelper.RegisterFbClientShutdown(() => NativeHelpers.CallIfExists(() => result.fb_shutdown(0, 0)));
        }
        return(result);
    }
        /// <summary>
        /// Dynamically generates a class that will load the "fbembed.dll" given in <c>dllName</c>, and that
        /// also implements <see cref="IFbClient"/>, which you can use to call the library.
        /// </summary>
        /// <param name="dllName">The name of the DLL to load (e.g. "fbembed", "C:\path\to\fbembed.dll", etc)</param>
        /// <returns>A class that implements <see cref="IFbClient"/> and calls into the native library you specify.</returns>
        public static IFbClient Create(string dllName)
        {
            if (string.IsNullOrEmpty(dllName))
            {
                dllName = DefaultDllName;
            }
            var createdNew = false;
            var result     = cache.GetOrAdd(dllName, s => { createdNew = true; return(BuildFbClient(s)); });

            if (createdNew)
            {
                ShutdownHelper.RegisterFbClientShutdown(() => ShutdownEntryPointWrapper(result));
            }
            return(result);
        }
Exemple #6
0
        private void _anperi_Message(object sender, AnperiMessageEventArgs e)
        {
            switch (e.Message)
            {
            case EventFiredAnperiMessage eventMessage:
                switch (eventMessage.Event)
                {
                case EventFiredAnperiMessage.EventType.on_click:
                    if (_shuttingDown)
                    {
                        ShutdownHelper.AbortShutdown();
                        _shuttingDown = false;
                    }
                    else
                    {
                        ShutdownHelper.Shutdown(10);
                        _shuttingDown = true;
                    }
                    _anperi.UpdateElementParam(_elementIds[Elements.ButtonShutdown], "text", _shuttingDown ? "Abort Shutdown" : "Shutdown");
                    break;

                case EventFiredAnperiMessage.EventType.on_click_long:
                    break;

                case EventFiredAnperiMessage.EventType.on_change:
                    if (eventMessage.ElementId == _elementIds[Elements.SliderVolume])
                    {
                        if (eventMessage.EventData.TryGetValue(nameof(Slider.progress), out int prog))
                        {
                            OnVolumeChanged(eventMessage.ElementId, prog);
                        }
                        else
                        {
                            Trace.TraceInformation("Error parsing volume from message.");
                        }
                    }
                    break;

                case EventFiredAnperiMessage.EventType.on_input:
                    break;

                default:
                    Trace.TraceWarning($"Got not handled event: {eventMessage.Event.ToString()} from: {eventMessage.ElementId}");
                    break;
                }
                break;
            }
        }
 static FbConnectionPoolManager()
 {
     Instance = new FbConnectionPoolManager();
     ShutdownHelper.RegisterPoolCleanup(Instance.Dispose);
 }