Example #1
0
        public static BaseMatrixWindow GetCreateWindow(IPreview preview)
        /// Tries to find opened window by preview and updates it, and opens new window if non is found
        {
            IOutlet <object> outlet = PreviewManager.GetOutlet(preview);

            Guid previewGuid = outlet.Gen.Guid;

            BaseMatrixWindow[] windows = Resources.FindObjectsOfTypeAll <BaseMatrixWindow>();

            BaseMatrixWindow window = null;

            for (int i = 0; i < windows.Length; i++)
            {
                if (windows[i] is IPreviewWindow serGuid && serGuid.SerializedGenGuid == previewGuid)
                {
                    window = windows[i]; break;
                }
            }

            if (window == null)
            {
                window = preview.CreateWindow();
                if (window is IPreviewWindow serGuid)
                {
                    serGuid.SerializedGenGuid = previewGuid;
                }
                window.ShowTab();
            }

            window.Show();

            return(window);
        }