Пример #1
0
        public Daddy(Brush[] imgs, ILwin.ShowScreen screen, int xpos, int ypos, int dir)
        {
            Random rnd = new Random();

            daddyBr = imgs;
            this.screen = screen;

            this.dir = dir;
            this.ypos = ypos;
            this.xpos = xpos;

            this.speedTerm = Constants.DADDY_SPEED;

            balloon = new Balloon(Constants.IS_DADDY, screen);
            balloon.showBalloon(dir, xpos, ypos);


            //생성
            daddyRec = new System.Windows.Shapes.Rectangle();
            daddyRec.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            daddyRec.VerticalAlignment = System.Windows.VerticalAlignment.Top;
            daddyRec.Width = Constants.DADDY_WIDTH;
            daddyRec.Height = Constants.DADDY_HEIGHT;
            daddyRec.Fill = daddyBr[dir];
            daddyRec.Margin = new Thickness(xpos, ypos, 0, 0);
            screen.sp.Children.Add(daddyRec);

            isGettingKeyword = false;
            isJumping = false;
            isComputingCPU = false;
        }
Пример #2
0
        public Namyong(Brush[] imgs, ILwin.ShowScreen screen, int xpos, int ypos, int dir)
        {
            Random rnd = new Random();

            namyongBr = imgs;
            this.screen = screen;

            this.dir = dir;
            this.ypos = ypos;
            this.xpos = xpos;

            speedTerm = Constants.NAMYONG_SPEED;

            balloon = new Balloon(Constants.IS_NAMYONG, screen);
            balloon.showBalloon(dir, xpos, ypos);

            //생성
            namyongRec = new System.Windows.Shapes.Rectangle();
            namyongRec.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            namyongRec.VerticalAlignment = System.Windows.VerticalAlignment.Top;
            namyongRec.Width = Constants.NAYONG_WIDTH;
            namyongRec.Height = Constants.NAYONG_HEIGHT;
            namyongRec.Fill = namyongBr[dir];
            namyongRec.Margin = new Thickness(xpos, ypos, 0, 0);
            screen.sp.Children.Add(namyongRec);

            isGettingKeyword = false;
            isJumping = false;
            isComputingRAM = false;
        }
Пример #3
0
        //rectangle을 생성한다. 초기에 호출될 함수.
        //w와 h는 원래의 bitmapimage의 width, height
        public Board(Brush img, Brush bodyimg, double w, double h, int xpos, int ypos, ILwin.ShowScreen showscreen, Datas datas)
        {
            Random rnd = new Random();

            this.img = img;
            this.bodyimg = bodyimg;
            this.screen = showscreen;
            this.datas = datas;
        

            //생성
            imgrec = new Grid();
            imgrec.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            imgrec.VerticalAlignment = System.Windows.VerticalAlignment.Top;
            imgrec.Width = w; imgrec.Height = h;
            imgrec.Background = this.img;
            imgrec.Margin = new Thickness(xpos, ypos, 0, 0);
            screen.sp.Children.Add(imgrec);

            //마우스 핸들러 연결
            //imgrec.MouseLeftButtonUp += new System.Windows.Input.MouseButtonEventHandler(board_up);
            


            makeText();

            System.Diagnostics.Debug.WriteLine("board 완성");
        }
Пример #4
0
        public bool doingWebitem;           //webitem을 떨어뜨리는 중이라면 true. 왜냐면, box images 명령어를 사용하여 webitem을 떨구는 중엔 블록 시키기 위해서이다.

        public ShowScreen(Grid ScreenGrid, Rect winRect, ILwin.MainWindow winref, ILwin.paraPackage packs)
        {
            MWin = winref;
            this.packs = packs;
            this.doingWebitem = false;
            this.rnd = new Random();

            this.bigRect = winRect;
            this.winRect = new Rect(winRect.X, winRect.Y + 20, winRect.Width, winRect.Height - 20);
            this.logoRect = new Rect(winRect.X, winRect.Y, winRect.Width, 20);

            //winRectangle을 만들 것이다.
            winRectangle = new System.Windows.Shapes.Rectangle();
            winRectangle.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            winRectangle.VerticalAlignment = System.Windows.VerticalAlignment.Top;
            winRectangle.Margin = new Thickness(0, 20, 0, 0);
            winRectangle.Width = ScreenGrid.Width;        //가로는 bigrectangle과 같다.
            winRectangle.Height = ScreenGrid.Height - 20; //세로는 좀 더 작어.
            sp = ScreenGrid;
            sp.Children.Add(winRectangle);                  //부모 grid에 추가한다.

            //logoRectangle을 만들 것이다.
            logoRectangle = new System.Windows.Shapes.Rectangle();
            logoRectangle.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            logoRectangle.VerticalAlignment = System.Windows.VerticalAlignment.Top;
            logoRectangle.Margin = new Thickness(0, 0, 0, 0);
            logoRectangle.Width = ScreenGrid.Width;        //가로는 bigrectangle과 같다.
            logoRectangle.Height = 21;                      //세로는 딱 20픽셀이어야 하지만, 두께가 1픽셀이니 감안한다.
            sp.Children.Add(logoRectangle);                  //부모 grid에 추가한다.
         
            
            drawScreen();
            
        }
Пример #5
0
        //string imgurl에서 다운받아와 이미지를 얻어낸다.
        //그리고 flyingbox의 x 위치, y 위치가 생성 위치에 영향을 준다.
        public static void addDatas(ILwin.ShowScreen showscreen, WebItem thisitem, string imgurl, int box_posX, int box_posY)
        {
            //download image from url via internet
            thisitem.xPos = box_posX; thisitem.yPos = box_posY;

            //image(BitmapImage)를 URL로부터 얻어온다.
            thisitem.img = HTMLhandler.downloadImageFromURL(imgurl);
            thisitem.imgBr = new ImageBrush(thisitem.img);
            
            //********freezable 문제가 발생. 이미지 리소스에 freeze를 시행해 주자!
            thisitem.img.Freeze();
            thisitem.imgBr.Freeze();
            

            //이제 이미지를 연결하고 화면에 나타나도록 하여라
            showscreen.getMWinReference().Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                {
                    thisitem.imgrec.Width = thisitem.img.Width;
                    thisitem.imgrec.Height = thisitem.img.Height;

                    //이미지의 가로나 세로가 100보다 큰 게 있다면 그 부분은 100으로 줄인다.
                    if (thisitem.imgrec.Width > 100) thisitem.imgrec.Width = 100;
                    if (thisitem.imgrec.Height > 100) thisitem.imgrec.Height = 100;

                    thisitem.imgrec.Margin = new Thickness(thisitem.xPos, thisitem.yPos, thisitem.imgrec.Margin.Right, thisitem.imgrec.Margin.Bottom);
                    thisitem.imgrec.Fill = thisitem.imgBr;
                    thisitem.imgrec.Visibility = Visibility.Visible;         //이제 표시한다.
                }));


            //************************************//
            
            System.Drawing.Bitmap abit;
            using(MemoryStream outStream = new MemoryStream())
            {
                BitmapEncoder enc = new BmpBitmapEncoder();
                enc.Frames.Add(BitmapFrame.Create(thisitem.img));
                enc.Save(outStream);
                System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(outStream);

                abit = new System.Drawing.Bitmap(bitmap);
            }

            abit.Save("temimg.png");
            
        }
        public MainWindow(ILwin.paraPackage packs)
        {
            InitializeComponent();

            //init에서 만든 정보들을 모두 받아온다.
            this.packs = packs;
            datas = packs.datas;
            iconBr = packs.iconBr;
            miniBr = packs.miniBr;
            xBr = packs.xBr;
            req_recBr = packs.req_recBr;
            button1Br = packs.button1Br;
            button2Br = packs.button2Br;
            requestSndBr = packs.requestSndBr;
            requestSndBrClicked = packs.requestSndBrClicked;
            resp_recBr = packs.resp_recBr;
            aboutcontentBr = packs.aboutcontentBr;
            okButtonBr = packs.okButtonBr;
            marinBarBr = packs.marinBarBr;
            contentBr = packs.contentBr;
            bottomBr = packs.bottomBr;
            boxBr = packs.boxBr;

            //텍스트박스는 response에 위치한 그곳이다.
            textbox = new ILtextBox();


            //메인 윈도우 바를 만들기 위해 호출.
            createBar();

            //윈도우와 버튼들을 만들기 위해 호출.
            createLayout();

            //윈도우를 만든다.
            screen = new ShowScreen(showScreenGrid, SCREEN_RECT, this, packs);

            //텍스트박스는 response에 위치한 그곳이다.
            textbox.addShowScreenReference(screen);

            this.requestMachine.Focus();

            isRefreshing = false;

            
        }
Пример #7
0
        ILwin.ShowScreen screen;            //showscreen이 있어야 말풍선을 넣는다.

        public Balloon(int TALKER, ILwin.ShowScreen screen)
        {
            this.TALKER = TALKER;

            ballImg = new BitmapImage[2];
            ballBr = new Brush[2];
            textbox = new TextBox();
            rec = new Grid();

            isShowing = false;


            ballImg[0] = new BitmapImage();
            ballImg[0].BeginInit();
            ballImg[0].UriSource = new Uri(Constants.REL_PATH_SPRITE + "trans_leftbal.png", UriKind.Relative);
            ballImg[0].EndInit();

            ballImg[1] = new BitmapImage();
            ballImg[1].BeginInit();
            ballImg[1].UriSource = new Uri(Constants.REL_PATH_SPRITE + "trans_rightbal.png", UriKind.Relative);
            ballImg[1].EndInit();

            ballBr[0] = new ImageBrush(ballImg[0]);
            ballBr[1] = new ImageBrush(ballImg[1]);

            this.screen = screen;

            //텍스트박스
            textbox.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            textbox.VerticalAlignment = System.Windows.VerticalAlignment.Top;
            textbox.Margin = new Thickness(6, 6, 0, 0);
            textbox.FontSize = 10;
            textbox.Width = 110;
            textbox.Height = 70;
            textbox.BorderThickness = new Thickness(0.0);
            textbox.Background = Brushes.White;
            textbox.IsReadOnly = true;
            textbox.TextWrapping = TextWrapping.WrapWithOverflow;
            textbox.Cursor = Cursors.Arrow;

            //일단은 숨김
            rec.Visibility = Visibility.Hidden;
            textbox.Visibility = Visibility.Hidden;
        }
Пример #8
0
        ILwin.ShowScreen showscreen;        //showscreen 레퍼런스


        //생성자는 rectangle을 만들어 추가만을 수행 한다. show screen 참조 정도는 필요하다.
        public WebItem(ILwin.ShowScreen showscreen, int FallYPos)
        {
            this.showscreen = showscreen;

            this.FallYpos = FallYPos;

            showscreen.getMWinReference().Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                {
                    this.imgrec = new System.Windows.Shapes.Rectangle();
                    this.imgrec.Visibility = Visibility.Hidden;         //처음엔 숨겨놓는다
                    this.imgrec.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
                    this.imgrec.VerticalAlignment = System.Windows.VerticalAlignment.Top;
                    this.imgrec.Width = this.imgrec.Height = 120;     //이미지의 너비다.
                    this.imgrec.Stroke = new SolidColorBrush(Color.FromRgb(0, 0, 0));

                    this.imgrec.StrokeThickness = 2;
                    showscreen.sp.Children.Add(this.imgrec);
                }));

            this.imgrec.MouseRightButtonUp += new System.Windows.Input.MouseButtonEventHandler(itemclick);
        }
Пример #9
0
        public flyingBox(Brush[] boxBr, ILwin.ShowScreen screen, int xpos, int ypos, int dir)
        {
            Random rnd = new Random();

            this.boxBr = boxBr;
            this.screen = screen;

            this.dir = dir;
            this.ypos = ypos;
            this.xpos = xpos;
            //위치 선정
            

            //생성
            boximg = new System.Windows.Shapes.Rectangle();
            boximg.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            boximg.VerticalAlignment = System.Windows.VerticalAlignment.Top;
            boximg.Width = boximg.Height = 120;     //이미지의 너비다.
            boximg.Fill = boxBr[dir];
            boximg.Margin = new Thickness(xpos, ypos, 0, 0);
            screen.sp.Children.Add(boximg);


        }
Пример #10
0
        //서브 스레드에서 호출하는 말풍선 메시지 함수
        public static void setMSGsub(ILwin.MainWindow thisWin, Balloon thisballoon, string text)
        {
            //만일 말풍선이 켜져있던 상태라면
            if (thisballoon.isShowing)
            {
                thisballoon.showing.Abort();                    //일단 그 스레드를 종료한다.

                thisWin.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                    {
                        thisballoon.rec.Visibility = Visibility.Hidden;         //그리고 말풍선을 모두 닫아버린다.
                        thisballoon.textbox.Visibility = Visibility.Hidden;
                        thisballoon.textbox.Text = "";
                    }));
                thisballoon.isShowing = false;
            }

            thisballoon.isShowing = true;
            thisWin.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                    {
                        thisballoon.rec.Visibility = Visibility.Visible;
                        thisballoon.textbox.Visibility = Visibility.Visible;
                        thisballoon.textbox.Text = text;

                        //말풍선 내용이 response 창에도 나오도록 하자
                        thisWin.getTextboxReference().printMSG(thisWin.responseMsgs, ((thisballoon.TALKER == Constants.IS_NAMYONG) ? "남용이 : " : "아버지 : ") + text);
                        thisWin.responseMsgs.ScrollToEnd();
                    }));

            thisballoon.showing = new Thread(() => setMSG(thisballoon, thisballoon.screen.getMWinReference()));
            thisballoon.showing.Start();
        }
        //WMI 정보를 얻는다.
        public static void initWMI(ILwin.InitWindow thiswin)
        {
            WMIhandler.initialRAMdata(thiswin.packs.datas);

            thiswin.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                {
                    //**이벤트 클래스의 leftLoading에 직접 접근하는 게 아니라, 그 set 함수에 접근해라!! 안 그러면 이벤트 안떠
                    thiswin.eventclass.LeftLoading = Convert.ToString(Convert.ToInt32(thiswin.eventclass.leftLoading) - 1);
                    thiswin.wmis.Text = (3 - (Convert.ToInt32(thiswin.eventclass.leftLoading))) + ". WMI data loading Complete.";

                }));
        }
        //이미지들을 읽어들인다.
        public static void initImages(ILwin.InitWindow thiswin)
        {
            thiswin.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                {

                    //main window에 쓰이는 이미지들을 할당한다.
                    thiswin.packs.req_recImg = new BitmapImage();
                    thiswin.packs.button1Img = new BitmapImage();
                    thiswin.packs.button2Img = new BitmapImage();
                    thiswin.packs.button1CImg = new BitmapImage();
                    thiswin.packs.button2CImg = new BitmapImage();
                    thiswin.packs.requestSndImg = new BitmapImage();
                    thiswin.packs.requestSndImgClicked = new BitmapImage();
                    thiswin.packs.resp_recImg = new BitmapImage();
                    thiswin.packs.bottomImg = new BitmapImage();

                    //main window에 쓰이는 이미지들을 디스크에서 읽어들인다.
                    thiswin.packs.req_recImg.BeginInit();
                    thiswin.packs.req_recImg.UriSource = new Uri(Constants.REL_PATH + "interactrec.png", UriKind.Relative);
                    thiswin.packs.req_recImg.EndInit();

                    thiswin.packs.button1Img.BeginInit();
                    thiswin.packs.button1Img.UriSource = new Uri(Constants.REL_PATH + "1button.bmp", UriKind.Relative);
                    thiswin.packs.button1Img.EndInit();

                    thiswin.packs.button2CImg.BeginInit();
                    thiswin.packs.button2CImg.UriSource = new Uri(Constants.REL_PATH + "2buttonOver.bmp", UriKind.Relative);
                    thiswin.packs.button2CImg.EndInit();

                    thiswin.packs.button1CImg.BeginInit();
                    thiswin.packs.button1CImg.UriSource = new Uri(Constants.REL_PATH + "1buttonOver.bmp", UriKind.Relative);
                    thiswin.packs.button1CImg.EndInit();

                    thiswin.packs.button2Img.BeginInit();
                    thiswin.packs.button2Img.UriSource = new Uri(Constants.REL_PATH + "2button.bmp", UriKind.Relative);
                    thiswin.packs.button2Img.EndInit();

                    thiswin.packs.requestSndImg.BeginInit();
                    thiswin.packs.requestSndImg.UriSource = new Uri(Constants.REL_PATH + "reqSend.bmp", UriKind.Relative);
                    thiswin.packs.requestSndImg.EndInit();

                    thiswin.packs.requestSndImgClicked.BeginInit();
                    thiswin.packs.requestSndImgClicked.UriSource = new Uri(Constants.REL_PATH + "reqSendClicked.bmp", UriKind.Relative);
                    thiswin.packs.requestSndImgClicked.EndInit();

                    thiswin.packs.resp_recImg.BeginInit();
                    thiswin.packs.resp_recImg.UriSource = new Uri(Constants.REL_PATH + "interactrec2.png", UriKind.Relative);
                    thiswin.packs.resp_recImg.EndInit();

                    thiswin.packs.bottomImg.BeginInit();
                    thiswin.packs.bottomImg.UriSource = new Uri(Constants.REL_PATH + "bottomLogo2.png", UriKind.Relative);
                    thiswin.packs.bottomImg.EndInit();


                    //main window에 쓰이는 이미지들을 브러쉬화 하여 background에 적용할 준비를 모두 마친다.
                    thiswin.packs.req_recBr = new ImageBrush(thiswin.packs.req_recImg);
                    thiswin.packs.button1Br = new ImageBrush(thiswin.packs.button1Img);
                    thiswin.packs.button2Br = new ImageBrush(thiswin.packs.button2Img);
                    thiswin.packs.button1CBr = new ImageBrush(thiswin.packs.button1CImg);
                    thiswin.packs.button2CBr = new ImageBrush(thiswin.packs.button2CImg);
                    thiswin.packs.requestSndBr = new ImageBrush(thiswin.packs.requestSndImg);
                    thiswin.packs.requestSndBrClicked = new ImageBrush(thiswin.packs.requestSndImgClicked);
                    thiswin.packs.resp_recBr = new ImageBrush(thiswin.packs.resp_recImg);
                    thiswin.packs.bottomBr = new ImageBrush(thiswin.packs.bottomImg);


                    //flying box 이미지들
                    thiswin.packs.boxImgs = new BitmapImage[4];
                    thiswin.packs.boxBr = new Brush[4];

                    for (int i = 0; i < 4; i++ )
                    {
                        thiswin.packs.boxImgs[i] = new BitmapImage();
                    }

                        thiswin.packs.boxImgs[0].BeginInit();
                    thiswin.packs.boxImgs[0].UriSource = new Uri(Constants.REL_PATH_SPRITE + "n_leftbox.png", UriKind.Relative);
                    thiswin.packs.boxImgs[0].EndInit();
                    thiswin.packs.boxImgs[1].BeginInit();
                    thiswin.packs.boxImgs[1].UriSource = new Uri(Constants.REL_PATH_SPRITE + "n_rightbox.png", UriKind.Relative);
                    thiswin.packs.boxImgs[1].EndInit();
                    thiswin.packs.boxImgs[2].BeginInit();
                    thiswin.packs.boxImgs[2].UriSource = new Uri(Constants.REL_PATH_SPRITE + "o_leftbox.png", UriKind.Relative);
                    thiswin.packs.boxImgs[2].EndInit();
                    thiswin.packs.boxImgs[3].BeginInit();
                    thiswin.packs.boxImgs[3].UriSource = new Uri(Constants.REL_PATH_SPRITE + "o_rightbox.png", UriKind.Relative);
                    thiswin.packs.boxImgs[3].EndInit();

                    for (int i = 0; i < 4; i++)
                        thiswin.packs.boxBr[i] = new ImageBrush(thiswin.packs.boxImgs[i]);

                    //balloons 이미지들
                    thiswin.packs.balloonImgs = new BitmapImage[2];
                    thiswin.packs.balloonBr = new Brush[2];

                    for (int i = 0; i < 2; i++)
                        thiswin.packs.balloonImgs[i] = new BitmapImage();

                    thiswin.packs.balloonImgs[0].BeginInit();
                    thiswin.packs.balloonImgs[0].UriSource = new Uri(Constants.REL_PATH_SPRITE + "trans_leftbal.png", UriKind.Relative);
                    thiswin.packs.balloonImgs[0].EndInit();
                    thiswin.packs.balloonImgs[1].BeginInit();
                    thiswin.packs.balloonImgs[1].UriSource = new Uri(Constants.REL_PATH_SPRITE + "trans_rightbal.png", UriKind.Relative);
                    thiswin.packs.balloonImgs[1].EndInit();

                    for (int i = 0; i < 2; i++)
                        thiswin.packs.balloonBr[i] = new ImageBrush(thiswin.packs.balloonImgs[i]);
                    

                    //바 이미지들


                    //스프라이트
                    //-게시판
                    thiswin.packs.boardImg = new BitmapImage();
                    thiswin.packs.boardImg.BeginInit();
                    thiswin.packs.boardImg.UriSource = new Uri(Constants.REL_PATH_SPRITE + "boardicon.png", UriKind.Relative);
                    thiswin.packs.boardImg.EndInit();
                    thiswin.packs.boardBr = new ImageBrush(thiswin.packs.boardImg);
                    thiswin.packs.boardbodyImg = new BitmapImage();
                    thiswin.packs.boardbodyImg.BeginInit();
                    thiswin.packs.boardbodyImg.UriSource = new Uri(Constants.REL_OTEHR_WIN_PATH + "boardbg.png", UriKind.Relative);
                    thiswin.packs.boardbodyImg.EndInit();
                    thiswin.packs.boardbodyBr = new ImageBrush(thiswin.packs.boardbodyImg);
                    //-가격비교
                    thiswin.packs.mallImg = new BitmapImage();
                    thiswin.packs.mallImg.BeginInit();
                    thiswin.packs.mallImg.UriSource = new Uri(Constants.REL_PATH_SPRITE + "mall1.png", UriKind.Relative);
                    thiswin.packs.mallImg.EndInit();
                    thiswin.packs.mallBr = new ImageBrush(thiswin.packs.mallImg);
                    thiswin.packs.mallbodyImg = new BitmapImage();
                    thiswin.packs.mallbodyImg.BeginInit();
                    thiswin.packs.mallbodyImg.UriSource = new Uri(Constants.REL_OTEHR_WIN_PATH + "mallbg.png", UriKind.Relative);
                    thiswin.packs.mallbodyImg.EndInit();
                    thiswin.packs.mallbodyBr = new ImageBrush(thiswin.packs.mallbodyImg);
                    //-도움말
                    thiswin.packs.helpbodyImg = new BitmapImage();
                    thiswin.packs.helpbodyImg.BeginInit();
                    thiswin.packs.helpbodyImg.UriSource = new Uri(Constants.REL_OTEHR_WIN_PATH + "helpbg.png", UriKind.Relative);
                    thiswin.packs.helpbodyImg.EndInit();
                    thiswin.packs.helpbodyBr = new ImageBrush(thiswin.packs.helpbodyImg);

                    //메뉴바
                    thiswin.packs.mainBarImg = new BitmapImage();
                    thiswin.packs.mainBarImg.BeginInit();
                    thiswin.packs.mainBarImg.UriSource = new Uri(Constants.REL_PATH + "mainbar.bmp", UriKind.Relative);
                    //bi.UriSource = new Uri("D:\\igongwin\\ILwin\\ILwin\\rscs\\winbar\\mainbar.bmp", UriKind.Absolute);
                    thiswin.packs.mainBarImg.EndInit();

                    //몸통
                    thiswin.packs.mainContent = new BitmapImage();
                    thiswin.packs.mainContent.BeginInit();
                    thiswin.packs.mainContent.UriSource = new Uri(Constants.REL_PATH + "maincontent.png", UriKind.Relative);
                    thiswin.packs.mainContent.EndInit();

                    //버튼들을 만든다. [0]은 노말, [1]은 마우스오버 때.
                    thiswin.packs.iconImg = new BitmapImage[2];
                    thiswin.packs.iconImg[0] = new BitmapImage();
                    thiswin.packs.iconImg[0].BeginInit();
                    thiswin.packs.iconImg[0].UriSource = new Uri(Constants.REL_PATH + "ilicon.bmp", UriKind.Relative);
                    thiswin.packs.iconImg[0].EndInit();
                    thiswin.packs.iconImg[1] = new BitmapImage();
                    thiswin.packs.iconImg[1].BeginInit();
                    thiswin.packs.iconImg[1].UriSource = new Uri(Constants.REL_PATH + "iliconOver.bmp", UriKind.Relative);
                    thiswin.packs.iconImg[1].EndInit();



                    thiswin.packs.miniImg = new BitmapImage[2];
                    thiswin.packs.miniImg[0] = new BitmapImage();
                    thiswin.packs.miniImg[0].BeginInit();
                    thiswin.packs.miniImg[0].UriSource = new Uri(Constants.REL_PATH + "minibutton.bmp", UriKind.Relative);
                    thiswin.packs.miniImg[0].EndInit();
                    thiswin.packs.miniImg[1] = new BitmapImage();
                    thiswin.packs.miniImg[1].BeginInit();
                    thiswin.packs.miniImg[1].UriSource = new Uri(Constants.REL_PATH + "minibuttonOver.bmp", UriKind.Relative);
                    thiswin.packs.miniImg[1].EndInit();

                    thiswin.packs.xImg = new BitmapImage[2];
                    thiswin.packs.xImg[0] = new BitmapImage();
                    thiswin.packs.xImg[0].BeginInit();
                    thiswin.packs.xImg[0].UriSource = new Uri(Constants.REL_PATH + "xbutton.bmp", UriKind.Relative);
                    thiswin.packs.xImg[0].EndInit();
                    thiswin.packs.xImg[1] = new BitmapImage();
                    thiswin.packs.xImg[1].BeginInit();
                    thiswin.packs.xImg[1].UriSource = new Uri(Constants.REL_PATH + "xbuttonOver.bmp", UriKind.Relative);
                    thiswin.packs.xImg[1].EndInit();


                    //******************ABOUT 창
                    thiswin.packs.aboutcontentImg = new BitmapImage();
                    thiswin.packs.aboutcontentImg.BeginInit();
                    thiswin.packs.aboutcontentImg.UriSource = new Uri(Constants.REL_PATH_ABOUT + "about.png", UriKind.Relative);
                    thiswin.packs.aboutcontentImg.EndInit();

                    thiswin.packs.aboutcontentBr = new ImageBrush(thiswin.packs.aboutcontentImg);

                    thiswin.packs.okButton = new BitmapImage[2];
                    thiswin.packs.okButton[0] = new BitmapImage();
                    thiswin.packs.okButton[0].BeginInit();
                    thiswin.packs.okButton[0].UriSource = new Uri(Constants.REL_PATH_ABOUT + "aboutOK.bmp", UriKind.Relative);
                    thiswin.packs.okButton[0].EndInit();
                    thiswin.packs.okButton[1] = new BitmapImage();
                    thiswin.packs.okButton[1].BeginInit();
                    thiswin.packs.okButton[1].UriSource = new Uri(Constants.REL_PATH_ABOUT + "aboutOKClicked.bmp", UriKind.Relative);
                    thiswin.packs.okButton[1].EndInit();

                    thiswin.packs.marinBarBr = new ImageBrush(thiswin.packs.mainBarImg);
                    thiswin.packs.contentBr = new ImageBrush(thiswin.packs.mainContent);
                    thiswin.packs.iconBr = new Brush[2];
                    thiswin.packs.miniBr = new Brush[2];
                    thiswin.packs.xBr = new Brush[2];
                    thiswin.packs.okButtonBr = new Brush[2];

                    for (int i = 0; i < 2; i++)
                    {
                        thiswin.packs.iconBr[i] = new ImageBrush(thiswin.packs.iconImg[i]);
                        thiswin.packs.miniBr[i] = new ImageBrush(thiswin.packs.miniImg[i]);
                        thiswin.packs.xBr[i] = new ImageBrush(thiswin.packs.xImg[i]);
                        thiswin.packs.okButtonBr[i] = new ImageBrush(thiswin.packs.okButton[i]);
                    }

                    //남용&아버지 리소스 등록
                    

                    thiswin.packs.namyongImg = new BitmapImage[4];
                    thiswin.packs.namyongBr = new Brush[4];
                    thiswin.packs.daddyImg = new BitmapImage[4];
                    thiswin.packs.daddyBr = new Brush[4];

                    for (int i = 0; i < 4; i++ )
                    {
                        thiswin.packs.namyongImg[i] = new BitmapImage();
                        thiswin.packs.namyongImg[i].BeginInit();
                        thiswin.packs.namyongImg[i].UriSource = new Uri(Constants.REL_PATH_SPRITE + "sp_namyong_" + (i + 1) + ".png", UriKind.Relative);
                        thiswin.packs.namyongImg[i].EndInit();

                        thiswin.packs.namyongBr[i] = new ImageBrush(thiswin.packs.namyongImg[i]);

                        thiswin.packs.daddyImg[i] = new BitmapImage();
                        thiswin.packs.daddyImg[i].BeginInit();
                        thiswin.packs.daddyImg[i].UriSource = new Uri(Constants.REL_PATH_SPRITE + "sp_daddy_" + (i + 1) + ".png", UriKind.Relative);
                        thiswin.packs.daddyImg[i].EndInit();

                        thiswin.packs.daddyBr[i] = new ImageBrush(thiswin.packs.daddyImg[i]);
                    }

                    //reload 갱신 이미지
                    thiswin.packs.refreshImg = new BitmapImage();
                    thiswin.packs.refreshImg.BeginInit();
                    thiswin.packs.refreshImg.UriSource = new Uri(Constants.REL_PATH_INIT + "il_refresh.png", UriKind.Relative);
                    thiswin.packs.refreshImg.EndInit();
                    thiswin.packs.refreshBr = new ImageBrush(thiswin.packs.refreshImg);


                    //**이벤트 클래스의 leftLoading에 직접 접근하는 게 아니라, 그 set 함수에 접근해라!! 안 그러면 이벤트 안떠
                    thiswin.eventclass.LeftLoading = Convert.ToString(Convert.ToInt32(thiswin.eventclass.leftLoading) - 1);
                    
                    thiswin.images.Text = (3 - (Convert.ToInt32(thiswin.eventclass.leftLoading))) + ". Image loading Complete.";
                }));

        }
Пример #13
0
        //상품 가격비교 정보들을 가져온다.
        static public void getPrices(List<string> products, string queryKR, ILwin.MallWindow mallWin)
        {
            //System.Web dll 리퍼런스를 추가해 httpUtility를 사용하자. 인코딩해야 하니.
            string query = HttpUtility.UrlEncode(queryKR);

            //mallWin의 텍스트박스에 최종적으로 출력할 string
            string resultList = ""; //아무 상품도 나오지 않았을 때에 대한 대비

            //가져올 상품 최대 개수
            int MAX_PRODUCT = 8;

            HtmlWeb hw = new HtmlWeb();
            string urladdr = "http://shopping.naver.com/search/all_search.nhn?query=" + query + "&cat_id=&frm=NVSHATC&nlu=true&=&=&=&=";


            HtmlDocument doc = hw.Load(urladdr);
            HtmlNode entire = doc.DocumentNode;


            //목록의 소스들을 가져오라
            HtmlNode search_list = entire.SelectSingleNode("//div[@class='sort_content']");

            //product_list가 한 product이다.
            HtmlNodeCollection products_list = search_list.SelectNodes(".//li[@class='_product_list']");


            //===만약 _product_list를 찾지 못한다면, 이 상품은 없는 것이다.
            if (products_list == null)
                resultList = "검색 결과 X";

            //아니라면 그대로 진행
            else
            {
                //foreach (HtmlNode a_product in products_list)
                for (int i = 0; i < MAX_PRODUCT; i++)
                {
                    //상품의 이름 노드
                    HtmlNode prod_info_div = products_list.ElementAt(i).SelectSingleNode(".//div[@class='info']");
                    HtmlNode prod_info_a = prod_info_div.SelectSingleNode("./a");
                    string pro_info_str = prod_info_a.Attributes["title"].Value;

                    //상품의 가격 노드
                    HtmlNode prod_val_span = prod_info_div.SelectSingleNode(".//span[@class='num _price_reload']");
                    string pro_val_str = prod_val_span.InnerText;

                    //상품의 판매처 노드
                    HtmlNode prod_mall_div = products_list.ElementAt(i).SelectSingleNode(".//div[@class='info_mall']");

                    HtmlNode prod_mall_a = prod_mall_div.SelectSingleNode(".//a");
                    //info_mall 밑에서 얻어낸 a 중,
                    //1) a의 text에 바로 매장 이름이 있거나
                    //2) a의 아래에 img가 있고 그곳의 alt에 매장 이름이 있거나

                    //일단 a 아래에 img 노드가 있는지 한번 확인
                    HtmlNode prod_mall_div_img = prod_mall_a.SelectSingleNode("./img");
                    string pro_mall_str = "";

                    //없다면, a의 text에 바로 매장 이름이 있다.
                    if (prod_mall_div_img == null)
                        pro_mall_str = prod_mall_a.InnerText;

                    //있다면, a의 img의 alt에 매장 이름이 있다.
                    else
                        pro_mall_str = prod_mall_div_img.Attributes["alt"].Value;



                    resultList += "(No. " + (i + 1) + ")\n" + "[상품명] : " + pro_info_str + "\n[가격] : " + pro_val_str + "\n[매장] : " + pro_mall_str + "\n\n";

                }
            }

            //이제 윈도우에 출력한다.
            mallWin.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                    {
                        mallWin.texts.FontSize = 13;
                        mallWin.texts.Text = resultList;

                        //다 탐색했다면 이제 mallWindow 객체에다 탐색이 끝난 상태임을 알린다.
                        mallWin.isSearching = false;
                        mallWin.status.Text = "검색어를 입력하쇼";
                        mallWin.status.Margin = mallWin.originalMargin;
                        mallWin.status.Width = mallWin.originalWidth;
                    }));

            

        }
Пример #14
0
        //색을 계속 변하게 만드는 스레드이다.
        public static void changeColor(ILwin.MainWindow mWin, TextBox thetxt)
        {
            //여기서부터 시작
            int[] rgbarr = new int[3]{255, 0, 0};
            int time_term = 5;

            //올릴 색상의 idx, 낮출 색상의 idx. 한 칸씩 나아갈거다
            int upidx = 1; int downidx = 0;

            while (true)
            {
                //처음에는 rgbarr[upidx]를 255까지 올린다.
                while(rgbarr[upidx] < 255)
                {
                    rgbarr[upidx]++;

                    mWin.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                    {
                        var brush = new SolidColorBrush(Color.FromArgb(255, (byte)rgbarr[0], (byte)rgbarr[1], (byte)rgbarr[2]));
                        thetxt.Foreground = brush;
                    }));

                    Thread.Sleep(time_term);
                }


                if (upidx == 2) upidx = 0;
                else upidx++;

                //그 담에는 rgbarr[downidx]를 0까지 내린다.
                while (rgbarr[downidx] > 0)
                {
                    rgbarr[downidx]--;

                    mWin.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                    {
                        var brush = new SolidColorBrush(Color.FromArgb(255, (byte)rgbarr[0], (byte)rgbarr[1], (byte)rgbarr[2]));
                        thetxt.Foreground = brush;
                    }));

                    Thread.Sleep(time_term);
                }

                if (downidx == 2) downidx = 0;
                else downidx++;

                

               
            }
        }
Пример #15
0
        //박스가 날아다니기 시작할 것이다.
        public static void startmoving(Namyong namyong, ILwin.MainWindow thisWin)
        {
            int namyongLoc_x = 0;
            namyong.status = 0;


            while (true)
            {
                //현재 margin left 값을 가져온다
                thisWin.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                {
                    namyongLoc_x = (int)namyong.namyongRec.Margin.Left;
                }));

                Thread.Sleep(namyong.speedTerm);

                namyong.status = (namyong.status == 1) ? 0 : 1;

                thisWin.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                {
                    namyong.namyongRec.Fill = namyong.namyongBr[(2*namyong.dir) + namyong.status];
                }));

                if (namyong.dir == LEFT)
                {
                    //왼쪽 벽에 다다르면
                    if (namyongLoc_x <= 0)
                    {
                        //방향은 오른쪽으로 바뀌고, 그림도 바뀌어야지.
                        namyong.dir = RIGHT;

                        //말풍선도 오른쪽으로 바뀌고, 말풍선 위치도 바뀐다.
                        thisWin.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                        {
                            namyong.balloon.rec.Background = namyong.balloon.ballBr[RIGHT];
                            namyong.balloon.rec.Margin = new Thickness(namyong.namyongRec.Margin.Left - Constants.NAMYONG_BALLOON_RIGHT_DIST, namyong.namyongRec.Margin.Top, 0, 0);
                        }));
                    }

                    //그렇지 않다면 계속 왼쪽으로 이동
                    else
                    {

                        thisWin.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                        {
                            namyong.namyongRec.Margin = new Thickness(namyong.namyongRec.Margin.Left - 2, namyong.namyongRec.Margin.Top,
                                namyong.namyongRec.Margin.Right, namyong.namyongRec.Margin.Bottom);

                            namyong.balloon.rec.Margin = new Thickness(namyong.balloon.rec.Margin.Left - 2, namyong.namyongRec.Margin.Top,
                                0, 0);
                        }));
                    }
                }



                else if (namyong.dir == RIGHT)
                {
                    //왼쪽 벽에 다다르면
                    if (namyongLoc_x >= 640)
                    {
                        namyong.dir = LEFT;

                        //말풍선도 왼쪽으로 바뀌고, 말풍선 위치도 바뀐다.
                        thisWin.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                        {
                            namyong.balloon.rec.Background = namyong.balloon.ballBr[LEFT];
                            namyong.balloon.rec.Margin = new Thickness(namyong.namyongRec.Margin.Left + Constants.NAMYONG_BALLOON_LEFT_DIST, namyong.namyongRec.Margin.Top, 0, 0);
                        }));
                    }

                    //그렇지 않다면 계속 왼쪽으로 이동
                    else
                    {

                        thisWin.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                        {
                            namyong.namyongRec.Margin = new Thickness(namyong.namyongRec.Margin.Left + 2, namyong.namyongRec.Margin.Top,
                                namyong.namyongRec.Margin.Right, namyong.namyongRec.Margin.Bottom);

                            namyong.balloon.rec.Margin = new Thickness(namyong.balloon.rec.Margin.Left + 2, namyong.namyongRec.Margin.Top,
                                0, 0);

                        }));
                    }
                }


            }


        }
Пример #16
0
        //포털 사이트에서 뉴스를 가져온다.  boardWindow 전용
        static public void getNews(ILwin.BoardWindow bWin, TextBox textbox)
        {
            //http://reedfim.tistory.com/31 참고,
            //국내 웹 페이지를 크롤링할 때는 유의, 글자가 깨질 수도 있어서..
            int ARTICLES_TO_CRAWL = 6;      //가져올 기사 개수

            //가져올 기사의 제목&내용들
            List<string> article_titles = new List<string>();
            List<string> article_contents = new List<string>();


            //필요한 자료구조
            WebRequest req;
            HttpWebResponse resp;
            Stream datas;
            HtmlDocument docu;

            //필요한 데이터
            string urladdr = "http://news.naver.com/main/list.nhn?mode=LS2D&mid=shm&sid1=102&sid2=249";
            string testfile = @"newsfile.txt";

            //이제 내용을 크롤링해온다.
            req = WebRequest.Create(urladdr);
            req.Credentials = CredentialCache.DefaultCredentials;
            resp = (HttpWebResponse)req.GetResponse();
            datas = resp.GetResponseStream();
            docu = new HtmlDocument();
            docu.Load(datas, Encoding.Default);

            //이제 모든 document가 HtmlNode에 담겼다.
            HtmlNode entire = docu.DocumentNode;

            //네이버 기사들이 담긴 HtmlNode
            HtmlNode mainnewsNode = docu.DocumentNode.SelectSingleNode("//div[@class='list_body newsflash_body']");

            //인제 그 밑에 있는 DL들을 모두 가져온다.
            HtmlNodeCollection DLs = mainnewsNode.SelectNodes(".//dl");


            //while(ARTICLES_TO_CRAWL > 0)
            {
                //DL 아래 : DT는 기사 제목을, DD는 기사 내용을 담는다.
                //DL들을 가져온 후, 각 DL 안에서 selectsinglenode로 DT와 DD를 가져온다.
                
                //일반 DT는 사진 섬네일이 없는 기사로, DT의 A의 text에서 기사 제목 추출
                //일반 DT의 DD는 곧바로 text에서 기사 내용 추출

                //class가 photo인 DT는 사진 섬네일이 달린 기사로, DT의 A의 IMG의 alt에서 기사 제목 추출
                //class가 photo인 DT의 DD는 곧바로 text에서 기사 내용 추출

                //for (int i = 0; i < ARTICLES_TO_CRAWL; i++ )
                foreach(HtmlNode a_DLNode in DLs)
                {
                    //HtmlNode a_DLNode = DLs.ElementAt(i);

                    HtmlNode a_DTNode = a_DLNode.SelectSingleNode(".//dt");
                    HtmlNode a_DDNode = a_DLNode.SelectSingleNode(".//dd");

                    //DT의 class가 "photo"인지 확인, 
                    if (a_DTNode.Attributes["class"] != null)
                    {
                        if (a_DTNode.Attributes["class"].Value.Equals("photo"))
                        {
                            //DTNode 아래의 <a> 아래의 img의 alt가 기사 제목을 가지고 있다.
                            HtmlNode article_a = a_DTNode.SelectSingleNode(".//img");
                            article_titles.Add(article_a.Attributes["alt"].Value);

                            //DDNode의 text가 기사 내용을 가지고 있다.
                            HtmlNode article_text = a_DTNode.SelectSingleNode(".//img");
                            article_contents.Add(a_DDNode.InnerText);
                            
                        }
                    }

                    else
                    {
                        //DTNode 아래의 <a>의 text가 기사 제목을 가지고 있다.
                        HtmlNode article_a = a_DTNode.SelectSingleNode(".//a");
                        article_titles.Add(article_a.InnerText);

                        //DDNode의 text가 기사 내용을 가지고 있다.
                        HtmlNode article_text = a_DTNode.SelectSingleNode(".//img");
                        article_contents.Add(a_DDNode.InnerText);
                            
                    }
                }


            }




                bWin.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                {
                    textbox.Text = "";

                    for (int i = 0; i < ARTICLES_TO_CRAWL; i++)
                    {
                        var output_title = Regex.Replace(article_titles.ElementAt(i), @"\s+", " ", RegexOptions.Singleline);
                        textbox.Text += "<" + output_title + ">\n";
                        var output_content = Regex.Replace(article_contents.ElementAt(i), @"\s+", " ", RegexOptions.Singleline);
                        //textbox.Text += "{" + article_contents.ElementAt(i) + "}\n\n";
                        textbox.Text += "{" + output_content + "}\n\n";

                    }


                }));

        }
Пример #17
0
        //박스가 날아다니기 시작할 것이다.
        public static void startjumping(Namyong namyong, ILwin.MainWindow thisWin)
        {
            //점프를 수행한다.

            int jumpY;

            for (jumpY = 0; jumpY < 50; jumpY++)
            {
                thisWin.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                {
                    namyong.namyongRec.Margin = new Thickness(namyong.namyongRec.Margin.Left, (namyong.ypos - jumpY * 3), 0, 0);
                }));

                Thread.Sleep(5);
            }

            Thread.Sleep(600);

            for (; jumpY > 0; jumpY--)
            {
                thisWin.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                {
                    namyong.namyongRec.Margin = new Thickness(namyong.namyongRec.Margin.Left, (namyong.ypos - jumpY * 3), 0, 0);
                }));

                Thread.Sleep(5);
            }


            //점프가 끝났음을 알린다.
            namyong.isJumping = false;

        }
Пример #18
0
        //이제 그 이미지를 화면에 표시하고, 아래로 추락시키는 스레드를 연결시킨다.
        public static void fallingItem(ILwin.ShowScreen showscreen, WebItem thisitem, bool isFinal)
        {
            int item_y = 0;


            while (true)
            {
                //현재 webitem의 margin top 값을 가져온다
                showscreen.getMWinReference().Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                    {
                        item_y = (int)thisitem.imgrec.Margin.Top;
                    }));

                Thread.Sleep(50);

                if (item_y > thisitem.FallYpos)
                {
                    break;
                }

                else
                {
                    showscreen.getMWinReference().Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                        {
                            thisitem.imgrec.Margin = new Thickness(thisitem.imgrec.Margin.Left, thisitem.imgrec.Margin.Top + 8,
                                thisitem.imgrec.Margin.Right, thisitem.imgrec.Margin.Bottom);

                        }));
                }

            }


            //마지막 webitem이라면 다 떨어질때까지 더 webitem을 호출하지 못하도록 블록을 시킨 걸 해제한다.
            if (isFinal == true)
            {
                showscreen.doingWebitem = false;

                //박스 이미지를 일반 이미지로 바꾼다.
                flyingBox.changeImg(showscreen.getFlyingboxReference(), showscreen.getMWinReference(), false);
            }
                
                
        }
Пример #19
0
        public static void fallingItem(Rectangle imgrec, ILwin.MainWindow mWin)
        {
            Thread.Sleep(200);
            imgrec.Margin = new Thickness(imgrec.Margin.Left, imgrec.Margin.Top + 3, imgrec.Margin.Right, imgrec.Margin.Bottom);

            mWin.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
            {
                
            }));
        }
Пример #20
0
        //박스가 날아다니기 시작할 것이다.
        public static void startmoving(Daddy daddy, ILwin.MainWindow thisWin)
        {
            int daddyLoc_x = 0;
            daddy.status = 0;


            while (true)
            {
                //현재 margin left 값을 가져온다
                thisWin.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                {
                    daddyLoc_x = (int)daddy.daddyRec.Margin.Left;
                }));

                Thread.Sleep(daddy.speedTerm);

                daddy.status = (daddy.status == 1) ? 0 : 1;

                thisWin.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                {
                    daddy.daddyRec.Fill = daddy.daddyBr[(2 * daddy.dir) + daddy.status];
                }));

                if (daddy.dir == LEFT)
                {
                    //왼쪽 벽에 다다르면
                    if (daddyLoc_x <= 0)
                    {
                        //방향은 오른쪽으로 바뀌고, 그림도 바뀌어야지.
                        daddy.dir = RIGHT;

                        //말풍선도 오른쪽으로 바뀌고, 말풍선 위치도 바뀐다.
                        thisWin.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                        {
                            daddy.balloon.rec.Background = daddy.balloon.ballBr[RIGHT];
                            daddy.balloon.rec.Margin = new Thickness(daddy.daddyRec.Margin.Left - Constants.DADDY_BALLOON_RIGHT_DIST, daddy.daddyRec.Margin.Top, 0, 0);
                        }));
                    }

                    //그렇지 않다면 계속 왼쪽으로 이동
                    else
                    {

                        thisWin.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                        {
                            daddy.daddyRec.Margin = new Thickness(daddy.daddyRec.Margin.Left - 2, daddy.daddyRec.Margin.Top,
                                daddy.daddyRec.Margin.Right, daddy.daddyRec.Margin.Bottom);

                            daddy.balloon.rec.Margin = new Thickness(daddy.balloon.rec.Margin.Left - 2, daddy.daddyRec.Margin.Top,
                                daddy.balloon.rec.Margin.Right, daddy.balloon.rec.Margin.Bottom);
                        }));
                    }
                }



                else if (daddy.dir == RIGHT)
                {
                    //왼쪽 벽에 다다르면
                    if (daddyLoc_x >= 640)
                    {
                        daddy.dir = LEFT;

                        //말풍선도 왼쪽으로 바뀌고, 말풍선 위치도 바뀐다.
                        thisWin.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                        {
                            daddy.balloon.rec.Background = daddy.balloon.ballBr[LEFT];
                            daddy.balloon.rec.Margin = new Thickness(daddy.daddyRec.Margin.Left + Constants.DADDY_BALLOON_LEFT_DIST, daddy.daddyRec.Margin.Top, 0, 0);
                        }));
                    }

                    //그렇지 않다면 계속 왼쪽으로 이동
                    else
                    {

                        thisWin.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                        {
                            daddy.daddyRec.Margin = new Thickness(daddy.daddyRec.Margin.Left + 2, daddy.daddyRec.Margin.Top,
                                daddy.daddyRec.Margin.Right, daddy.daddyRec.Margin.Bottom);

                            daddy.balloon.rec.Margin = new Thickness(daddy.balloon.rec.Margin.Left + 2, daddy.daddyRec.Margin.Top,
                                daddy.balloon.rec.Margin.Right, daddy.balloon.rec.Margin.Bottom);

                        }));
                    }
                }


            }


        }
 //타이머 함수. 로딩이 끝나면 잠시 후에 이걸 실행시킬 것이다.
 static void goto_mainwin(ILwin.InitWindow thiswin)
 {
     thiswin.dispatcherTimer.Stop();
     Window mainWin = new MainWindow(thiswin.packs);
     mainWin.Show();
     thiswin.Close();
     
 }
Пример #22
0
        //말풍선 메시지 내부의 스레드
        public static void setMSG(Balloon thisballoon, ILwin.MainWindow thisWin)
        {
            //5초 후, 메세지를 닫아버린다.
            Thread.Sleep(5000);

            thisWin.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
            {
                thisballoon.textbox.Visibility = Visibility.Hidden;
                thisballoon.rec.Visibility = Visibility.Hidden;
                thisballoon.textbox.Text = "";
            }));

            thisballoon.isShowing = false;
        }
Пример #23
0
        //web item을 떨어뜨리거나 할 때, 상자 이미지가 바뀔 것이다. 그것을 다루는 것.
        //bool opening이 true라면 열린 상자 이미지로, false라면 일반 상자 이미지로
        public static void changeImg(flyingBox flyingbox, ILwin.MainWindow thisWin, bool opening)
        {
            //열린 상자 이미지로 바꾸어라
            if(opening)
            {
                if(flyingbox.dir == LEFT)
                    thisWin.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                    {
                        flyingbox.boximg.Fill = flyingbox.boxBr[2];
                    }));

                else if(flyingbox.dir == RIGHT)
                    thisWin.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                    {
                        flyingbox.boximg.Fill = flyingbox.boxBr[3];
                    }));
            }

            //일반 상자 이미지로 바꾸어라
            else
            {
                if (flyingbox.dir == LEFT)
                    thisWin.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                    {
                        flyingbox.boximg.Fill = flyingbox.boxBr[0];
                    }));

                else if (flyingbox.dir == RIGHT)
                    thisWin.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                    {
                        flyingbox.boximg.Fill = flyingbox.boxBr[1];
                    }));
            }
        }
Пример #24
0
        //webImage를 생성한다. 하나의 query에 대해 주어진 개수만큼 이미지를 가져올 것이다.
        public static void generateWebImageThread(Datas datas, flyingBox flyingbox, string query, int start, int num, ILwin.ShowScreen showscreen)
        {

            List<string> urls = new List<string>();

            //string 리스트에 url을 필요한 개수만큼 받아온다.
            HTMLhandler.getImages(urls, num, query);

            //*************위 urlgetThread가 모두 끝날 때까지 기다린다. 그리고 나서 webitems를 추가하라.

            //박스 이미지를 변경. 열린 박스로 만든다
            flyingBox.changeImg(flyingbox, showscreen.getMWinReference(), true);

            for(int i = 0; i < num; i++)
            {
                //현재 플라잉 박스의 위치
                int flyingbox_x = 0;
                int flyingbox_y = 0;

                //마지막 web item인지를 확인
                bool isFinal = false;
                if (i == (num - 1)) isFinal = true;


                showscreen.getMWinReference().Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                {
                    flyingbox_x = (int)flyingbox.boximg.Margin.Left;
                    flyingbox_y = (int)flyingbox.boximg.Margin.Top;
                }));

                //가져온 string 리스트의 url을 하나하나 넣어 webItem를 생성한다.
                WebItem.addDatas(showscreen, datas.webItems.ElementAt(start + i), urls[i], flyingbox_x, flyingbox_y);
                WebItem.fallingItem(showscreen, datas.webItems.ElementAt(start + i), isFinal);
            }
        }
Пример #25
0
        //개발 중 테스트용으로 픽토그램을 움직이게 해 보았다. 
        public static void working(ILwin.MainWindow mWin, System.Windows.Shapes.Rectangle imgRec)
        {
            while (true)
            {

                for (int i = 0; i < 15; i++)
                {
                    mWin.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                    {
                        imgRec.Margin = new Thickness(imgRec.Margin.Left + 10, imgRec.Margin.Top,
                        imgRec.Margin.Right, imgRec.Margin.Bottom);
                    }));


                    Thread.Sleep(50);
                    //winRectangle.UpdateLayout()                
                }

                for (int i = 0; i < 15; i++)
                {
                    mWin.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                    {
                        imgRec.Margin = new Thickness(imgRec.Margin.Left - 10, imgRec.Margin.Top,
                        imgRec.Margin.Right, imgRec.Margin.Bottom);
                    }));


                    Thread.Sleep(50);
                }
            }

        }
Пример #26
0
        //박스가 날아다니기 시작할 것이다.
        public static void startmoving(flyingBox flyingbox, ILwin.MainWindow thisWin)
        {
            int boxLoc_x = 0;


            while (true)
            {
                //현재 margin left 값을 가져온다
            thisWin.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                    {
                        boxLoc_x = (int)flyingbox.boximg.Margin.Left;
                    }));

                Thread.Sleep(50);

                if (flyingbox.dir == LEFT)
                {
                    //왼쪽 벽에 다다르면
                    if (boxLoc_x <= 0)
                    {
                        //방향은 오른쪽으로 바뀌고, 그림도 바뀌어야지.
                        flyingbox.dir = RIGHT;
                        thisWin.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                        {
                            flyingbox.boximg.Fill = flyingbox.boxBr[1];
                        }));
                    }

                    //그렇지 않다면 계속 왼쪽으로 이동
                    else
                    {

                        thisWin.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                        {
                            flyingbox.boximg.Margin = new Thickness(flyingbox.boximg.Margin.Left - 2, flyingbox.boximg.Margin.Top,
                                flyingbox.boximg.Margin.Right, flyingbox.boximg.Margin.Bottom);
                        }));
                    }
                }



                else if (flyingbox.dir == RIGHT)
                {
                    //왼쪽 벽에 다다르면
                    if (boxLoc_x >= 640)
                    {
                        flyingbox.dir = LEFT;
                        thisWin.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                        {
                            flyingbox.boximg.Fill = flyingbox.boxBr[0];
                        }));
                    }

                    //그렇지 않다면 계속 왼쪽으로 이동
                    else
                    {

                        thisWin.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                        {
                            flyingbox.boximg.Margin = new Thickness(flyingbox.boximg.Margin.Left + 2, flyingbox.boximg.Margin.Top,
                                flyingbox.boximg.Margin.Right, flyingbox.boximg.Margin.Bottom);

                        }));
                    }
                }


            }


        }
Пример #27
0
        //텍스트를 계속 변하게 만드는 스레드이다.
        public static void changeColor(ILwin.MainWindow mWin, TextBox thetxt)
        {
    

            while (true)
            {
                mWin.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                    {
                        thetxt.Text = "물건";
                        thetxt.Margin = new Thickness(1, 5, 0, 0);
                    }));

                    Thread.Sleep(1000);

                    mWin.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                    {
                        thetxt.Text = "검색";
                        thetxt.Margin = new Thickness(53, 5, 0, 0);
                    }));

                    Thread.Sleep(1000);
                }


               
        }