public MainWindow() { _hashTags.Add (string.Empty); InitializeComponent (); InitCommandBinding (); InitPopup (); itemsControl.DataContext = this; _mgr = new TwitterAccountManager (); IStreamingHandler[] targets; _mgr.Load (LoadConfig, out targets); postAccount.ItemsSource = _mgr.Accounts; if (_mgr.Accounts.Length > 0) postAccount.SelectedIndex = 0; Init (targets); Predicate<object> previewCheck = delegate (object o) { if (postTextBox.IsFocused || (Keyboard.Modifiers != ModifierKeys.None && Keyboard.Modifiers != ModifierKeys.Shift)) return false; if (Keyboard.FocusedElement is TextBox) return false; return true; }; this.PreviewTextInput += delegate (object sender, TextCompositionEventArgs e) { if (!previewCheck (null)) return; ShowPostArea (true); }; this.PreviewKeyDown += delegate (object sender, KeyEventArgs e) { if (!previewCheck (null)) return; if (e.Key == Key.ImeProcessed || (e.Key >= Key.A && e.Key <= Key.Z) || (e.Key >= Key.D0 && e.Key <= Key.D9) || (e.Key >= Key.NumPad0 && e.Key <= Key.NumPad9)) ShowPostArea (true); }; this.Closed += delegate (object sender, EventArgs e) { SaveConfig (); }; }