Exemplo n.º 1
0
 private void WindowKeyDown(object sender, KeyEventArgs e)
 {
     modifierKeys = Keyboard.Modifiers;
     var listItem = listBox.SelectedItem as Status;
     switch (e.Key)
     {
         case Key.N:               
             if ((modifierKeys & ModifierKeys.Control) == ModifierKeys.None) break;
             var TweetSendWindow = new TweetSendWindow(TweetSendStatus.Post);
             TweetSendWindow.Owner = Window.GetWindow(this); //オーナー設定
             TweetSendWindow.ShowDialog();
             break;             
         case Key.Escape:
             SwitchMenu();
             break;
         case Key.R:
             if (((modifierKeys & ModifierKeys.Control) == ModifierKeys.None) || listBox.SelectedItem == null) break;
             var ReplySendWindow = new TweetSendWindow(TweetSendStatus.Reply);
             ReplySendWindow.Owner = Window.GetWindow(this); //オーナー設定
             ReplySendWindow.SetInReplyToStatus(listItem);
             ReplySendWindow.ShowDialog();
             break;
         case Key.F:
             if (((modifierKeys & ModifierKeys.Control) == ModifierKeys.None) || listBox.SelectedItem == null) break;
             var favResult = MessageBox.Show(listItem?.Text + "\r\nをお気に入りしてよろしいですか?", "確認", MessageBoxButton.YesNo);
             if (favResult == MessageBoxResult.No) break;
             FavTweetAsync(listItem?.Id);
             break;
         case Key.F5:
             GetHomeTimeLineAsync();
             break;
         case Key.T:
             if (((modifierKeys & ModifierKeys.Control) == ModifierKeys.None) || listBox.SelectedItem == null) break;
             var rtResult = MessageBox.Show(listItem?.Text + "\r\nをRTしてよろしいですか?", "確認", MessageBoxButton.YesNo);
             if (rtResult == MessageBoxResult.No) break;
             ReTweetAsync(listItem?.Id);
             break;
         case Key.Down:
             var selectIndex = listBox.SelectedIndex;
             if (listBox.Items.Count != selectIndex + 1 || LoadLock) break;
             LoadLock = true;
             GetHomeTimeLineAsync(listItem?.Id);
             break;
     }
 }
Exemplo n.º 2
0
        private void WindowKeyDown(object sender, KeyEventArgs e)
        {
            modifierKeys = Keyboard.Modifiers;
            var listItem = listBox.SelectedItem as Status;

            switch (e.Key)
            {
            case Key.N:
                if ((modifierKeys & ModifierKeys.Control) == ModifierKeys.None)
                {
                    break;
                }
                var TweetSendWindow = new TweetSendWindow(TweetSendStatus.Post);
                TweetSendWindow.Owner = Window.GetWindow(this);     //オーナー設定
                TweetSendWindow.ShowDialog();
                break;

            case Key.Escape:
                SwitchMenu();
                break;

            case Key.R:
                if (((modifierKeys & ModifierKeys.Control) == ModifierKeys.None) || listBox.SelectedItem == null)
                {
                    break;
                }
                var ReplySendWindow = new TweetSendWindow(TweetSendStatus.Reply);
                ReplySendWindow.Owner = Window.GetWindow(this);     //オーナー設定
                ReplySendWindow.SetInReplyToStatus(listItem);
                ReplySendWindow.ShowDialog();
                break;

            case Key.F:
                if (((modifierKeys & ModifierKeys.Control) == ModifierKeys.None) || listBox.SelectedItem == null)
                {
                    break;
                }
                var favResult = MessageBox.Show(listItem?.Text + "\r\nをお気に入りしてよろしいですか?", "確認", MessageBoxButton.YesNo);
                if (favResult == MessageBoxResult.No)
                {
                    break;
                }
                FavTweetAsync(listItem?.Id);
                break;

            case Key.F5:
                GetHomeTimeLineAsync();
                break;

            case Key.T:
                if (((modifierKeys & ModifierKeys.Control) == ModifierKeys.None) || listBox.SelectedItem == null)
                {
                    break;
                }
                var rtResult = MessageBox.Show(listItem?.Text + "\r\nをRTしてよろしいですか?", "確認", MessageBoxButton.YesNo);
                if (rtResult == MessageBoxResult.No)
                {
                    break;
                }
                ReTweetAsync(listItem?.Id);
                break;

            case Key.Down:
                var selectIndex = listBox.SelectedIndex;
                if (listBox.Items.Count != selectIndex + 1 || LoadLock)
                {
                    break;
                }
                LoadLock = true;
                GetHomeTimeLineAsync(listItem?.Id);
                break;
            }
        }