Пример #1
0
        public void AddTool2(TabModel item, Dock targetDock, GridLength defaultSize)
        {
            if (item == null)
            {
                throw new ArgumentNullException(nameof(item));
            }
            if (item.Usage == TabItemType.Document)
            {
                throw new InvalidOperationException();
            }

            var well = AllTabs.Where(t => (t.Parent as ToolWellModel)?.Dock == targetDock)
                       .Select(t => t.Parent as ToolWellModel)
                       .FirstOrDefault();

            if (well == null)
            {
                well = new ToolWellModel {
                    Dock = targetDock
                };
                var branch = new SplitPanelModel(targetDock, well);
                well.PanelSize = defaultSize;

                var temp = content;
                Content = branch;
                branch.Add(temp);
            }

            well.Children.Add(item);
            well.SelectedItem = item;
            well.IsActive     = true;
        }
Пример #2
0
        private void synchronizeTabState()
        {
            lock (tabManipulationLock)
            {
                if (selfPlayerTab == null && CurrentDamageParser.SelfPlayer != null)
                {
                    selfPlayerTab = new GraphPlayerTabVM(this, DetailedDamageVisibleSettings, CurrentDamageParser.SelfPlayer);
                    AllTabs.Insert(1, selfPlayerTab);
                    playerTabDict.Add(CurrentDamageParser.SelfPlayer, selfPlayerTab);
                    selfPlayerTab.SetEnabledLineSeries(LineSeriesSettings.GetEnumValue());

                    if (OpenGraphForSelfAutomatically)
                    {
                        SelectedTab = selfPlayerTab;
                    }
                }

                foreach (var player in CurrentDamageParser.Players) //add
                {
                    if (DamageParser.IsBlacklistedUsername(player.Name))
                    {
                        continue;                                                  //skip blacklisted
                    }
                    if (!playerTabDict.ContainsKey(player))
                    {
                        var newTab = new GraphPlayerTabVM(this, DetailedDamageVisibleSettings, player);
                        AllTabs.Add(newTab);
                        playerTabDict.Add(player, newTab);
                        newTab.SetEnabledLineSeries(LineSeriesSettings.GetEnumValue());
                    }
                }

                List <GraphPlayerTabVM> toRemove = new List <GraphPlayerTabVM>(); //remove
                foreach (var tab in AllTabs.Where(t => t is GraphPlayerTabVM).Cast <GraphPlayerTabVM>())
                {
                    if (!CurrentDamageParser.DoesPlayerIdExist(tab.Player.ID))
                    {
                        toRemove.Add(tab);
                    }
                }
                foreach (var rem in toRemove)
                {
                    AllTabs.Remove(rem);
                    playerTabDict.Remove(rem.Player);
                }
            }
        }