コード例 #1
0
ファイル: DrawingState.cs プロジェクト: Serenity62/MAG
        internal override void Entry()
        {
            //   ITheme theme = new GenericTheme();
            //   ITheme theme = new HalloweenTheme();
            ITheme theme = new CoolBlueTheme();

            foreach (Canvas c in m.canvases)
            {
                //Load theme

                DrawingThread temp = new DrawingThread(c);
                m.AddObserver(temp);
                m.theme.loadTheme(temp);
                //   theme.loadTheme(temp);
                Thread.Sleep(1000);


                //// create new DrawingThread
                //DrawingThread temp = new DrawingThread(c);
                //// register it
                //m.AddObserver(temp);
                //// Thread it
                //Thread t = new Thread(new ThreadStart(temp.DrawShapes));
                //// start Thread
                //t.Start();
            }
        }
コード例 #2
0
        public void loadTheme(DrawingThread temp)
        {
            // create new DrawingThread
            // DrawingThread temp = new DrawingThread(c);
            //set thread's available shapes
            string[] shapes = { "Rectangle", "Ellipse" };
            temp.shapes = shapes;
            //set thread's available colors
            Color[] colors = { Color.FromArgb(255, 0, 0), Color.FromArgb(0, 255, 0), Color.FromArgb(0, 0, 255) }; //temporarily red for testing
            temp.colors = colors;

            // register it
            //    m.AddObserver(temp);
            // Thread it
            Thread t = new Thread(new ThreadStart(temp.DrawShapes));

            // start Thread
            t.Start();
        }