Example #1
0
        private string Before(int sourcesNo, int windowNo, int channelNo, int bMode1, int bMode2, int bMode3, int bMode4, int count = 18, int rowCount = 3, int width = 1920, int heigh = 1080)
        {
            CloseWindow(windowNo + count);
            if (openWindows.Count > 0)
            {
                DataAnalysis.OpenWindow item = GetChanageWindowInfo(windowNo.ToString());
                if (item.SourceCh != "")
                {
                    return(string.Format("<move,{0},{1},{2},{3},{4},{5},{6},{7},{8},{9}>", item.W_ID, sourcesNo, item.src_hstart, item.src_hsize, item.src_vstart, item.src_vsize, item.x0, item.y0, item.x1, item.y1));
                }
            }
            int userNo = sourcesNo;

            if (windowNo > count)
            {
                if (windowNo % count == 0)
                {
                    windowNo = 1;
                }
                else
                {
                    windowNo = windowNo % count;
                }
            }
            int    splitNum = count / rowCount;
            int    m = 1, n = 0;
            int    x       = windowNo % splitNum;
            int    index   = userNo - 1;//windowNo - 1;
            string sources = sourcesNo.ToString();

            y = windowNo / splitNum;
            if (windowNo % splitNum == 1)
            {
                x = 1;
            }
            if (windowNo % splitNum == 0)
            {
                x = splitNum;
                --y;
            }


            int zx = 0, zy = 0;

            //if (index >= 18)
            //{
            //    //zx = width / 2;
            //    //zy = heigh / 2;
            //    m = 1; n = 0;
            //    x = (windowNo - 18) % 5;
            //    if ((windowNo - 18) % 5 == 1)
            //        x = 1;
            //    if ((windowNo - 18) % 5 == 0)
            //    {
            //        x = 5;
            //        --y;
            //    }
            //}
            //if (index >= 18 && index <= 22 && x <= 5)
            //{
            //    y = 0;
            //}
            //if (index >= 23 && index <= 27 && x <= 5)
            //    y = 1;
            //switch (channelNo)
            //{
            //    case 1:
            //        mode1 = 9;
            //        mode3 = 9;
            //        mode2 = 700;
            //        mode4 = 440;
            //        break;
            //    case 2:
            //        mode1 = 730;
            //        mode2 = 700;
            //        mode4 = 440;
            //        mode3 = 9;
            //        break;
            //    case 3:
            //        mode2 = 700;
            //        mode3 = 460;
            //        mode4 = 440;
            //        mode1 = 9;
            //        break;
            //    case 4:
            //        mode1 = 730;
            //        mode2 = 700;
            //        mode3 = 460;
            //        mode4 = 440;
            //        break;
            //    case 0:
            //        mode1 = 9;
            //        mode2 = 0;
            //        mode3 = 9;
            //        mode4 = 0;
            //        break;
            //}

            return(string.Format("<move,{0}, {1},{2},{3},{4},{5},{6},{7},{8},{9} >", index, sources, bMode1, bMode2, bMode3, bMode4, zx + width * (x - 1), (zy) + heigh * y, zx + (width * x - n), zy + (heigh * (y + 1) - m)));
        }
Example #2
0
        /// <summary>
        /// 打开窗口
        /// </summary>
        /// <param name="screenNo">屏幕号</param>
        /// <param name="screenWidth">窗口宽度</param>
        /// <param name="screenHeight">窗口高度</param>
        /// <param name="channelNo">通道号</param>
        /// <param name="sourcesNo">信号源</param>
        /// <param name="count">总窗口数量</param>
        /// <param name="rowCount">布局行数</param>
        public void OpenWindow(int screenNo, int screenWidth, int screenHeight, int channelNo, int sourcesNo, int count = 18, int rowCount = 3)
        {
            try
            {
                int userNo = screenNo;
                if (screenNo > count)
                {
                    if (screenNo % count == 0)
                    {
                        screenNo = count;
                    }
                    else
                    {
                        screenNo = screenNo % count;
                    }
                }
                int splitNum = count / rowCount;
                //int m = 0, n = 0;
                int x = screenNo % splitNum;
                //m = 1; n = 0;
                int index = userNo - 1;//screenNo - 1;
                nowWindowId = index;
                y           = screenNo / splitNum;
                if (screenNo % splitNum == 1)
                {
                    x = 1;
                }
                if (screenNo % splitNum == 0)
                {
                    x = splitNum;
                    --y;
                }

                int width = screenWidth, height = screenHeight;
                int oldWidth = 1920, oldHeight = 1080;
                int zx = 0, zy = 0;
                //if (index >= count)
                //{

                //    //zx = oldWidth / 2;
                //    //zy = oldHeight / 2;
                //    //m = 1; n = 0;
                //    x = (screenNo - count) % 5;
                //    if ((screenNo - count) % 5 == 1)
                //        x = 1;
                //    if ((screenNo - count) % 5 == 0)
                //    {
                //        x = 5;
                //        --y;
                //    }
                //}
                //if (index >= count && index <= 22)
                //{
                //    y = 0;
                //}
                //if (index >= 23 && index <= 27)
                //    y = 1;

                switch (channelNo)
                {
                case 0:
                    mode1 = 0;
                    mode2 = 0;
                    mode3 = 0;
                    mode4 = 0;
                    break;

                case 1:
                    if (modes.Length > 0)
                    {
                        mode1 = modes[0][0];
                        mode2 = modes[0][1];
                        mode3 = modes[0][2];
                        mode4 = modes[0][3];
                    }
                    break;

                case 2:
                    if (modes.Length > 0)
                    {
                        mode1 = modes[1][0];
                        mode2 = modes[1][1];
                        mode3 = modes[1][2];
                        mode4 = modes[1][3];
                    }
                    break;

                case 3:
                    if (modes.Length > 0)
                    {
                        mode1 = modes[2][0];
                        mode2 = modes[2][1];
                        mode3 = modes[2][2];
                        mode4 = modes[2][3];
                    }
                    break;

                case 4:
                    if (modes.Length > 0)
                    {
                        mode1 = modes[3][0];
                        mode2 = modes[3][1];
                        mode3 = modes[3][2];
                        mode4 = modes[3][3];
                    }
                    break;
                }
                //DataAnalysis.OpenWindow win = new DataAnalysis.OpenWindow() { Screen_ID = "0", SourceCh = sourcesNo.ToString(), W_ID = (index).ToString(), x0 = (zx + oldWidth * (x - 1)).ToString(), y0 = ((zy) + oldHeight * y).ToString(), x1 = (zx + (width * x - n)).ToString(), y1 = (zy + (height * (y + 1) - m)).ToString(), src_hstart = mode1.ToString(), src_hsize = mode2.ToString(), src_vstart = mode3.ToString(), src_vsize = mode4.ToString(), channelNo=channelNo.ToString() };
                DataAnalysis.OpenWindow win = new DataAnalysis.OpenWindow()
                {
                    Screen_ID = "0", SourceCh = sourcesNo.ToString(), W_ID = (index).ToString(), x0 = (zx + oldWidth * (x - 1)).ToString(), y0 = (zy + oldHeight * y).ToString(), x1 = (zx + (width + (oldWidth * (x - 1)))).ToString(), y1 = (zy + (height + (oldHeight * y)) - 1).ToString(), src_hstart = mode1.ToString(), src_hsize = mode2.ToString(), src_vstart = mode3.ToString(), src_vsize = mode4.ToString(), channelNo = channelNo.ToString()
                };
                //string cmd = "<open, 0, " + (index).ToString() + ", " + sourcesNo + "," + mode1 + "," + mode2 + "," + mode3 + "," + mode4 + "," + (zx + width * (x - 1)) + "," + ((zy) + height * y) + "," + (zx + (width * x - n)) + "," + (zy + (height * (y + 1) - m)) + " >";
                //string cmd = "<open, 0, " + (index).ToString() + ", " + sourcesNo + "," + mode1 + "," + mode2 + "," + mode3 + "," + mode4 + "," + (zx + width * (x - 1)) + "," + ((zy) + height * y) + "," + (zx + (width * x - n)) + "," + (zy + (height * (y + 1) - m)) + " >";
                string cmd = string.Format("<open,{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10}>", win.Screen_ID, win.W_ID, win.SourceCh, win.src_hstart, win.src_hsize, win.src_vstart, win.src_vsize, win.x0, win.y0, win.x1, win.y1);
                SendCmd(cmd);
                if (openWindows.Count == 0)
                {
                    openWindows.Add(win);
                }
                else
                {
                    if (!openWindows.Exists(o => o.W_ID == win.W_ID))
                    {
                        openWindows.Add(win);
                    }
                }
            }
            catch (Exception) { }
        }