Exemplo n.º 1
0
 private void HandleShortcuts(object sender, KeyEventArgs e)
 {
     switch (e.Key)
     {
     case Key.Escape:
         _parentWindow.Close();
         break;
     }
 }
 public SettingsView(SettingsViewModel viewModel, ModernWindow window)
 {
     this.DataContext = viewModel;
     InitializeComponent();
     viewModel.CloseAction = () =>
     {
         window.DialogResult = true;
         window.Close();
     };
 }
Exemplo n.º 3
0
        void App_NeedRegister(object sender, RoutedEventArgs e)
        {
            RegisterPage = new ModernWindow
            {
                Style   = (Style)App.Current.Resources["EmptyWindow"],
                Content = new Pages.Register
                {
                    Margin = new Thickness(32)
                },
                ResizeMode = System.Windows.ResizeMode.NoResize,
                MaxWidth   = 650,
                Title      = "FPSDesigner - Register",
                MaxHeight  = 430,
                Icon       = GlobalVars.SoftwareIcon
            };
            RegisterPage.Closing += ModernWindow_Closed;
            ((Pages.Register)RegisterPage.Content).RegisterSucceed += App_RegisterSucceed;
            RegisterPage.Show();

            LoginPage.Close();
        }
Exemplo n.º 4
0
        void CodeEditor_EnteredText(object sender, RoutedEventArgs e)
        {
            string text = ((TextBox)sender).Text;

            textboxDialog.Close();

            System.IO.File.WriteAllText("Scripts/" + text, textEditor.Text);

            DoubleAnimation opacityAnim = new DoubleAnimation(0, 1, new Duration(TimeSpan.FromMilliseconds(500)));

            checkValidSave.BeginAnimation(OpacityProperty, opacityAnim);

            Timer timerResetCheck = new Timer(2000);

            timerResetCheck.Elapsed += timerResetCheck_Elapsed;
            timerResetCheck.Enabled  = true;

            CreateNewFileTab(text);
            ReloadFilesToTreeView();
        }
        private void ValidateUpdatedEntry()
        {
            string addressToBlock                = EntryAddressTextBox.Text;
            string addressNameForRedirect        = EntryRedirectTextBox.Text;
            bool   entryIsEnabled                = EntryIsEnabledCheckbox.IsChecked.Value;
            bool   entrySystemBlockingIsEnabled  = EntryRunsOnSystemLevelCheckbox.IsChecked.Value;
            bool   entryProxyBlockingIsEnabled   = EntryRunsOnProxyLevelCheckbox.IsChecked.Value;
            var    listOfAllAlreadyUsedAddresses = AddressValidationRule.GetListOfAllAlreadyUsedAddresses();

            listOfAllAlreadyUsedAddresses.Remove(_currentEntry.Url);


            if (!AddressValidationRule.IsCorrectAddress(addressToBlock) &&
                (_currentEntry.EntryType != EntryType.RegexBlock && _currentEntry.EntryType != EntryType.RegexRedirect))
            {
                MakeInvalidValueAlert("New entered address name is invalid.");
            }
            else if (listOfAllAlreadyUsedAddresses.Contains(addressToBlock))
            {
                MakeInvalidValueAlert("New entered address is already used.");
            }
            else if ((_currentEntry.EntryType == EntryType.Redirect || _currentEntry.EntryType == EntryType.RegexRedirect) &&
                     !AddressValidationRule.IsCorrectAddress(addressNameForRedirect))
            {
                MakeInvalidValueAlert("Address for redirect is invalid.");
            }
            else if ((_currentEntry.EntryType == EntryType.RegexBlock || _currentEntry.EntryType == EntryType.RegexRedirect) &&
                     !AddressValidationRule.IsCorrectRegex(addressToBlock))
            {
                MakeInvalidValueAlert("Enterd regex is invalid.");
            }
            else
            {
                _currentEntry.Url         = addressToBlock;
                _currentEntry.RedirectUrl = (_currentEntry.EntryType == EntryType.Redirect || _currentEntry.EntryType == EntryType.RegexRedirect) ? addressNameForRedirect : "";
                _currentEntry.IsEnabled   = entryIsEnabled;
                _currentEntry.SystemLevelBlockingIsEnabled = entrySystemBlockingIsEnabled;
                _currentEntry.ProxyBlockingIsEnabled       = entryProxyBlockingIsEnabled;
                _window.Close();
            }
        }
Exemplo n.º 6
0
 private void SaveButton_OnClick(object sender, RoutedEventArgs e)
 {
     _window.Close();
     _baseView.SaveProfiles();
 }
Exemplo n.º 7
0
 private void CloseClick1(object sender, RoutedEventArgs e)
 {
     _associatedWindow.Close();
 }
Exemplo n.º 8
0
 void App_PropertiesSet(object sender, RoutedEventArgs e)
 {
     PropertiesSet = true;
     PropertiesPage.Close();
     WinServer.MainWindow.Instance.Show();
 }