示例#1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CardRenderer"/> class.
        /// </summary>
        /// <exception cref="InvalidOperationException">An instance of CardRenderer already exists. -or- Failed to initialize the cards.dll library.</exception>
        public CardRenderer()
        {
            if (singleton != null)
            {
                throw new InvalidOperationException("An instance of WindowsCards already exists.");
            }

            string path = Path.Combine(Application.StartupPath, "cards.dll");
            if (!File.Exists(path))
            {
                File.WriteAllBytes(path, Resources.cards);
            }

            int width = 0;
            int height = 0;

            if (!CardRenderer.cdtInit(ref width, ref height))
            {
                throw new InvalidOperationException("Failed to initialize the cards.dll library.");
            }

            this.Width = width;
            this.Height = height;
            CardRenderer.singleton = this;
        }
示例#2
0
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">True if managed resources should be disposed; otherwise, false.</param>
        private void Dispose(bool disposing)
        {
            if (disposing)
            {
                // TODO: Call Dispose() on members of this class
            }

            CardRenderer.cdtTerm();
            CardRenderer.singleton = null;
        }