private void ExecuteOpenTabCommand(EventInformation <MouseEventArgs> e)
        {
            var fileEntry = e.CommandArgument as FileEntryViewModel;

            if (fileEntry == null || fileEntry.Blocks.Any(b => b.Health != FileBlockHealthStatus.Ok))
            {
                return;
            }

            var existing = Tabs.SingleOrDefault(t => t.Header == fileEntry.Name);

            if (existing != null)
            {
                SelectedTab = existing;
                return;
            }

            var stfs = fileEntry.Parent;

            if (fileEntry.Name == "PEC")
            {
                var newTab = new ProfileRebuilderTabItemViewModel(fileEntry.Name, ParseStfs(stfs.ExtractPec()));
                Tabs.Add(newTab);
                SelectedTab = newTab;
            }
            else if (fileEntry.Name.EndsWith(".gpd"))
            {
                var gpd   = stfs.ExtractFile(fileEntry.Name);
                var model = ModelFactory.GetModel <GpdFile>(gpd);
                model.Parse();
                var newTab = new ProfileRebuilderTabItemViewModel(fileEntry.Name, new GpdFileViewModel(model));
                Tabs.Add(newTab);
                SelectedTab = newTab;
            }
        }
        private void ExecuteOpenTabCommand(EventInformation<MouseEventArgs> e)
        {
            var fileEntry = e.CommandArgument as FileEntryViewModel;
            if (fileEntry == null || fileEntry.Blocks.Any(b => b.Health != FileBlockHealthStatus.Ok)) return;

            var existing = Tabs.SingleOrDefault(t => t.Header == fileEntry.Name);
            if (existing != null)
            {
                SelectedTab = existing;
                return;
            }

            var stfs = fileEntry.Parent;

            if (fileEntry.Name == "PEC")
            {
                var newTab = new ProfileRebuilderTabItemViewModel(fileEntry.Name, ParseStfs(stfs.ExtractPec()));
                Tabs.Add(newTab);
                SelectedTab = newTab;
            }
            else if (fileEntry.Name.EndsWith(".gpd"))
            {
                var gpd = stfs.ExtractFile(fileEntry.Name);
                var model = ModelFactory.GetModel<GpdFile>(gpd);
                model.Parse();
                var newTab = new ProfileRebuilderTabItemViewModel(fileEntry.Name, new GpdFileViewModel(model));
                Tabs.Add(newTab);
                SelectedTab = newTab;
            }
        }
        private void ExecuteCloseTabCommand(ProfileRebuilderTabItemViewModel e)
        {
            var index = Tabs.IndexOf(e);

            if (index == 0)
            {
                return;
            }
            Tabs.Remove(e);
            SelectedTab = Tabs[index - 1];
        }
 private void ExecuteCloseTabCommand(ProfileRebuilderTabItemViewModel e)
 {
     var index = Tabs.IndexOf(e);
     if (index == 0) return;
     Tabs.Remove(e);
     SelectedTab = Tabs[index-1];
 }