コード例 #1
0
 private void onExitConfirmationClicked(DPrompt.ButtonFlags pressed)
 {
     if (pressed == DPrompt.ButtonFlags.YES)
     {
         ShutdownHelper shutdownHelper = new ShutdownHelper(this);
         shutdownHelper.Shutdown();
     }
 }
コード例 #2
0
 private void onShowQuitAppPromptCallback(DPrompt.ButtonFlags pressed)
 {
     showingPrompt = false;
     if (pressed == DPrompt.ButtonFlags.YES)
     {
         ShutdownHelper shutdownHelper = new ShutdownHelper(this);
         shutdownHelper.Shutdown();
     }
 }
コード例 #3
0
 private void coutdownTimer_Tick(object sender, EventArgs e)
 {
     Win32.ForceFocus(Handle);
     if (currentSeconds-- <= 0)
     {
         ShutdownHelper.Shutdown();
     }
     else
     {
         lblCountdown.Text = currentSeconds.ToString();
     }
 }
コード例 #4
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;
            }
        }