Esempio n. 1
0
        public void ShowSingleton <T>(object identifier, ITypeResolver resolvr)
            where T : WorkspaceVmBase
        {
            T wrkspce = (T)MainTabs.Where(x => x is T)
                        .FirstOrDefault(x => x.GetHashCode()
                                        == x.HashCodeFor(identifier));

            if (wrkspce == null)
            {
                try {
                    wrkspce = ForwardLogs(resolvr.Resolve <T>());
                }
                catch (Exception ex)
                {
                    Error_n("Error in ShowSingleton<T>()",
                            $"Unable to create instance of ‹{typeof(T).Name}›."
                            + L.F + ex.Details(false, false));
                    return;
                }
                MainTabs.Add(wrkspce);
                wrkspce.SetIdentifier(identifier);
                wrkspce.Refresh();
            }

            SetActiveWorkspace(wrkspce);
            return;
        }