Ejemplo n.º 1
0
        public void PopulateViews(DemoInfo demoInfo)
        {
            if (!demoInfo.Analyzed)
            {
                _scoresListView.ItemsSource       = null;
                _scoresListView.SelectedIndex     = -1;
                _teamScoresListView.ItemsSource   = null;
                _teamScoresListView.SelectedIndex = -1;
                _groupBox.Content = _scoresListView;
                return;
            }

            var activeListView = demoInfo.TeamGameType ? _teamScoresListView : _scoresListView;

            _groupBox.Content = activeListView;

            var cutByTimeItem = new MenuItem();

            cutByTimeItem.Header  = "Cut by Time (Ctrl+T)";
            cutByTimeItem.Command = _cutByScoreCommand;
            cutByTimeItem.Click  += (obj, args) => OnCutByTimeClicked();
            App.AddKeyBinding(activeListView, Key.T, _cutByScoreCommand, (obj, args) => OnCutByTimeClicked());

            var contextMenu = new ContextMenu();

            contextMenu.Items.Add(cutByTimeItem);

            var scores = new ObservableCollection <ListViewItem>();

            if (demoInfo.TeamGameType)
            {
                foreach (var score in demoInfo.TeamScores)
                {
                    var item = new ListViewItem();
                    item.Content     = score;
                    item.ContextMenu = contextMenu;
                    scores.Add(item);
                }
            }
            else
            {
                foreach (var score in demoInfo.Scores)
                {
                    var item = new ListViewItem();
                    item.Content     = score;
                    item.ContextMenu = contextMenu;
                    scores.Add(item);
                }
            }

            activeListView.ItemsSource = scores;
            if (scores.Count > 0)
            {
                activeListView.SelectedIndex = 0;
            }
        }
Ejemplo n.º 2
0
        public void PopulateViews(DemoInfo demoInfo)
        {
            if (!demoInfo.Analyzed)
            {
                _commandsListView.ItemsSource   = null;
                _commandsListView.SelectedIndex = -1;
                return;
            }

            var cutByTimeItem = new MenuItem();

            cutByTimeItem.Header  = "Cut by Time (Ctrl+T)";
            cutByTimeItem.Command = _cutByCommandCommand;
            cutByTimeItem.Click  += (obj, args) => OnCutByTimeFromCommandContextClicked();

            var copyItem = new MenuItem();

            copyItem.Header  = "Copy to Clipboard (Ctrl+C)";
            copyItem.Command = _copyCommand;
            copyItem.Click  += (obj, args) => OnCopyContextClicked();
            App.AddKeyBinding(_commandsListView, Key.T, _cutByCommandCommand, (obj, args) => OnCutByTimeFromCommandContextClicked());
            App.AddKeyBinding(_commandsListView, Key.C, _copyCommand, (obj, args) => OnCopyContextClicked());

            var commandsContextMenu = new ContextMenu();

            commandsContextMenu.Items.Add(cutByTimeItem);
            commandsContextMenu.Items.Add(copyItem);

            var commands = new ObservableCollection <ListViewItem>();

            foreach (var command in demoInfo.Commands)
            {
                var item = new ListViewItem();
                item.Content     = command;
                item.ContextMenu = commandsContextMenu;
                commands.Add(item);
            }

            _commandsListView.ItemsSource = commands;
            if (commands.Count > 0)
            {
                _commandsListView.SelectedIndex = 0;
            }
        }
Ejemplo n.º 3
0
 private void InitFragEventsListViewCutBinding()
 {
     App.AddKeyBinding(_fragEventsListView, Key.T, _cutByFragCommand, (obj, args) => OnCutByTimeFromFragsContextClicked());
     App.AddKeyBinding(_fragEventsListView, Key.C, _copyFragCommand, (obj, args) => OnCopyFromFragsContextClicked());
 }
Ejemplo n.º 4
0
 private void InitChatEventsListViewCutBinding()
 {
     App.AddKeyBinding(_chatEventsListView, Key.T, _cutByTimeCommand, (obj, args) => OnCutByTimeFromChatContextClicked());
     App.AddKeyBinding(_chatEventsListView, Key.C, _copyChatCommand, (obj, args) => OnCopyFromChatContextClicked());
 }