Beispiel #1
0
        public FrmBIT()
        {
            //!< 오늘, 내일날씨
            //!< 현재 정류장명칭 214, 14  552, 62
            //!< 정류장 번호 214, 66  552, 96
            //!< 날짜 632, 20  758, 44
            //!< 시간 632, 50  758, 78
            //!< 진입중 180, 100  768, 186
            //!< 정보 시작 0, 252 각줄의 높이는 실제 84와 gap 2
            //!< 셀정보 X => 0-31 31-177, 179-261 261-296, 298-691 691-768

            //!< 광고 0, 767  768, 1289
            //!< 뉴스 0, 1290  768, 1366
            //!< 버스속성이미지 31 37 배경으로 사용, 84짜리 이미지 만들고, 위에서 23 떨어진 곳에 복사
            //!< 노선명 글자로 사용
            //!< 남은시간, 분이미지 35, 51. Marquee에서는 배경으로 사용, 84짜리 이미지 만들고, 위에서 16 떨어진 곳에 복사
            //!< 픽토그램 73 84 하단에 7654321 위치를 모르겠음, 이미지를 각각에 대해서 메모리로 만들고 Marquee에서는 배경으로 사용. 글자일 경우 스크롤
            //!< 픽토그램 다음의 경우 18(상단 각진 모서리 위치 55) 만큼 밀려서 출력한다. ==> n개에 대해 n(73 - 18) + 18
            //!< 7개인 경우
            //!< 첫차, 막차, 현위치 77(71만씀), 84 - 없을 경우 그냥 투명 이미지를 발라야 함. Marquee에서는 배경으로 사용


            XmlSerializer SerializerObj = new XmlSerializer(typeof(InfoCollection));
            FileStream    configStream  = new FileStream(@"viewconfig.xml", FileMode.Open, FileAccess.Read, FileShare.Read);//InfoConfig.xml

            ConfigObj = (InfoCollection)SerializerObj.Deserialize(configStream);
            configStream.Close();


            SerializerObj = new XmlSerializer(typeof(BITConfig));
            configStream  = new FileStream(@"bitconfig.xml", FileMode.Open, FileAccess.Read, FileShare.Read);//InfoConfig.xml
            ConfigBIT     = (BITConfig)SerializerObj.Deserialize(configStream);
            configStream.Close();

            Image colNum = Common.Utility.ToolSnippet.CreateTextImage("7             " +
                                                                      "6            5             4            3             2            1",
                                                                      new System.Drawing.Font("나눔고딕", 13.0F,
                                                                                              System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))),
                                                                      Color.Black, Color.Transparent);
            Image subPicto = Image.FromFile(ConfigBIT.BasePath + @"\Image\Vertical\버스방향.png");

            for (int i = 0; i < pictoImages.Length; i++)
            {
                pictoImages[i] = new Bitmap(400, 84, PixelFormat.Format32bppArgb);
                using (Graphics grD = Graphics.FromImage(pictoImages[i]))
                {
                    grD.DrawImage(subPicto, new Rectangle(new Point(i * (73 - 18), 0), new Size(subPicto.Width, subPicto.Height)),
                                  new Rectangle(new Point(0, 0), new Size(subPicto.Width, subPicto.Height)), GraphicsUnit.Pixel);
                    grD.DrawImage(colNum, new Rectangle(new Point(24, 66), new Size(colNum.Width, colNum.Height)),
                                  new Rectangle(new Point(0, 0), new Size(colNum.Width, colNum.Height)), GraphicsUnit.Pixel);
                }
            }

            InitializeComponent();

            InitLabel();
            InitInfoRow();

            _removeTimer = new System.Threading.Timer(new TimerCallback(nextPage), null, 0, pageGap);
            //_removeTimer.AutoReset = start;
            //_removeTimer.Elapsed += new System.Timers.ElapsedEventHandler(delegate { nextPage(); });

            tickTimer.Enabled    = true;
            label1.Location      = new Point(1000, 1000);
            label1.ForeColor     = Color.OrangeRed;
            this.FormBorderStyle = FormBorderStyle.None;
            Refresh();

            int multiOffset = 0;

            if (Screen.AllScreens.Length > 1)
            {
                multiOffset = Screen.PrimaryScreen.Bounds.Width;
            }
            int wgap = this.Width - this.ClientRectangle.Width;   //= bg.Width;
            int hgap = this.Height - this.ClientRectangle.Height; //= bg.Width;

            this.Width    = bg.Width + wgap;
            this.Height   = bg.Height + hgap;
            this.Location = new Point(multiOffset, 0);
            this.Size     = new Size(bg.Width + wgap, bg.Height + hgap);

            string zipPath     = @"D:\Workz\BitBucket\Purgatory.NET\BIT_TY\BIT_TY\DB\Master\20150830.zip";
            string extractPath = @"D:\Workz\BitBucket\Purgatory.NET\BIT_TY\BIT_TY\DB\Master";

            //Common.Utility.ToolSnippet.ExtractZipArchive(zipPath, extractPath);

            frmConsole.Show();

            _client = new Protocol_GGSN();
            _client.SocketActionHandler += new EventHandler <string>(frmConsole.SocketReceived);
            _client.InfoArrived         += delegate(List <PredictInfo> infos)
            {
                UpdateInfo(infos);
            };

            /*
             * _client.SocketActionHandler += delegate(object sender, string s)
             * {
             *  if (textBox1 == null)
             *      return;
             *  if (InvokeRequired)
             *  {
             *      textBox1.Invoke((MethodInvoker)delegate
             *      {
             *          textBox1.AppendText(s);
             *          textBox1.AppendText(Environment.NewLine);
             *      });
             *      return;
             *  }
             *  if (textBox1.IsAccessible && textBox1 != null)
             *  {
             *      textBox1.AppendText(s);
             *      textBox1.AppendText(Environment.NewLine);
             *  }
             *
             * };
             */
            _client.Connect();



            Refresh();
            //SetStyle(ControlStyles.SupportsTransparentBackColor, true);
            //this.BackColor = Color.Transparent;
        }