Ejemplo n.º 1
0
        private void OnBaseDocumentUnloaded(Document document)
        {
            ICollection keyCollection = dialogs.Keys;

            Type[] keys = new Type[keyCollection.Count];
            keyCollection.CopyTo(keys, 0);
            for (int index = 0; index < keys.Length; index++)
            {
                Type       type   = keys[index];
                BaseDialog dialog = dialogs[type] as BaseDialog;
                if ((dialog.Scope == DialogScope.Singleton) || (dialog.Scope == DialogScope.Document))
                {
                    dialog.Destroy();
                }
            }
        }
Ejemplo n.º 2
0
        private void OnBaseVideoUnloaded()
        {
            ICollection keyCollection = dialogs.Keys;

            Type[] keys = new Type[keyCollection.Count];
            keyCollection.CopyTo(keys, 0);
            for (int index = 0; index < keys.Length; index++)
            {
                Type       type   = keys[index];
                BaseDialog dialog = dialogs[type] as BaseDialog;
                if (dialog.Scope == DialogScope.Video)
                {
                    dialog.Destroy();
                }
            }
        }
Ejemplo n.º 3
0
        /* Public methods */

        public BaseDialog Get(Type dialogType, params object[] args)
        {
            BaseDialog dialog = dialogs[dialogType] as BaseDialog;

            if (dialog == null)
            {
                object newDialog = Activator.CreateInstance(dialogType, args);
                if (!(newDialog is BaseDialog))
                {
                    return(null);
                }

                dialog = newDialog as BaseDialog;
                if (dialog.Scope != DialogScope.Singleton)
                {
                    dialogs[dialogType] = dialog;
                    dialog.Destroyed   += OnDialogDestroyed;
                }
            }
            return(dialog);
        }