Beispiel #1
0
        // Update screen ttl value
        private async void UpdateScreenTTLValue(int prevTTL)
        {
            int actualTTL = prevTTL;

            for (int i = 0; i < 40; i++)
            {
                actualTTL = TTLMng.GetDefaultTTL();

                if (actualTTL != prevTTL)
                {
                    break;
                }

                await Task.Delay(50);
            }

            if (prevTTL == actualTTL)
            {
                return;
            }
            else
            {
                ScreenTTLValueTransition(prevTTL, actualTTL, 1);
            }
        }
Beispiel #2
0
        public WindowViewModel()
        {
            MinimizeCommand = new RelayCommand(() => Application.Current.MainWindow.WindowState = WindowState.Minimized);

            CloseCommand = new RelayCommand(() => Application.Current.MainWindow.Close());

            SetTTL = new RelayCommand(() =>
            {
                if (_textBoxValue > 0 && _textBoxValue < 256)
                {
                    TTLMng.SetDefaultTTL(_textBoxValue);
                    UpdateScreenTTLValue(_currentTTL);
                    OnPropertyChanged(nameof(TTLLabel));
                }
            });

            CreateShortcut = new RelayCommand(() => AppMng.CreateShortcut());

            SetSystemTTL = new RelayCommand(() =>
            {
                TTLMng.RestoreSystemTTLValue();
                UpdateScreenTTLValue(_currentTTL);
            });
        }