public void SearchForStranger() { if (!_connection.IsStrangerConnected) { _connection.SearchForStranger((Location)SettingsSelector.GetConfigurationValue <int>("Voivodeship")); } }
private void MessageLog_OnMouseDoubleClick(object sender, MouseButtonEventArgs e) { if (e.ChangedButton == MouseButton.Left && SettingsSelector.GetConfigurationValue <bool>("Behavior_CopyViewOnLogDoubleClick")) { MessageLog.ToggleCopyView(); Toolbar.CopyViewToggleButton.IsChecked = !Toolbar.CopyViewToggleButton.IsChecked; } }
private void connection_StrangerFound(object sender, StrangerFoundEventArgs e) { Application.Current.Dispatcher.Invoke(() => { if (SettingsSelector.GetConfigurationValue <bool>("Behavior_SendSexQueryOnStart")) { _chatView.SendMessage("km, wiek?"); } }); }
private void PaintOutgoingMessage() { SenderTextBlock.Text = LocaleSelector.GetLocaleString("MessageControl_Sender_You"); MainGrid.Background = Colors.OutgoingMessageBackgroundBrush; MainGrid.BorderBrush = Colors.OutgoingMessageBorderBrush; if (SettingsSelector.GetConfigurationValue <bool>("Appearance_MessageMargins")) { Margin = new Thickness(20, 0, 0, 0); } }
private void SettingsSelector_SettingsChanged(object sender, EventArgs e) { if (SettingsSelector.GetConfigurationValue <bool>("Appearance_UppercaseMenuHeaders")) { MainMenuButton.Label = LocaleSelector.GetLocaleString("Menu_File").ToUpper(); OptionsMenuButton.Label = LocaleSelector.GetLocaleString("Menu_Options").ToUpper(); ViewMenuButton.Label = LocaleSelector.GetLocaleString("Menu_View").ToUpper(); } else { MainMenuButton.Label = LocaleSelector.GetLocaleString("Menu_File"); OptionsMenuButton.Label = LocaleSelector.GetLocaleString("Menu_Options"); ViewMenuButton.Label = LocaleSelector.GetLocaleString("Menu_View"); } }
private void ChatBox_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter && !string.IsNullOrWhiteSpace(ChatBox.Text) && _connection.IsStrangerConnected) { _connection.SendMessage(ChatBox.Text); if (SettingsSelector.GetConfigurationValue <bool>("Behavior_SendChatstate")) { _connection.ReportChatstate(false); _typing = false; } MessageLog.AddMessage(new Message(ChatBox.Text, -1, -1, MessageType.Chat), false); ChatBox.Clear(); OnMessageSent(); } }
private void ChatBox_OnKeyUp(object sender, KeyEventArgs e) { if (SettingsSelector.GetConfigurationValue <bool>("Behavior_SendChatstate")) { if (e.Key != Key.Enter && _connection.IsStrangerConnected) { if (e.Key == Key.Back && _typing) { _connection.ReportChatstate(false); _typing = false; } if ((char.IsLetterOrDigit((char)e.Key) || char.IsPunctuation((char)e.Key) || char.IsSeparator((char)e.Key)) && !_typing) { _connection.ReportChatstate(true); _typing = true; } } } }
public MainWindow() { InitializeComponent(); CreateConnection(); DirectoryGuard.DirectoriesSanityCheck(); InitializeChatView(); InitializeStatistics(); _glowFadeOutAnimation = new ColorAnimation(Colors.WindowActiveGlow, Colors.WindowInactiveGlow, new Duration(new TimeSpan(0, 0, 0, 0, 150))); _glowFadeInAnimation = new ColorAnimation(Colors.WindowInactiveGlow, Colors.WindowActiveGlow, new Duration(new TimeSpan(0, 0, 0, 0, 150))); var borderActivateAnimation = new ColorAnimation(Colors.WindowInactiveBorder, Colors.WindowActiveBorder, new Duration(new TimeSpan(0, 0, 0, 0, 150))); var borderDeactivateAnimation = new ColorAnimation(Colors.WindowActiveBorder, Colors.WindowInactiveBorder, new Duration(new TimeSpan(0, 0, 0, 0, 150))); _borderActivateStoryboard = new Storyboard(); _borderDeactivateStoryboard = new Storyboard(); Storyboard.SetTarget(borderActivateAnimation, WindowBorder); Storyboard.SetTargetProperty(borderActivateAnimation, new PropertyPath("(Border.BorderBrush).(SolidColorBrush.Color)")); _borderActivateStoryboard.Children.Add(borderActivateAnimation); Storyboard.SetTarget(borderDeactivateAnimation, WindowBorder); Storyboard.SetTargetProperty(borderDeactivateAnimation, new PropertyPath("(Border.BorderBrush).(SolidColorBrush.Color)")); _borderDeactivateStoryboard.Children.Add(borderDeactivateAnimation); SettingsSelector.SettingsChanged += SettingsSelector_SettingsChanged; _debuggingWindow = new DebugWindow(App.Connection); _settingsWindow = new SettingsWindow(); _aboutWindow = new AboutWindow(); _archiveWindow = new ArchiveWindow(); _escTimer = new Timer(800); _escTimer.Elapsed += escTimer_Elapsed; SettingsSelector.SetConfigurationValue("Voivodeship", SettingsSelector.GetConfigurationValue <string>("Voivodeship")); }
protected override void OnStartup(StartupEventArgs e) { var systemVersion = Environment.OSVersion.Version; if (systemVersion.Major < 6) { MessageBox.Show("Incompatible system version, must be at least Windows Vista", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); } DirectoryGuard.DirectoriesSanityCheck(); if (!HasWriteAccessToFolder(AppDomain.CurrentDomain.BaseDirectory)) { AlertWindow.Show(LocaleSelector.GetLocaleString("AlertWindow_NoWriteAccess")); CanWriteToCurrentFolder = false; } else { CanWriteToCurrentFolder = true; } AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; WindowFlashHelper = new WindowFlashHelper(this); Connection = new Connection { SendUserAgent = SettingsSelector.GetConfigurationValue <bool>("Behavior_SendUserAgent") }; StatsManager = new StatsManager(Connection); ArchiveManager = new ArchiveManager(); LocaleSelector.SetLocaleIdentifier( SettingsSelector.GetConfigurationValue <string>("Language") ); ColorSchemeLoader = new ColorSchemeLoader(); ColorSchemeLoader.LoadColorSchemes(); ColorSchemeLoader.ApplyColors(); base.OnStartup(e); }
private void SettingsWindow_OnLoaded(object sender, RoutedEventArgs e) { foreach (var s in LocaleSelector.GetAvailableLocaleIdentifiers()) { LanguageSelectComboBox.Items.Add(s); LanguageSelectComboBox.SelectedItem = LocaleSelector.GetCurrentLocaleIdentifier(); } foreach (var s in App.ColorSchemeLoader.ColorSchemes.Keys) { ColorSchemeComboBox.Items.Add(s); ColorSchemeComboBox.SelectedItem = SettingsSelector.GetConfigurationValue <string>("ColorScheme"); } SendSexQueryCheckBox.IsChecked = SettingsSelector.GetConfigurationValue <bool>("Behavior_SendSexQueryOnStart"); StartupWithSystemCheckBox.IsChecked = SettingsSelector.GetConfigurationValue <bool>("Behavior_StartupWithSystem"); SendUserAgentCheckBox.IsChecked = SettingsSelector.GetConfigurationValue <bool>("Behavior_SendUserAgent"); SendChatstateCheckBox.IsChecked = SettingsSelector.GetConfigurationValue <bool>("Behavior_SendChatstate"); ToggleCopyViewOnDoubleClickCheckBox.IsChecked = SettingsSelector.GetConfigurationValue <bool>("Behavior_CopyViewOnLogDoubleClick"); UpperCaseMenuHeaderCheckBox.IsChecked = SettingsSelector.GetConfigurationValue <bool>("Appearance_UppercaseMenuHeaders"); MessageMarginsCheckBox.IsChecked = SettingsSelector.GetConfigurationValue <bool>("Appearance_MessageMargins"); VoivodeshipSelectComboBox.SelectedIndex = SettingsSelector.GetConfigurationValue <int>("Voivodeship"); }
public ColorSchemeLoader() { ColorSchemes = new Dictionary <string, Dictionary <string, string> >(); ColorSchemeID = SettingsSelector.GetConfigurationValue <string>("ColorScheme"); }