示例#1
0
        void OnTabMessage(TabMessage message)
        {
            switch (message.Action)
            {
            case TabMessage.ActionType.Add:
                Add(message.Tab);
                break;

            case TabMessage.ActionType.Edit:
                Edit(message.Tab);
                break;

            case TabMessage.ActionType.Remove:
                Remove(message.Tab);
                break;

            case TabMessage.ActionType.Move:
                Move(message.Tab, message.TabB);
                break;

            case TabMessage.ActionType.MoveUp:
                ReorderTabs(message.Tab, true);
                break;

            case TabMessage.ActionType.MoveDown:
                ReorderTabs(message.Tab, false);
                break;
            }
        }
示例#2
0
        private void HandleTab(TabMessage tabMessage)
        {
            string id   = tabMessage.Id ?? tabMessage.ViewModel?.Id;
            var    item = Tabs.FirstOrDefault(x => x.Id == id);

            switch (tabMessage.Action)
            {
            case TabMessageAction.BringToFront:
                SelectedTab = item;
                break;

            case TabMessageAction.Close:
                Tabs.Remove(item);
                break;

            case TabMessageAction.Create:
                if (item == null)
                {
                    item = tabMessage.ViewModel;
                    Tabs.Add(tabMessage.ViewModel);
                }
                SelectedTab = item;
                break;
            }
        }
示例#3
0
        private void Close()
        {
            var message = new TabMessage {
                Id = this.Id, Action = TabMessageAction.Close
            };

            this.MessengerInstance.Send(message);
        }
示例#4
0
        private async void ShowStatsAsync()
        {
            var    statsViewModel = ServiceLocator.Current.GetInstance <StatsViewModel>();
            var    task           = statsViewModel.CalulateForAsync(_leagueKey, _seasonKey);
            string caption        = $"stats-{_leagueKey}-{_seasonKey}";
            string tooltip        = "Stats for season ...";
            var    tabViewModel   = new TabItemViewModel(caption, caption, tooltip, statsViewModel);

            var message = new TabMessage
            {
                Action    = TabMessageAction.Create,
                ViewModel = tabViewModel,
            };
            await task;

            this.MessengerInstance.Send(message);
        }
示例#5
0
        public async void OpenSeasonActionAsync()
        {
            var league = this;
            var matchs = await _openLigaService.LoadMatchesAsync(league.LeagueKey, league.SeasonKey);

            var matchViewModels = MatchViewModel.FromMatchs(matchs);
            var seasonViewModel = SeasonViewModel.From(matchViewModels, league.LeagueKey, league.SeasonKey);
            var tabViewModel    = new TabItemViewModel(league.ShortDisplayName,
                                                       league.ShortDisplayName, league.LongDisplayName,
                                                       seasonViewModel, true);

            var message = new TabMessage {
                Action = TabMessageAction.Create, ViewModel = tabViewModel
            };

            this.MessengerInstance.Send(message);
        }
示例#6
0
        private async void LoadTeamsActionAsync()
        {
            var teamsViewModel = ServiceLocator.Current.GetInstance <TeamsOfLeagueViewModel>();
            var task           = teamsViewModel.LoadTeamsAsync(this);

            var label        = $"Teams-{ShortDisplayName}";
            var tooltip      = $"Teams of {LongDisplayName}";
            var tabViewModel = new TabItemViewModel(label, label, tooltip, teamsViewModel, true);
            var tabMessage   = new TabMessage
            {
                ViewModel = tabViewModel,
                Action    = TabMessageAction.Create,
            };

            await task;

            this.MessengerInstance.Send(tabMessage);
        }