FrmVoteDetail.cs 96.9 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506
/*-------------------------------------------------------------------------------------------
 * 显示反馈键盘明细
 * 创建:杨斌 2011-11-16
 * 修改:杨斌 2012-01-09
 * ----------------------------------------------------------------------------------------*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using GeneralLib;
using System.Runtime.InteropServices;
using Excel = Microsoft.Office.Interop.Excel;
using System.IO;

namespace SunVoteARSPPT
{
    public partial class FrmVoteDetail : Form
    {
        /// <summary>
        /// 关闭时实际是隐藏
        /// </summary>
        public bool CloseIsHide { get; set; }

        /// <summary>
        /// 键盘状态画刷:在线
        /// </summary>
        private Brush BrushOnline;

        /// <summary>
        /// 键盘状态画刷:不在线
        /// </summary>
        private Brush BrushOffline;

        /// <summary>
        /// 键盘状态画刷:弱电
        /// </summary>
        private Brush BrushELV;

        /// <summary>
        /// 键盘状态画刷:已投票
        /// </summary>
        public Brush BrushVoted;

        /// <summary>
        /// 已投票答对状态画刷。杨斌 2018-07-17
        /// </summary>
        public Brush BrushCorrect;
        /// <summary>
        /// 已投票答错状态画刷。杨斌 2018-07-17
        /// </summary>
        public Brush BrushInCorrect;

        /// <summary>
        /// 键盘状态画刷:未投票
        /// </summary>
        private Brush BrushNoPress;

        /// <summary>
        /// 键盘状态画刷:签到码重复
        /// 创建:杨斌 2013-01-28
        /// </summary>
        private Brush BrushSameCode;

        public Units Map;//杨斌 2013-01-30

        //杨斌 2014-07-31
        private List<Brush> LstBrushColor = new List<Brush>();

        public FrmVoteDetail(Microsoft.Office.Interop.PowerPoint.Slide slideOut = null)
        {
            try
            {
                SlideOut = slideOut;

                IsInitialized = false;
                InitializeComponent();
                IsInitialized = true;

                //杨斌 2013-05-21
                GlobalInfo.SysLanguage.SetLanguage(this.Name, this, false);//杨斌 2020-04-29
                chkShowNoSignInOK.Text = GlobalInfo.SysLanguage.LPT.ReadString("FrmVoteDetail", "chkShowNoSignInOK", "只显示未签到");
                mySeat1.InitFontSize(25);

                Microsoft.Office.Interop.PowerPoint.Slide sldDetail = GetDetailSlide();
                TagSet tagSetSld = new TagSet(sldDetail.Tags);

                for (int i = 0; i < 10; i++)
                    LstBrushColor.Add(new SolidBrush(FrmChartSet.GetTagSetColor(tagSetSld, i)));

                pnlMapBack.BackColor = picMap.BackColor;
                pnlState.BackColor = picMap.BackColor;

                //初始化键盘状态画刷
                BrushOnline = new SolidBrush(lblOnlineColor.BackColor);
                BrushOffline = new SolidBrush(lblOfflineColor.ForeColor);
                BrushELV = new SolidBrush(lblWeakColor.ForeColor);
                BrushVoted = new SolidBrush(picVoted.BackColor);
                BrushNoPress = new SolidBrush(picNoPress.BackColor);
                //杨斌 2018-07-17
                BrushCorrect = new SolidBrush(GlobalInfo.sysConfig.ItemColorCW[0]);
                BrushInCorrect = new SolidBrush(GlobalInfo.sysConfig.ItemColorCW[1]);

                //杨斌 2013-01-28
                BrushSameCode = new SolidBrush(lblSameCode.BackColor);

                CloseIsHide = true;

                this.picMap.Image = null;

                Roster.LoadRoster();

                //屏蔽下面,在Response.InitRosterSignInCode赋值。杨斌 2014-10-28
                //this.SignInCodeIndex = Roster.SignInCodeIndex;

                this.RosterEnabled = Roster.RosterEnabled;
                //InitSignInMode();//多余调用。杨斌 2015-01-15

                //杨斌 2015-09-17
                pnlMapBack.MouseWheel += pnlMapBack_MouseWheel;
            }
            catch (Exception ex)
            {
                SystemLog.WriterLog(ex);
            }
        }
        /// <summary>
        /// 杨斌 2016-03-01
        /// </summary>
        private bool IsInitialized = false;

        //杨斌 2015-09-17
        void pnlMapBack_MouseWheel(object sender, MouseEventArgs e)
        {
            ReDrawMap();
        }

        public static bool IsPlayPPT
        {
            get
            {
                bool res = false;
                try
                {
                    res = (Globals.SunVoteARSAddIn.Application.ActivePresentation.SlideShowWindow != null);
                }
                catch { }
                return res;
            }
        }

        public Microsoft.Office.Interop.PowerPoint.Slide SlideOut = null;//杨斌 2017-06-06

        private Microsoft.Office.Interop.PowerPoint.Slide GetDetailSlide()
        {
            Microsoft.Office.Interop.PowerPoint.Slide res = null;

            if (SlideOut != null)//杨斌 2017-06-06
                res = SlideOut;
            else if (IsPlayPPT)
                res = Globals.SunVoteARSAddIn.PPTShow.SlideShow;
            else
                res = Globals.SunVoteARSAddIn.PPTEdit.SlideEdit;

            return res;
        }
        public void LoadDataValues()
        {
            cboDataValue.Items.Clear();
            cboDataValue.Items.Add("");
            bool beSortByValue = false;
            if ((GlobalInfo.OEMLogo == OEMLogos.oemAngage) || (GlobalInfo.OEMLogo == OEMLogos.oemPowerVote))
            {
                Microsoft.Office.Interop.PowerPoint.Slide sldDetail = GetDetailSlide();
                ResponseType resType = PPTOper.GetSlideType(sldDetail);
                TagSet tagSetSld = new TagSet(sldDetail.Tags);
                int optionCount = 10;
                switch (resType)
                {
                    case ResponseType.Choice:
                        beSortByValue = (tagSetSld.GetValue(TagKey.Choice_OptionLimit).ToInt == 1);
                        optionCount = tagSetSld.GetValue(TagKey.Choice_OptionCount).ToInt;
                        break;
                    case ResponseType.Grade:
                        beSortByValue = true;
                        optionCount = tagSetSld.GetValue(TagKey.Grade_OptionCount).ToInt;
                        break;
                    case ResponseType.Group:
                        beSortByValue = true;
                        optionCount = tagSetSld.GetValue(TagKey.Group_OptionCount).ToInt;
                        break;
                    case ResponseType.Judge:
                        beSortByValue = true;
                        optionCount = 2;
                        break;
                    case ResponseType.Vote:
                        beSortByValue = true;
                        optionCount = tagSetSld.GetValue(TagKey.Vote_OptionCount).ToInt;
                        break;
                }
                if (beSortByValue)
                {
                    bool isABCD = (tagSetSld.GetValue(TagKey.KeypadPara_OptionMode).ToInt == 1);
                    for (int i = 1; i <= optionCount; i++)
                    {
                        string value = i + "";
                        if (isABCD)
                            value = PPTOper.FormatNumABC(value);
                        cboDataValue.Items.Add(value);
                    }
                }
            }
            cboDataValue.SelectedIndex = 0;
        }
        /// <summary>
        /// 初始化签到参数,翻页时调用
        /// 创建:杨斌 2013-01-30
        /// </summary>
        public void InitSignInMode()
        {
            //SetShowRosterCol();//杨斌 2017-02-23

            //杨斌 2016-12-08
            Microsoft.Office.Interop.PowerPoint.Slide sldDetail = GetDetailSlide();
            TagSet tagSet = new TagSet(sldDetail.Tags);
            //初始化人员名单和签到码字段索引。杨斌 2015-01-15
            if (tagSet.GetValue(TagKey.SignIn_Mode).ToInt > 0)//杨斌 2017-03-30
                GlobalInfo.response.InitRosterSignInCode(sldDetail);
            this.SignInMode = tagSet.GetValue(TagKey.SignIn_Mode).ToInt;

            if (IsCodeSignIn())
            {
                //杨斌 2015-01-15
                bool isFromRoster = true;//是否从名单对应,否则从签到数据对应                
                if (isFromRoster)
                {
                    List<string> rosterKey = new List<string>();
                    for (int i = 0; i < Roster.Rows.Count; i++)
                    {
                        rosterKey.Add(Roster.Rows[i].Cells[0]);
                        string sCode = Roster.Rows[i].Cells[this.SignInCodeIndex];
                        string sKey = Roster.Rows[i].Cells[0];

                        //杨斌 2015-01-20。修复导致最后ResponseDB.SaveResponseData保存时Voters[keyIds].VoterID对象为空错误(keyIds==""不存在)
                        if (sKey.Length > 0)
                        {
                            if (GlobalInfo.response.ResponseDataList.Contains(sKey))
                                GlobalInfo.response.ResponseDataList[sKey].KeyValue = sCode;
                            else
                            {
                                ResponsePar r = new ResponsePar();
                                r.KeyID = sKey;
                                r.KeyValue = sCode;
                                GlobalInfo.response.ResponseDataList.Add(sKey, r);
                            }
                        }
                    }
                    for (int i = GlobalInfo.response.ResponseDataList.Count - 1; i >= 0; i--)
                    {
                        string sKey = GlobalInfo.response.ResponseDataList[i].KeyID;
                        if (!rosterKey.Contains(sKey))
                            GlobalInfo.response.ResponseDataList.Remove(sKey);
                    }
                }

                List<string> keylist = new List<string>();
                for (int i = 0; i < Roster.Rows.Count; i++)
                {
                    string sCode = Roster.Rows[i].Cells[this.SignInCodeIndex];
                    if (sCode.Length > 0)
                    {
                        if (!keylist.Contains(sCode))
                            keylist.Add(sCode);
                    }
                }
                VoterCount = keylist.Count;
            }
        }

        /// <summary>
        /// 分屏显示数
        /// 杨斌 2017-02-22
        /// </summary>
        public int NumOnePage = 0;
        /// <summary>
        /// 自动翻页秒数,若当前页已全部签到成功则立即翻页;若只显示未签到,有数据变化重新计时,否则超时翻页
        /// 杨斌 2017-02-22
        /// </summary>
        public int AutoPageTime = 0;
        /// <summary>
        /// 只查看未签到成功的
        /// </summary>
        public bool OnlyShowNotSignInOK = false;
        /// <summary>
        /// 自动翻页计时器
        /// </summary>
        public Timer TmrAutoPage = null;

        bool IsRandomUIDSignIn()
        {
            return IsCodeSignIn(true);
            //return (SystemConfig.KeypadType == "M30") && IsCodeSignIn(true);
        }
        /// <summary>
        /// 初始化签到坐席图。杨斌 2017-02-22
        /// </summary>
        public void InitSignInMap()
        {
            try
            {
                if (TmrAutoPage == null)
                {
                    TmrAutoPage = new Timer();
                    TmrAutoPage.Tick += TmrAutoPage_Tick;

                    mySeat1.OnPageClick = mySeat1_OnPageClick;
                }

                Microsoft.Office.Interop.PowerPoint.Slide sldDetail = GetDetailSlide();
                TagSet tagSet = new TagSet(sldDetail.Tags);

                bool isRandomUIDSignIn = IsRandomUIDSignIn();

                mySeat1.Clear();
                mySeat1.Visible = isRandomUIDSignIn;
                mySeat1.Parent = this;
                mySeat1.Location = this.ClientRectangle.Location;
                mySeat1.Size = this.ClientSize;
                mySeat1.BringToFront();

                chkShowNoSignInOK.Parent = mySeat1;
                chkShowNoSignInOK.Anchor = AnchorStyles.Right | AnchorStyles.Top;
                chkShowNoSignInOK.Location = new Point(mySeat1.ClientSize.Width - 210 - chkShowNoSignInOK.Width, 38);
                chkShowNoSignInOK.BringToFront();

                AutoPageTime = 0;

                //杨斌 2017-02-24
                if ((Globals.SunVoteARSAddIn.PPTShow.ResponseType == ResponseType.SignIn) &&
                    ((GlobalInfo.OEMLogo != OEMLogos.oemPowerVote) || (GlobalInfo.OEMLogo != OEMLogos.oemAngage)))//不自动弹出明细.杨斌 2018-03-22
                {
                    if (this.RosterEnabled)
                        this.ShowFull();
                }

                if (isRandomUIDSignIn)
                {
                    AutoPageTime = tagSet.GetValue(TagKey.SignIn_AutoPageTime).ToInt;

                    mySeat1.AddLabel(Color.Green, lblVoted.Tag);
                    mySeat1.AddLabel(Color.Green, 0);

                    string sVoted = lblVoted.Tag + "";
                    string sSame = lblSameCode.Tag + "";
                    string sAdd = sVoted.Substring(sVoted.Length - 1, 1);
                    if (sSame.Substring(sSame.Length - 1, 1) != sAdd)
                        sSame += sAdd;
                    mySeat1.AddLabel(Color.Red, sSame);
                    mySeat1.AddLabel(Color.Red, 0);

                    mySeat1.AddLabel(Color.Black, lblNoPress.Tag + "");
                    mySeat1.AddLabel(Color.Black, 0);

                    mySeat1.Refresh();

                    InitSignInMapRowCol(false);
                }
            }
            catch (Exception ex)
            {
                SystemLog.WriterLog(ex);
            }
        }

        /// <summary>
        /// 初始化每页显示个数,0=所有,1=20人,2=30人
        /// 杨斌 2017-02-23
        /// </summary>
        /// <param name="pgShowCount"></param>
        public void InitSignInMapRowCol(bool beJudge = true)
        {
            if (beJudge)
            {
                if (!IsRandomUIDSignIn())
                    return;
            }

            int pgShowCount = 0;

            if (Globals.SunVoteARSAddIn.frmVoteBar.IsVoteStart)
            {
                Microsoft.Office.Interop.PowerPoint.Slide sldDetail = GetDetailSlide();
                TagSet tagSet = new TagSet(sldDetail.Tags);
                pgShowCount = tagSet.GetValue(TagKey.SignIn_NumOnePage).ToInt;
            }

            if (pgShowCount == 1)
            {
                NumOnePage = 20;
                mySeat1.InitRowCol(5, 4);
            }
            else if (pgShowCount == 2)
            {
                NumOnePage = 30;
                mySeat1.InitRowCol(6, 5);
            }
            else
            {
                NumOnePage = Map.Count;
                if (NumOnePage > 130)
                    NumOnePage = 130;
                int rows = (int)Math.Pow(NumOnePage, 0.5);
                if (rows * rows < NumOnePage)
                    rows++;
                if (rows > 10)
                    rows = 10;
                int cols = NumOnePage / rows;
                if (NumOnePage % cols > 0)
                    rows++;
                mySeat1.InitRowCol(rows, cols);
            }

            MySeatUpdate();//杨斌 2017-02-23
        }

        private void mySeat1_OnPageClick(bool beNext)
        {
            if (TmrAutoPage.Enabled)//重新计时
            {
                TmrAutoPage.Enabled = false;
                TmrAutoPage.Enabled = true;
            }
        }

        void TmrAutoPage_Tick(object sender, EventArgs e)
        {
            mySeat1.PageNo++;
        }

        public RosterList Roster = new RosterList();//杨斌 2013-01-30

        /// <summary>
        /// 坐席图数据是否改变,用来判断是否需要刷新
        /// </summary>
        public bool MapDataChanged { get; private set; }

        /// <summary>
        /// 改变签到码签到相关的单元
        /// 创建:杨斌 2013-01-29
        /// </summary>
        /// <param name="ObjResponsePar"></param>
        //private void ChangeSignInCodeUnit(ResponsePar ObjResponsePar)
        //{
        //    if (IsCodeSignIn())
        //    {
        //        Unit unit = null;

        //        string sCode = ObjResponsePar.KeyValue;
        //        string sKeyID = ObjResponsePar.KeyID.ToString();

        //        if (Map.Contains(sCode))
        //        {
        //            unit = Map[sCode];

        //            if ((unit.Data + ",").IndexOf(sKeyID + ",") < 0)
        //            {
        //                if (unit.Data.Length > 0)
        //                    unit.Data = unit.Data + ",";
        //                unit.Data = unit.Data + sKeyID;
        //            }

        //            if (unit.Data.Length > 0)
        //            {
        //                if (unit.Data.IndexOf(",") >= 0)
        //                    unit.Brush = BrushSameCode;
        //                else
        //                    unit.Brush = BrushVoted;
        //            }
        //            else
        //                unit.Brush = BrushNoPress;

        //            if (cboShowRoster.SelectedIndex > 0)
        //            {
        //                for (int i = 0; i < Roster.Rows.Count; i++)
        //                {
        //                    string skeyFind = Roster.Rows[i].Cells[this.SignInCodeIndex];

        //                    if (skeyFind == sCode)
        //                    {
        //                        if (Roster.Rows[i].Cells[cboShowRoster.SelectedIndex] == sCode)
        //                            unit.Name = "";
        //                        else
        //                            unit.Name = Roster.Rows[i].Cells[cboShowRoster.SelectedIndex];
        //                        break;
        //                    }
        //                }
        //            }
        //            else
        //            {
        //                unit.Name = "";
        //            }
        //        }
        //    }
        //}        

        /// <summary>
        /// 获取已反馈的明细颜色。杨斌 2016-11-11
        /// </summary>
        private Brush GetBrushVoted(string data, int nameMode)
        {
            Brush res = BrushVoted;
            bool isColor = false;

            //杨斌 2016-12-08
            Microsoft.Office.Interop.PowerPoint.Slide sldDetail = GetDetailSlide();
            ResponseType resType = PPTOper.GetSlideType(sldDetail);
            TagSet tagSetSld = new TagSet(sldDetail.Tags);

            switch (resType)
            {
                case ResponseType.Choice:
                    int sel = tagSetSld.GetValue(TagKey.Choice_OptionLimit).ToInt;
                    isColor = (sel == 1);
                    break;
                case ResponseType.Vote:
                case ResponseType.Judge:
                case ResponseType.Group:
                case ResponseType.Grade:
                    isColor = true;
                    break;
            }
            if (isColor)
            {
                if (nameMode != 1)
                    isColor = false;
                if (data.Length > 1)
                    isColor = false;
            }
            if (isColor)
            {
                string s = "ABCDEFGHIJ";
                int n = s.IndexOf(data);
                if (n < 0)
                {
                    s = "1234567890";
                    n = s.IndexOf(data);
                }
                res = LstBrushColor[n];
            }
            return res;
        }

        /// <summary>
        /// 获取已反馈的明细对错颜色。杨斌 2018-07-17
        /// </summary>
        private Brush GetBrushCorrect(int correct, int nameMode, Brush brushDef)
        {
            Brush res = brushDef;// BrushVoted;

            //杨斌 2016-12-08
            Microsoft.Office.Interop.PowerPoint.Slide sldDetail = GetDetailSlide();
            ResponseType resType = PPTOper.GetSlideType(sldDetail);
            TagSet tagSetSld = new TagSet(sldDetail.Tags);

            if (IsShowCorrect && (nameMode == 1))//记名模式
            {
                string correctAnswer = "";
                switch (resType)
                {
                    case ResponseType.Choice:
                        correctAnswer = tagSetSld.GetValue(TagKey.Choice_CorrectAnswer).Value;
                        break;
                    case ResponseType.Judge:
                        correctAnswer = tagSetSld.GetValue(TagKey.Judge_CorrectAnswer).Value;
                        break;
                    case ResponseType.Number:
                    case ResponseType.Text:
                        correctAnswer = tagSetSld.GetValue(TagKey.Number_CorrectAnswer).Value;
                        break;
                    case ResponseType.Order:
                        correctAnswer = tagSetSld.GetValue(TagKey.Order_CorrectAnswer).Value;
                        break;
                }
                if (!string.IsNullOrEmpty(correctAnswer))//有设置正确答案                
                    res = (correct > 0) ? BrushCorrect : BrushInCorrect;
            }

            return res;
        }

        /// <summary>
        /// 坐席图数据改变,收到按键数据
        /// 修改:杨斌 2013-01-29
        /// </summary>
        /// <param name="ObjResponsePar"></param>
        public void ChangeData(ResponsePar ObjResponsePar)
        {
            //杨斌 2016-12-08
            Microsoft.Office.Interop.PowerPoint.Slide sldDetail = GetDetailSlide();
            ResponseType resType = PPTOper.GetSlideType(sldDetail);
            TagSet tagSetSld = new TagSet(sldDetail.Tags);

            if (IsCodeSignIn())
            {
                //for (int i = 0; i < GlobalInfo.response.ResponseDataList.Count; i++)
                //{
                //    string sKeyId = ObjResponsePar.KeyID.ToString();
                //    if (GlobalInfo.response.ResponseDataList.Contains(sKeyId))
                //    {
                //        ChangeSignInCodeUnit(GlobalInfo.response.ResponseDataList[sKeyId]);
                //        break;
                //    }
                //}
                //ChangeSignInCodeUnit(ObjResponsePar);

                InitMap(false);//EEE全部刷新,键盘个数较多时速度会较慢(暂不优化,因1个课堂人数几十个)

                if (SystemConfig.KeypadType == "M30")
                {
                    MySeatUpdate();//杨斌 2017-02-23

                    if (OnlyShowNotSignInOK)
                    {
                        if (TmrAutoPage.Enabled)//重新计时
                        {
                            TmrAutoPage.Enabled = false;
                            TmrAutoPage.Enabled = true;
                        }
                    }
                    //else
                    //{
                    //自动翻页
                    if (Globals.SunVoteARSAddIn.frmVoteBar.IsVoteStart && (mySeat1.PageMax > 0)
                        && (mySeat1.LstUpdateColor.Count == 1) && (mySeat1.LstUpdateColor[0] == ColorSignInOK)
                        && (GetMapStateCount(BrushVoted) < Map.Count))
                    {
                        mySeat1.PageNo++;

                        if (TmrAutoPage.Enabled)//重新计时
                        {
                            TmrAutoPage.Enabled = false;
                            TmrAutoPage.Enabled = true;
                        }
                    }
                    //}
                }
            }
            else
            {
                Unit unit = null;
                string skey = ObjResponsePar.KeyID.ToString();
                if (Map.Contains(skey))
                {
                    unit = Map[skey];
                }
                else
                {
                    if (Map.CountNoID > 0)
                    {
                        unit = Map[""];//查找第一个没有ID的单元
                        Map.RemoveAt(Map.CountHaveID);//移除没有ID的单元
                        unit.ID = skey;//设置ID
                        unit.Name = "";
                        Map.Add(unit);
                        unit = Map[skey];
                    }
                }

                if (unit == null) return;

                //杨斌 2016-04-27
                //if ((resType == ResponseType.Poll) && (GlobalInfo.OEMLogo2 == OEMLogos2.oemSunVoteMultiPoll) && PanelPoll.IsMultiPollKeypad())
                if (resType == ResponseType.Poll)
                {
                    unit.Data = "";
                    string[] ary = GlobalInfo.response.ResponseDataList[skey].KeyValue.Split(',');
                    foreach (var v in ary)
                    {
                        if (!string.IsNullOrEmpty(v))
                            unit.Data += v + ",";
                    }
                }
                else
                    unit.Data = ObjResponsePar.KeyValue + "";
                //杨斌 2012-06-27
                if (IsABCD)
                    unit.Data = PPTOper.FormatNumABC(unit.Data);
                unit.Data = PublicFunction.TrimEndStr(unit.Data, ",");

                //记名模式
                int nameMode = 1;
                switch (resType)
                {
                    case ResponseType.SignIn:
                    case ResponseType.Group:
                        nameMode = 1;
                        break;
                    default:
                        nameMode = tagSetSld.GetValue(TagKey.ResponsePara_NameMode).ToInt;
                        break;
                }
                Map.IsShowData = ((cboShowData.SelectedIndex == 2) && (nameMode == 1));//不记名不显示按键值

                //杨斌 2014-07-31
                //if (unit.Data.Length > 0) unit.Brush = BrushVoted;
                if (unit.Data.Length > 0)
                {
                    //杨斌 2019-12-04
                    unit.Brush = GetBrushVoted(unit.Data, nameMode);
                    unit.Brush = GetBrushCorrect(ObjResponsePar.Correct, nameMode, unit.Brush);
                    /*//技术支持要求颜色跟标准一样全开放?2019-12-03
                    if ((GlobalInfo.OEMLogo == OEMLogos.oemPowerVote)
                        || (GlobalInfo.OEMLogo == OEMLogos.oemAngage)//杨斌 2018-03-22
                        || (GlobalInfo.OEMLogo == OEMLogos.oemVoteExplorer)//杨斌 2018-12-27
                        || (GlobalInfo.OEMLogo == OEMLogos.SunVote))//杨斌 2019-05-21
                    {
                        unit.Brush = GetBrushVoted(unit.Data, nameMode);//函数有问题。data长度=1时绿色?应该多一个是否多选参数。2019-12-03
                        unit.Brush = GetBrushCorrect(ObjResponsePar.Correct, nameMode, unit.Brush);//杨斌 2019-08-02
                    }
                    else if (resType == ResponseType.Vote)
                    {
                        if ((resType == ResponseType.Vote) && (nameMode == 1))//不记名不显示颜色。杨斌 2016-04-14
                        {
                            switch (unit.Data)//杨斌 2014-09-05
                            {
                                case "1":
                                case "A":
                                    unit.Brush = LstBrushColor[0];
                                    break;
                                case "2":
                                case "B":
                                    unit.Brush = LstBrushColor[1];
                                    break;
                                case "3":
                                case "C":
                                    unit.Brush = LstBrushColor[2];
                                    break;
                                default:
                                    unit.Brush = BrushVoted;
                                    break;
                            }
                        }
                        else
                        {
                            unit.Brush = BrushVoted;
                        }
                    }
                    else
                    {
                        //unit.Brush = BrushVoted; 
                        unit.Brush = GetBrushCorrect(ObjResponsePar.Correct, nameMode, BrushVoted);//杨斌 2019-08-02
                    }//*/
                }
                else
                    unit.Brush = BrushNoPress;

                if (cboShowRoster.SelectedIndex > 0)
                {
                    for (int i = 0; i < Roster.Rows.Count; i++)
                    {
                        string skeyFind = Roster.Rows[i].Cells[0] + "";

                        if (skeyFind == skey)
                        {
                            if (cboShowRoster.SelectedIndex < Roster.Columns.Count)
                                unit.Name = Roster.Rows[i].Cells[cboShowRoster.SelectedIndex] + "";
                            else
                                unit.Name = "";
                            break;
                        }
                    }
                }
                else
                {
                    unit.Name = "";
                }

                //按值分组排序。杨斌 2015-05-20
                InitMapName();
                if ((resType == ResponseType.Vote) &&
                    (GlobalInfo.OEMLogo == OEMLogos.oemACTRONIX))
                {
                    //Map.SortByValue();
                    //ReDrawMap();                    
                    InitMap();
                    MapDataChanged = false;
                    return;
                }
            }

            //杨斌 2015-03-27。性能优化,放在计时器刷新时ChangeDataInitMap。
            //InitMapShowNoPress();
            //if (!IsCodeSignIn())//杨斌 2014-06-04。签到码签到,排序引起显示4大块
            //    Map.Sort();
            //InitMapLayoutAtuo();

            MapDataChanged = true;

            //ReDrawMap();//不立即刷新,统一在定时器刷新

        }

        /// <summary>
        /// 杨斌 2015-03-27
        /// </summary>
        public void ChangeDataInitMap()
        {
            InitMapShowNoPress();
            if (!IsCodeSignIn())//杨斌 2014-06-04。签到码签到,排序引起显示4大块
            {
                //杨斌 2015-05-21
                if (cboShowData.SelectedIndex == 3)
                    Map.SortByValue();
                else
                    Map.Sort();
            }
            InitMapLayoutAtuo();
        }


        /// <summary>
        /// 只显示未投,去掉坐席图有数据的单元
        /// </summary>
        private void InitMapShowNoPress()
        {
            try
            {
                if (cboShowData.SelectedIndex != 1) return;

                for (int i = Map.Count - 1; i >= 0; i--)
                {
                    if (Map[i].Data.Length > 0)
                        Map.RemoveAt(i);
                }
            }
            catch (Exception ex)
            {
                SystemLog.WriterLog(ex);
            }
        }

        /// <summary>
        /// 清空座席图数据
        /// </summary>
        public void ClearMapData()
        {
            //for (int i = 0; i < Map.Count; i++)
            //{
            //    Unit unit = Map[i];
            //    unit.Data = "";
            //    unit.Brush = BrushNoPress;
            //}
            //ReDrawMap();

            InitMap();
            if (IsRandomUIDSignIn())
                MySeatUpdate();//杨斌 2017-02-23
        }

        /// <summary>
        /// 签到成功的颜色
        /// 杨斌 2017-02-23
        /// </summary>
        private Color ColorSignInOK = Color.Green;
        /// <summary>
        /// 刷新签到坐席图
        /// 杨斌 2017-02-23
        /// </summary>
        public void MySeatUpdate()
        {
            mySeat1.LstCell.Clear();
            for (int i = 0; i < Roster.Rows.Count; i++)
            {
                string sCode = Roster.Rows[i].Cells[this.SignInCodeIndex];
                if (Map.Contains(sCode))
                {
                    string sName = Roster.Rows[i].Cells[1];
                    CellInfo ci = new CellInfo();
                    ci.Value = sName + "\r\n" + sCode;
                    ci.Visible = true;
                    if (Map[sCode].Brush == BrushVoted)
                        ci.Color = ColorSignInOK;
                    else if (Map[sCode].Brush == BrushSameCode)
                        ci.Color = Color.Red;
                    else
                        ci.Color = Color.Black;
                    mySeat1.LstCell.Add(ci);
                }
            }

            if (chkShowNoSignInOK.Checked)//只显示未签到成功的
            {
                foreach (var v in mySeat1.LstCell)
                {
                    if (v.Color == ColorSignInOK)
                        v.Visible = false;
                }
            }

            mySeat1.UpdateShow();
        }

        /// <summary>
        /// 参与反馈的人数,签到则为应到人数
        /// 修改:杨斌 2013-01-29
        /// </summary>
        public int VoterCount { get; set; }
        /// <summary>
        /// 签到成功人数
        /// 创建:杨斌 2013-01-29
        /// </summary>
        public int SignInOkCount = 0;

        /// <summary>
        /// 是显示ABCD,否显示1234
        /// 创建:杨斌 2012-06-27
        /// </summary>
        private bool IsABCD = false;
        /// <summary>
        /// 是否显示答对答错,对绿色,错红色。杨斌 2018-07-17
        /// 增加对错显示绿红,在ToolBar显示正确答案时。(原有:0所有键盘,1未反馈键盘,2按键值)2018-07-13
        /// </summary>
        public bool IsShowCorrect = false;

        /// <summary>
        /// 初始化坐席图,在翻页时调用
        /// </summary>
        public void InitMap(bool beRefreshMap = true)
        {
            ////return;//测试内存溢出
            try
            {
                //杨斌 2016-12-08。替代Globals.SunVoteARSAddIn.PPTShow.ResponseType、Globals.SunVoteARSAddIn.PPTShow.TagSetSlide
                Microsoft.Office.Interop.PowerPoint.Slide sldDetail = GetDetailSlide();
                ResponseType resType = PPTOper.GetSlideType(sldDetail);
                TagSet tagSetSld = new TagSet(sldDetail.Tags);

                if (Map == null)
                    Map = new Units(this.picMap.ClientSize.Width, this.picMap.ClientSize.Height);
                else
                    Map.Clear();

                Map.BackColor = picMap.BackColor;

                //杨斌 2015-01-16
                switch (resType)
                {
                    case ResponseType.Choice:
                    case ResponseType.Grade:
                    case ResponseType.Group:
                    case ResponseType.Judge:
                    case ResponseType.Vote:
                        IsABCD = (tagSetSld.GetValue(TagKey.KeypadPara_OptionMode).ToInt == 1);
                        break;
                    default:
                        IsABCD = false;
                        break;
                }

                //if (resType == ResponseType.Vote)//可以屏蔽。杨斌 2016-11-11
                {
                    LstBrushColor.Clear();
                    for (int i = 0; i < 10; i++)
                        LstBrushColor.Add(new SolidBrush(FrmChartSet.GetTagSetColor(tagSetSld, i)));
                }

                //杨斌 2015-05-19
                bool beShowVoteReport = ((resType == ResponseType.Vote) &&
                    (GlobalInfo.OEMLogo == OEMLogos.oemACTRONIX));
                btnReportVote.Visible = lblVoteCount.Visible = beShowVoteReport;

                //杨斌 2018-10-30
                bool beSortByValue = false;
                if ((GlobalInfo.OEMLogo == OEMLogos.oemAngage)
                    || (GlobalInfo.OEMLogo == OEMLogos.oemPowerVote)
                    || (GlobalInfo.OEMLogo == OEMLogos.SunVote))//杨斌 2019-05-20
                {
                    switch (resType)
                    {
                        case ResponseType.Choice:
                            beSortByValue = (tagSetSld.GetValue(TagKey.Choice_OptionLimit).ToInt == 1);
                            break;
                        case ResponseType.Grade:
                        case ResponseType.Group:
                        case ResponseType.Judge:
                        case ResponseType.Vote:
                            beSortByValue = true;
                            break;
                    }
                }

                //杨斌 2017-07-31
                btnImportData.Visible = (GlobalInfo.OEMLogo == OEMLogos.oemPowerVote)
                                     || (GlobalInfo.OEMLogo == OEMLogos.oemAngage);//杨斌 2018-03-22

                bool isCodeSignIn = IsCodeSignIn();
                IsSetCboShowData = true;

                ComboItem item = (ComboItem)(cboShowData.Items[2]);
                //杨斌 2015-01-16
                string showKeyText = GlobalInfo.SysLanguage.LPT.ReadString(this.Name, "ShowKeypadNo", "显示键盘编号");
                if (GlobalInfo.EnabledSN)
                    showKeyText = GlobalInfo.SysLanguage.LPT.ReadString(this.Name, "ShowSN", "显示SN");
                if (isCodeSignIn)
                    item.Name = showKeyText;
                else
                    item.Name = GlobalInfo.SysLanguage.LPT.ReadString(this.Name, "cboShowData_Text_2", "显示按键值");
                cboShowData.Items[2] = item;

                //杨斌 2015-05-21
                if (beShowVoteReport || beSortByValue)//杨斌 2018-10-31
                {
                    if (cboShowData.Items.Count < 4)
                    {
                        string showName = GlobalInfo.SysLanguage.LPT.ReadString(this.Name, "cboShowData_Text_3", "按结果分组");
                        ComboItem aItem = new ComboItem(3, showName, "");
                        cboShowData.Items.Add(aItem);
                    }
                }
                else
                {
                    if (cboShowData.Items.Count >= 4)
                    {
                        cboShowData.Items.RemoveAt(3);
                        if (cboShowData.SelectedIndex == -1)
                            cboShowData.SelectedIndex = 0;
                    }
                }
                IsSetCboShowData = false;

                IsSetShowRoster = true;
                if (cboShowRoster.Items[0].GetType().Name == "ComboItem")
                {
                    if (isCodeSignIn)
                        item.Name = "";
                    else
                        item.Name = Roster.Columns[0].ColumnName;
                    cboShowRoster.Items[0] = item;
                }
                else
                {
                    if (isCodeSignIn)
                        cboShowRoster.Items[0] = "";
                    else
                        cboShowRoster.Items[0] = Roster.Columns[0].ColumnName;
                }
                IsSetShowRoster = false;

                //记名模式
                int nameMode = 1;
                switch (resType)
                {
                    case ResponseType.SignIn:
                    case ResponseType.Group:
                        nameMode = 1;
                        break;
                    default:
                        nameMode = tagSetSld.GetValue(TagKey.ResponsePara_NameMode).ToInt;
                        break;
                }

                Map.IsShowData = ((cboShowData.SelectedIndex == 2) && (nameMode == 1));//不记名不显示按键值

                Map.DicShowDataShow.Clear();
                if ((resType == ResponseType.Vote) && ((GlobalInfo.OEMLogo == OEMLogos.oemPowerVote)
                                                    || (GlobalInfo.OEMLogo == OEMLogos.oemAngage)))//杨斌 2018-03-22
                {
                    Map.DicShowDataShow.Add("A", "Yes");
                    Map.DicShowDataShow.Add("B", "No");
                    Map.DicShowDataShow.Add("C", "Abstain");
                    Map.DicShowDataShow.Add("1", "Yes");
                    Map.DicShowDataShow.Add("2", "No");
                    Map.DicShowDataShow.Add("3", "Abstain");
                }

                //杨斌 2015-05-20
                //Map.IsCenterName = ((GlobalInfo.OEMLogo == OEMLogos.oemACTRONIX)
                //    && (resType == ResponseType.Vote));
                Map.IsCenterName = (GlobalInfo.OEMLogo == OEMLogos.oemACTRONIX);

                //bool isNoResponse = false;//true=非反馈类型
                switch (resType)
                {
                    case ResponseType.None:
                    case ResponseType.Slide:
                        //isNoResponse = true;
                        lblTotal.Tag = GlobalInfo.SysLanguage.LPT.ReadString(this.Name, "lblTotal_Participate", "参与人数:");
                        lblVoted.Tag = GlobalInfo.SysLanguage.LPT.ReadString(this.Name, "lblVoted_Response", "已提交:");
                        lblNoPress.Tag = GlobalInfo.SysLanguage.LPT.ReadString(this.Name, "lblNoPress_UnResponse", "未提交:");
                        //ReDrawMap();
                        //return;
                        break;
                    case ResponseType.SignIn:
                        lblTotal.Tag = GlobalInfo.SysLanguage.LPT.ReadString(this.Name, "lblTotal_Due", "应到人数:");
                        lblVoted.Tag = GlobalInfo.SysLanguage.LPT.ReadString(this.Name, "lblVoted_Arrive", "已到:");
                        lblNoPress.Tag = GlobalInfo.SysLanguage.LPT.ReadString(this.Name, "lblVoted_UnArrive", "未到:");
                        lblSameCode.Tag = GlobalInfo.SysLanguage.LPT.ReadString(this.Name, "lblSameCode", "签到码重复");//杨斌 2013-01-28
                        break;
                    default:
                        lblTotal.Tag = GlobalInfo.SysLanguage.LPT.ReadString(this.Name, "lblTotal_Participate", "参与人数:");
                        lblVoted.Tag = GlobalInfo.SysLanguage.LPT.ReadString(this.Name, "lblVoted_Response", "已提交:");
                        lblNoPress.Tag = GlobalInfo.SysLanguage.LPT.ReadString(this.Name, "lblNoPress_UnResponse", "未提交:");
                        break;
                }
                //杨斌 2013-01-30
                lblSameCode.Visible = ((resType == ResponseType.SignIn)
                                        && (this.SignInMode > 0));//杨斌 2017-03-30                               

                //非反馈幻灯片自动隐藏 杨斌 2012-03-06
                if (IsPlayPPT)//杨斌 2016-12-08
                {
                    switch (resType)
                    {
                        case ResponseType.Slide:
                        case ResponseType.None:
                            MapDataChanged = true;
                            ReDrawMap();
                            this.Hide();//自动隐藏
                            return;
                        default:
                            this.Visible = Globals.SunVoteARSAddIn.frmVoteBar.DetailShow;//恢复显示                        
                            break;
                    }
                }

                //无授权:无名单所有人(限人数);名单中的所有人(有键盘编号的 + 没键盘编号的限人数);
                //有授权,有键盘列表:指定名单、指定题目选项                
                List<string> keylist = new List<string>();

                if (IsCodeSignIn())//杨斌 2013-01-28
                {
                    for (int i = 0; i < Roster.Rows.Count; i++)
                    {
                        string sCode = Roster.Rows[i].Cells[this.SignInCodeIndex];
                        if (sCode.Length > 0)
                        {
                            if (!keylist.Contains(sCode))
                                keylist.Add(sCode);
                        }
                    }

                    VoterCount = keylist.Count;

                    for (int i = 0; i < VoterCount; i++)
                    {
                        Unit unit = new Unit();
                        unit.ID = keylist[i];
                        unit.Data = "";

                        Map.Add(unit);
                    }

                    //加载签到码对应名单数据。
                    for (int i = 0; i < GlobalInfo.response.ResponseDataList.Count; i++)
                    {
                        string sCode = GlobalInfo.response.ResponseDataList[i].KeyValue;
                        if (Map.Contains(sCode))
                        {
                            //string[] aryData = Map[sCode].Data.Split(new char[] { ',' });
                            //List<string> lstData = aryData.ToList<string>();
                            //if (!lstData.Contains(sCode))
                            //    lstData.Add(sCode);
                            //aryData = lstData.ToArray();
                            //Map[sCode].Data = string.Join(",", aryData);

                            //if (Map[sCode].Data.Length > 0)
                            //    Map[sCode].Data = Map[sCode].Data + ",";
                            //Map[sCode].Data = Map[sCode].Data + GlobalInfo.response.ResponseDataList[i].KeyID;
                            string sKeyID = GlobalInfo.response.ResponseDataList[i].KeyID.ToString();
                            if ((Map[sCode].Data + ",").IndexOf(sKeyID + ",") < 0)
                            {
                                if (Map[sCode].Data.Length > 0)
                                    Map[sCode].Data = Map[sCode].Data + ",";
                                Map[sCode].Data = Map[sCode].Data + sKeyID;
                            }
                        }
                    }

                    for (int i = 0; i < Map.Count; i++)
                    {
                        Unit unit = Map[i];
                        if (unit.Data.Length > 0)
                        {
                            if (unit.Data.IndexOf(",") >= 0)
                                unit.Brush = BrushSameCode;
                            else
                                unit.Brush = BrushVoted;
                        }
                        else
                            unit.Brush = BrushNoPress;
                    }
                    cboDataValue.Visible = false;//杨斌。2019-02-25
                }
                else
                {
                    if (GlobalInfo.response.IsAllPerson)
                    {
                        VoterCount = GlobalInfo.hardwareManage.PersonNum;

                        bool isSetKeypadNumber = false;

                        if (!GlobalInfo.response.EnableList)
                        {
                            string[] aryKey = PublicFunction.KeyIDSort();
                            if (aryKey.Length == VoterCount)
                            {
                                isSetKeypadNumber = true;
                                keylist = aryKey.ToList<string>();
                            }
                        }

                        if (!isSetKeypadNumber)
                        {
                            string[] aryKey = new string[GlobalInfo.response.ResponseDataList.Count];
                            GlobalInfo.response.ResponseDataList.Keys.CopyTo(aryKey, 0);
                            keylist = aryKey.ToList<string>();
                        }
                    }
                    else
                    {
                        VoterCount = GlobalInfo.response.AuthorKeypadList.Count;

                        keylist = GlobalInfo.response.AuthorKeypadList.Keys.ToList<string>();
                    }

                    for (int i = 0; i < VoterCount; i++)
                    {
                        Unit unit = new Unit();

                        if (i < keylist.Count)
                        {
                            unit.ID = keylist[i];
                        }

                        //unit.Data = "A";//调试
                        string skey = unit.ID + "";
                        if (GlobalInfo.response.ResponseDataList.Contains(skey))
                        {
                            //杨斌 2016-04-27
                            //if ((resType == ResponseType.Poll) && (GlobalInfo.OEMLogo2 == OEMLogos2.oemSunVoteMultiPoll) && PanelPoll.IsMultiPollKeypad())
                            if (resType == ResponseType.Poll)
                            {
                                unit.Data = "";
                                string[] ary = GlobalInfo.response.ResponseDataList[skey].KeyValue.Split(',');
                                foreach (var v in ary)
                                {
                                    if (!string.IsNullOrEmpty(v))
                                        unit.Data += v + ",";
                                }
                            }
                            else
                                unit.Data = GlobalInfo.response.ResponseDataList[skey].KeyValue + "";
                            //杨斌 2012-06-27
                            if (IsABCD)
                                unit.Data = PPTOper.FormatNumABC(unit.Data);
                            unit.Data = PublicFunction.TrimEndStr(unit.Data, ",");
                        }
                        else
                        {
                            unit.Data = "";
                        }
                        if (unit.Data.Length > 0)//杨斌 2014-07-31
                        {
                            //杨斌 2019-12-04
                            unit.Brush = GetBrushVoted(unit.Data, nameMode);
                            unit.Brush = GetBrushCorrect(GlobalInfo.response.ResponseDataList[skey].Correct, nameMode, unit.Brush);
                            /*//技术支持要求颜色跟标准一样全开放?2019-12-03
                            if ((GlobalInfo.OEMLogo == OEMLogos.oemPowerVote)
                                || (GlobalInfo.OEMLogo == OEMLogos.oemAngage)//杨斌 2018-03-22
                                || (GlobalInfo.OEMLogo == OEMLogos.oemVoteExplorer)//杨斌 2018-12-27
                                || (GlobalInfo.OEMLogo == OEMLogos.SunVote))//杨斌 2019-05-21
                            {
                                unit.Brush = GetBrushVoted(unit.Data, nameMode);//函数有问题。data长度=1时绿色?应该多一个是否多选参数。2019-12-03
                                unit.Brush = GetBrushCorrect(GlobalInfo.response.ResponseDataList[skey].Correct, nameMode, unit.Brush);//杨斌 2019-08-02
                            }
                            else if ((resType == ResponseType.Vote) && (nameMode == 1))//不记名不显示颜色。杨斌 2016-04-14
                            {
                                switch (unit.Data)//杨斌 2014-09-05
                                {
                                    case "1":
                                    case "A":
                                        unit.Brush = LstBrushColor[0];
                                        break;
                                    case "2":
                                    case "B":
                                        unit.Brush = LstBrushColor[1];
                                        break;
                                    case "3":
                                    case "C":
                                        unit.Brush = LstBrushColor[2];
                                        break;
                                    default:
                                        unit.Brush = BrushVoted;
                                        break;
                                }
                            }
                            else
                            {
                                //unit.Brush = BrushVoted;
                                unit.Brush = GetBrushCorrect(GlobalInfo.response.ResponseDataList[skey].Correct, nameMode, BrushVoted);//杨斌 2019-08-02
                            }//*/
                        }
                        else
                            unit.Brush = BrushNoPress;

                        //杨斌 2018-10-31
                        cboDataValue.Visible = beSortByValue;
                        if (cboDataValue.Visible)
                        {
                            string showValue = (cboDataValue.Text + "").Trim();
                            if (string.IsNullOrEmpty(showValue))
                                Map.Add(unit);
                            else if (unit.Data == showValue)
                                Map.Add(unit);
                        }
                        else
                        {
                            Map.Add(unit);
                        }
                    }
                }

                InitMapName();

                InitMapShowNoPress();

                if (!IsCodeSignIn())//杨斌 2013-03-28 签到码签到不排序签到码,保留导入名单的顺序
                {
                    //if ((resType == ResponseType.Vote) &&
                    //(GlobalInfo.OEMLogo == OEMLogos.oemACTRONIX))
                    if (cboShowData.SelectedIndex == 3)
                        Map.SortByValue();
                    else
                        Map.Sort();
                }

                InitMapLayoutAtuo();

                MapDataChanged = true;

                if (beRefreshMap)//增加判断立即刷新。杨斌 2017-02-24
                    ReDrawMap();
            }
            catch (Exception ex)
            {
                SystemLog.WriterLog(ex);
            }
        }

        /// <summary>
        /// 是否签到码签到
        /// 创建:杨斌 2013-01-28
        /// </summary>
        /// <returns></returns>
        public bool IsCodeSignIn(bool isRandomUID = false)
        {
            Microsoft.Office.Interop.PowerPoint.Slide sldDetail = GetDetailSlide();
            ResponseType resType = PPTOper.GetSlideType(sldDetail);

            bool res = false;
            if (isRandomUID)
                res = ((resType == ResponseType.SignIn) && (this.SignInMode == 2) && this.RosterEnabled);
            else
                res = ((resType == ResponseType.SignIn) && (this.SignInMode > 0) && this.RosterEnabled);

            return res;
        }

        /// <summary>
        /// 签到模式,窗体初始化时加载,避免重复查询影响速度
        /// 创建:杨斌 2013-01-28
        /// </summary>
        public int SignInMode = 0;

        /// <summary>
        /// 签到码字段列索引,窗体初始化时加载,避免重复查询影响速度
        /// 创建:杨斌 2013-01-28
        /// </summary>
        public int SignInCodeIndex = 0;

        /// <summary>
        /// 是否启用名单,窗体初始化时加载,避免重复查询影响速度
        /// 创建:杨斌 2013-01-28
        /// </summary>
        public bool RosterEnabled = false;

        /// <summary>
        /// 初始化坐席图显示的名单内容
        /// </summary>
        private void InitMapName()
        {
            if (Map == null) return;

            //杨斌 2014-09-15
            try
            {
                //GlobalInfo.response.ShowMapColList
                List<int> lstCol = new List<int>();
                if ((cboShowRoster.Items.Count > 0) && (cboShowRoster.SelectedIndex == (cboShowRoster.Items.Count - 1)))
                {
                    foreach (string col in GlobalInfo.response.ShowMapColList)
                    {
                        for (int i = 0; i < Roster.Columns.Count; i++)
                        {
                            if (Roster.Columns[i].ColumnName == col)
                                lstCol.Add(i);
                        }
                    }
                }

                //杨斌 2015-05-20
                string splName = " ";
                if (GlobalInfo.OEMLogo == OEMLogos.oemACTRONIX)
                    splName = "\r\n";

                if (IsCodeSignIn())//杨斌 2013-01-29
                {
                    Map.DrawID = false;//杨斌 2014-06-11
                    if ((cboShowRoster.SelectedIndex > 0) && Roster.RosterEnabled)
                    {
                        for (int i = 0; i < Roster.Rows.Count; i++)
                        {
                            string sCode = Roster.Rows[i].Cells[this.SignInCodeIndex];
                            if (Map.Contains(sCode))
                            {
                                if (lstCol.Count > 0)//杨斌 2014-09-15
                                {
                                    string s = "";
                                    foreach (int n in lstCol)
                                    {
                                        if (s.Length > 0)
                                            s += splName;//杨斌 2015-05-20
                                        s += " " + Roster.Rows[i].Cells[n];
                                        Map[sCode].Name = s;
                                    }
                                }
                                else
                                {
                                    //杨斌 2017-02-23
                                    Map[sCode].Name = sCode;
                                    if (cboShowRoster.SelectedIndex >= (cboShowRoster.Items.Count - 1))
                                    {
                                        Map[sCode].Name = Roster.Rows[i].Cells[1];
                                    }
                                    else
                                    {
                                        //if (Roster.Rows[i].Cells[cboShowRoster.SelectedIndex] == sCode)
                                        if (Roster.Rows[i].Cells[cboShowRoster.SelectedIndex] == sCode)
                                            Map[sCode].Name = "";
                                        else
                                        {
                                            if (cboShowRoster.SelectedIndex < Roster.Columns.Count)//杨斌 2014-10-24
                                                Map[sCode].Name = Roster.Rows[i].Cells[cboShowRoster.SelectedIndex];
                                        }
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        for (int i = 0; i < Map.Count; i++)
                        {
                            Map[i].Name = "";
                        }
                    }
                }
                else
                {
                    Map.DrawID = true;//杨斌 2014-06-11
                    Map.DrawID = (lstCol.Count < 1);//杨斌 2014-09-16
                    if ((cboShowRoster.SelectedIndex > 0) && Roster.RosterEnabled)
                    {
                        for (int i = 0; i < Roster.Rows.Count; i++)
                        {
                            string skey = Roster.Rows[i].Cells[0] + "";
                            if (Map.Contains(skey))
                            {
                                if (lstCol.Count > 0)//杨斌 2014-09-15
                                {
                                    string s = "";
                                    foreach (int n in lstCol)
                                    {
                                        if (s.Length > 0)
                                            s += splName;//杨斌 2015-05-20
                                        s += Roster.Rows[i].Cells[n];
                                        Map[skey].Name = s;
                                    }
                                }
                                else
                                {
                                    if (cboShowRoster.SelectedIndex < Roster.Columns.Count)//杨斌 2014-10-24
                                        Map[skey].Name = Roster.Rows[i].Cells[cboShowRoster.SelectedIndex];
                                }
                            }
                        }
                    }
                    else
                    {
                        for (int i = 0; i < Map.Count; i++)
                        {
                            Map[i].Name = "";
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                SystemLog.WriterLog(ex);
            }
        }

        /// <summary>
        /// 关闭并释放资源
        /// </summary>
        public void CloseAndFree()
        {
            CloseIsHide = false;
            this.Close();
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        //杨斌 2014-09-15
        private void SetShowRosterCol()
        {
            IsSetShowRoster = true;
            try
            {
                if (GlobalInfo.response.ShowMapColList.Count > 0)
                {
                    if (cboShowRoster.Items.Count > 0)
                        cboShowRoster.SelectedIndex = cboShowRoster.Items.Count - 1;
                }
                else
                {
                    try//杨斌 2017-02-23
                    {
                        cboShowRoster.Text = GlobalInfo.response.ShowMapCol;
                    }
                    catch { }
                }
            }
            catch
            {
                if (cboShowRoster.Items.Count > 0) cboShowRoster.SelectedIndex = 0;
            }
            IsSetShowRoster = false;
        }

        private void FrmVoteDetail_Load(object sender, EventArgs e)
        {
            ////GlobalInfo.SysLanguage.SetLanguage(this.Name, this);//防止构造函数里

            //2013-2-19 增加全屏显示文字
            btnFullScreen.Text = GlobalInfo.SysLanguage.LPT.ReadString(this.Name, "FullScreen", "全屏显示");

            ////CloseIsHide = true;//杨斌 2016-12-26。屏蔽

            cboShowRoster.Items.Clear();
            //2013-3-19 未启用名单时,屏蔽
            cboShowRoster.Enabled = GlobalInfo.response.EnableList;
            for (int i = 0; i < Roster.Columns.Count; i++)
            {
                if (IsCodeSignIn())
                {
                    if (i == 0)
                    {
                        cboShowRoster.Items.Add(GlobalInfo.SysLanguage.LPT.ReadString(this.Name, "SignCode", "签到码"));
                        continue;
                    }
                }
                cboShowRoster.Items.Add(Roster.Columns[i].ColumnName);
            }
            //杨斌 2014-09-09
            if (Roster.Columns.Count > 0)
            {
                string s = GlobalInfo.SysLanguage.LPT.ReadString("FrmShowCol", "CustomCol", "Custom..");
                cboShowRoster.Items.Add(s);
            }

            //杨斌 2014-09-15
            SetShowRosterCol();

            //杨斌 2016-12-08
            Microsoft.Office.Interop.PowerPoint.Slide sldDetail = GetDetailSlide();
            ResponseType resType = PPTOper.GetSlideType(sldDetail);

            //显示数据的默认值。杨斌 2015-05-21
            if ((resType == ResponseType.Vote)
                && (GlobalInfo.OEMLogo == OEMLogos.oemACTRONIX))
                cboShowData.SelectedIndex = 3;
            else
                cboShowData.SelectedIndex = 0;
            chkShowData.Text = lblShowData.Text;
            //chkShowData.Checked = false;//屏蔽。杨斌 2015-05-21
            //chkShowData_CheckedChanged(null, null);

            if (IsPlayPPT)
            {
                this.Size = new Size(Screen.PrimaryScreen.Bounds.Width, 300);//旧值175
                this.Location = new Point(0, Screen.PrimaryScreen.Bounds.Height - this.Height - Globals.SunVoteARSAddIn.PPTShow.FrmVoteBar.Height);
            }
            else
            {
                string pos = INIControl.GetInstances(GlobalInfo.SYSTEM_CONFIG_PATH).ReadString("System", "ShowDetailPos", "");
                string[] aryPos = pos.Split(',');
                if (aryPos.Length >= 4)
                {
                    try
                    {
                        int x = 0;
                        int y = 0;
                        int w = 0;
                        int h = 0;
                        int.TryParse(aryPos[0], out x);
                        int.TryParse(aryPos[1], out y);
                        int.TryParse(aryPos[2], out w);
                        int.TryParse(aryPos[3], out h);
                        this.Location = new Point(x, y);
                        if ((w > 0) && (h > 0))
                            this.Size = new Size(w, h);
                    }
                    catch { }
                }
            }

            //InitMap();
        }
        /// <summary>
        /// 杨斌 2020-04-29。C5641 - 东莞松山湖网络特殊定制
        /// </summary>
        internal void ShowVoteNameList(bool show)
        {
            panVoteNameList.Visible = show;
            if (show)
            {
                panVoteNameList.Parent = this;
                panVoteNameList.BringToFront();
                panVoteNameList.Location = new Point(0, 0);
                panVoteNameList.Size = this.ClientSize;
            }
        }
        private void FrmVoteDetail_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (CloseIsHide)
            {
                e.Cancel = true;
                this.Hide();
                if (Globals.SunVoteARSAddIn.frmVoteBar != null)//杨斌 2012-03-23
                {
                    Globals.SunVoteARSAddIn.frmVoteBar.DetailShow = false;
                    try
                    {
                        Globals.SunVoteARSAddIn.PPTShow.FrmVoteBar.ddbAnalyzer.Enabled = !Globals.SunVoteARSAddIn.PPTShow.FrmVoteBar.DetailShow;//杨斌 2019-11-26
                    }
                    catch { }
                }
            }
        }

        /// <summary>
        /// 退出时是否保存位置大小。杨斌 2016-12-26
        /// </summary>
        public bool SavePos = false;
        private void FrmVoteDetail_FormClosed(object sender, FormClosedEventArgs e)
        {
            try
            {
                if (!IsPlayPPT && SavePos)
                {
                    string pos = this.Left + "," + this.Top + "," + this.Width + "," + this.Height;
                    INIControl.GetInstances(GlobalInfo.SYSTEM_CONFIG_PATH).WriteValue("System", "ShowDetailPos", pos);
                }
            }
            catch { }
            if (TmrAutoPage != null)//修复PowerVote在PPT主界面打开明细无法关闭问题。杨斌 2017-03-13。
                TmrAutoPage.Stop();//杨斌 2017-03-02            
        }

        /// <summary>
        /// 最小化前的窗体状态
        /// 杨斌 2015-09-16
        /// </summary>
        public FormWindowState NowWindowState = FormWindowState.Normal;
        const int WM_SYSCOMMAND = 0x112;
        const int SC_CLOSE = 0xF060;
        const int SC_MINIMIZE = 0xF020;
        const int SC_MAXIMIZE = 0xF030;
        protected override void WndProc(ref Message m)
        {
            if (m.Msg == WM_SYSCOMMAND)
            {
                if (m.WParam.ToInt32() == SC_MINIMIZE)
                {
                    NowWindowState = this.WindowState;
                    ////return;
                }
            }
            base.WndProc(ref m);
        }

        private Size SizePre;
        private Point PointPre;
        private bool IsFull = false;
        //双击全屏
        private void picMap_DoubleClick(object sender, EventArgs e)
        {
            FullScreenChange();
        }

        //双击全屏
        private void pnlState_DoubleClick(object sender, EventArgs e)
        {
            FullScreenChange();
        }

        /// <summary>
        /// 全屏显示。
        /// 杨斌 2015-01-15
        /// </summary>
        public void ShowFull()
        {
            if (!this.Visible)
                this.Show();
            ControlOper.CenterForm(this, true);//杨斌 2014-11-06
            this.WindowState = FormWindowState.Maximized;
            btnFullScreen.Text = GlobalInfo.SysLanguage.LPT.ReadString(this.Name, "NormalScreen", "退出全屏");
            if (Globals.SunVoteARSAddIn.frmVoteBar != null)
                Globals.SunVoteARSAddIn.frmVoteBar.DetailShow = true;
        }

        /// <summary>
        /// 全屏改变,双击调用
        /// </summary>
        public void FullScreenChange()
        {
            //2013-2-19 增加全屏显示按钮文字
            if (this.WindowState == FormWindowState.Normal)
            {
                ControlOper.CenterForm(this, true);//杨斌 2014-11-06
                this.WindowState = FormWindowState.Maximized;
                btnFullScreen.Text = GlobalInfo.SysLanguage.LPT.ReadString(this.Name, "NormalScreen", "退出全屏");
            }
            else
            {
                this.WindowState = FormWindowState.Normal;
                if (IsPlayPPT)
                    this.Location = new Point((Screen.PrimaryScreen.Bounds.Width - this.Width) / 2,
                        Screen.PrimaryScreen.Bounds.Height - this.Height - Globals.SunVoteARSAddIn.PPTShow.FrmVoteBar.Height);
                btnFullScreen.Text = GlobalInfo.SysLanguage.LPT.ReadString(this.Name, "FullScreen", "全屏显示");
            }
        }

        private void btnExit_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        /// <summary>
        /// 坐席图布局
        /// </summary>
        private void InitMapLayoutAtuo_old()
        {
            if (Map == null) return;
            try
            {
                int count = picMap.ClientSize.Width * pnlMapBack.ClientSize.Height / 2500;//自动根据面积计算个数 杨斌 2010-01-06

                //杨斌 2012-10-15
                if (cboShowData.SelectedIndex == 2)//按键明细
                {
                    count = picMap.ClientSize.Width * pnlMapBack.ClientSize.Height / 2000;
                }
                else
                {
                    //杨斌 2012-10-15
                    if (Map.Count > 500)
                        count = picMap.ClientSize.Width * pnlMapBack.ClientSize.Height / 1000;
                    else
                        count = picMap.ClientSize.Width * pnlMapBack.ClientSize.Height / 2000;
                }

                if (count < 5) count = 5;
                Map.MaxColCount = 0;
                //this.Text = count.ToString();
                Map.InitUnitsLayoutAtuo(count, picMap.ClientSize.Width, pnlMapBack.ClientSize.Height, picMap);
                //picMap.CreateGraphics().Clear(picMap.BackColor);//先清空避免尺寸改变时难看
            }
            catch (Exception ex)
            {
                SystemLog.WriterLog(ex);
            }
        }

        /// <summary>
        /// 坐席图布局
        /// 杨斌 2015-09-17
        /// </summary>
        private void InitMapLayoutAtuo()
        {
            if (Map == null) return;
            try
            {
                int count = picMap.ClientSize.Width * pnlMapBack.ClientSize.Height / 3500;//自动根据面积计算个数 杨斌 2010-01-06

                //杨斌 2012-10-15
                if (cboShowData.SelectedIndex == 2)//按键明细
                {
                    count = picMap.ClientSize.Width * pnlMapBack.ClientSize.Height / 5000;
                }
                else
                {
                    //杨斌 2012-10-15
                    if (Map.Count > 400)
                        count = picMap.ClientSize.Width * pnlMapBack.ClientSize.Height / 2500;
                    else
                        count = picMap.ClientSize.Width * pnlMapBack.ClientSize.Height / 3000;
                }

                if (count < 5) count = 5;
                Map.MaxColCount = 0;
                //this.Text = count.ToString();
                Map.InitUnitsLayoutAtuo(count, picMap.ClientSize.Width, pnlMapBack.ClientSize.Height, picMap);
                //picMap.CreateGraphics().Clear(picMap.BackColor);//先清空避免尺寸改变时难看
            }
            catch (Exception ex)
            {
                SystemLog.WriterLog(ex);
            }
        }

        private void FrmVoteDetail_Resize(object sender, EventArgs e)
        {
            if (!IsInitialized)//杨斌 2016-03-01
                return;

            if (Map == null)
            {
                InitMap();
            }

            InitMapLayoutAtuo();

            MapDataChanged = true;

            ReDrawMap();
        }

        /// <summary>
        /// 重绘坐席图,一般是窗体打开或尺寸改变时
        /// 创建:杨斌 2010-07-14
        /// </summary>
        public void ReDrawMap()
        {
            if (!MapDataChanged) return;//未改变不需刷新

            if (picMap.IsDisposed) return;

            ShowMapStateCount();

            if ((GlobalInfo.OEMLogo == OEMLogos.oemiPericles) && (GlobalInfo.OEMLogo2 == OEMLogos2.oemHideData))//杨斌 2020-03-06
            {
                for (int i = 0; i < Map.Count; i++)
                {
                    var unit = Map[i];
                    if (unit.Data.Length > 0)
                    {
                        unit.Data = "OK";
                        unit.Brush = BrushVoted;
                    }
                }
            }

            //Map.DrawAllUnits(picMap.CreateGraphics());
            Map.DrawVisibleUnits(picMap, pnlMapBack);//杨斌 2012-10-11
            SetBitmap();
        }

        /// <summary>
        /// 设置坐席图图片
        /// 创建:杨斌 2010-07-14
        /// </summary>
        private void SetBitmap()
        {
            try
            {
                if (picMap.IsDisposed) return;
                if (Map.Count > 0)
                    this.picMap.BackgroundImage = Map.Bitmap;
                else
                    this.picMap.BackgroundImage = null;//杨斌 2019-05-09
                //this.picMap.Image = Map.Bitmap;

                //string file = GlobalInfo.APP_DIR + @"\bin\Map.Bitmap.bmp";
                //Map.Bitmap.Save(file);

                //file = GlobalInfo.APP_DIR + @"\bin\picMap.Visible=" + picMap.Visible +
                //                    " picMap.BackgroundImage=null " + (picMap.BackgroundImage == null) +
                //                    " mySeat1.Visible=" + mySeat1.Visible + ".bmp";
                //this.picMap.BackgroundImage.Save(file);

                //this.Text = picMap.Left + "," + picMap.Top + " " + picMap.Width + "x" + picMap.Height;

                //file = GlobalInfo.APP_DIR + @"\bin\picMap.Visible=" + picMap.Visible + 
                //    " picMap.Image=null " + (picMap.Image == null) + " mySeat1.Visible=" + mySeat1.Visible + ".bmp";
                //this.picMap.Image.Save(file);
            }
            catch (Exception ex)
            {
                SystemLog.WriterLog(ex);
            }
        }

        /// <summary>
        /// 刷新反馈状态统计数据
        /// </summary>
        public void ShowMapStateCount()
        {
            Microsoft.Office.Interop.PowerPoint.Slide sldDetail = GetDetailSlide();
            ResponseType resType = PPTOper.GetSlideType(sldDetail);

            switch (resType)
            {
                case ResponseType.None:
                case ResponseType.Slide://杨斌 2012-03-06
                    lblTotal.Text = lblTotal.Tag + "0";
                    lblVoted.Text = lblVoted.Tag + "0";
                    lblNoPress.Text = lblNoPress.Tag + "0";
                    break;
                case ResponseType.SignIn:
                    int countMeeting = VoterCount;
                    //int noCome = GetMapStateCount(BrushNoPress);
                    //int come = countMeeting - noCome;
                    //杨斌 2013-01-29
                    int come = GetMapStateCount(BrushVoted);
                    int noCome = countMeeting - come;
                    SignInOkCount = come;

                    lblTotal.Text = lblTotal.Tag + countMeeting.ToString();
                    lblVoted.Text = lblVoted.Tag + come.ToString();
                    lblNoPress.Text = lblNoPress.Tag + noCome.ToString();

                    if (IsRandomUIDSignIn())
                    {
                        //int same = GetMapStateCount(BrushSameCode);
                        int same = GetSignInSameCount();
                        mySeat1.ShowLabel(null, come, null, same, null, noCome);

                        if (come == VoterCount)//杨斌 2017-03-23
                        {
                            if (this.Visible)
                                this.Close();
                        }

                        ////Globals.SunVoteARSAddIn.PPTEdit.InitChart(true, Globals.SunVoteARSAddIn.PPTShow.SlideShow);//杨斌 2017-03-30
                    }

                    break;
                default:
                    int countVote = VoterCount;
                    int noPress = GetMapStateCount(BrushNoPress);
                    int voted = countVote - noPress;
                    lblTotal.Text = lblTotal.Tag + countVote.ToString();
                    lblVoted.Text = lblVoted.Tag + voted.ToString();
                    lblNoPress.Text = lblNoPress.Tag + noPress.ToString();
                    break;
            }

            if (resType == ResponseType.Vote)
            {
                Dictionary<string, int> dicVote = GetMapVoteCount();
                int countYes = 0;
                int countNo = 0;
                int countAbs = 0;
                if (dicVote.ContainsKey("1"))
                    countYes = dicVote["1"];
                if (dicVote.ContainsKey("2"))
                    countNo = dicVote["2"];
                if (dicVote.ContainsKey("3"))
                    countAbs = dicVote["3"];

                string lbYes = GlobalInfo.SysLanguage.LPT.ReadString(this.Name, "LBYes", "赞成:");
                string lbNo = GlobalInfo.SysLanguage.LPT.ReadString(this.Name, "LBNo", "反对:");
                string lbAbs = GlobalInfo.SysLanguage.LPT.ReadString(this.Name, "LBAbs", "弃权:");
                lblVoteCount.Text = lbYes + countYes + "  " + lbNo + countNo + "  " + lbAbs + countAbs;

                //杨斌 2020-04-29
                if (GlobalInfo.OEMLogo2 == OEMLogos2.oemShowVoteNameList)
                {
                    TagSet tagSet = new TagSet(sldDetail.Tags);
                    lblVoteYes.ForeColor = pnlVoteYes.BackColor = pnlVoteYesB.BackColor = FrmChartSet.GetTagSetColor(tagSet, 0);
                    lblVoteNo.ForeColor = pnlVoteNo.BackColor = pnlVoteNoB.BackColor = FrmChartSet.GetTagSetColor(tagSet, 1);
                    lblVoteAbs.ForeColor = pnlVoteAbs.BackColor = pnlVoteAbsB.BackColor = FrmChartSet.GetTagSetColor(tagSet, 2);
                    lblVoteYes.Text = GlobalInfo.SysLanguage.LPT.ReadString("PPTOper", "VoteAgree", "赞成");
                    lblVoteNo.Text = GlobalInfo.SysLanguage.LPT.ReadString("PPTOper", "VoteAgainst", "反对");
                    lblVoteAbs.Text = GlobalInfo.SysLanguage.LPT.ReadString("PPTOper", "VoteAbstain", "弃权");
                    Dictionary<string, List<string>> dicVoteName = new Dictionary<string, List<string>>();
                    for (int i = 1; i <= 3; i++)
                    {
                        dicVoteName.Add(i + "", new List<string>());
                    }
                    for (int i = 0; i < Map.Count; i++)
                    {
                        string keyID = Map[i].ID;
                        string name = keyID;
                        if (Roster.RosterEnabled)
                        {
                            var row = Roster.GetRowByKeyId(keyID);
                            name = row.Cells[1];
                        }
                        string sVote = Map[i].Data;
                        sVote = PPTOper.FormartABCNum(sVote);
                        if (dicVoteName.ContainsKey(sVote))
                        {
                            if (!dicVoteName[sVote].Contains(name))
                                dicVoteName[sVote].Add(name);
                        }
                    }
                    lblVoteNameYes.Text = string.Join("、", dicVoteName["1"]);
                    lblVoteNameNo.Text = string.Join("、", dicVoteName["2"]);
                    lblVoteNameAbs.Text = string.Join("、", dicVoteName["3"]);
                    AutoFont(lblVoteYes);
                    AutoFont(lblVoteNo);
                    AutoFont(lblVoteAbs);
                    AutoFont(lblVoteNameYes);
                    AutoFont(lblVoteNameNo);
                    AutoFont(lblVoteNameAbs);
                }
            }
        }
        void AutoFont(Label lab)
        {
            lab.Font = new Font(lab.Font.Name, AutoFontSize(lab.Name, lab.Font.Size, lab.Text, lab.Width * 0.95f, lab.Height));
        }
        private float AutoFontSize(string fontName, float sizeOld, object value, float w, float h)
        {
            float res = sizeOld;
            lblFont.AutoSize = true;
            lblFont.Font = new Font(fontName, sizeOld);
            lblFont.Text = value + "";
            while ((lblFont.Width < w) && (lblFont.Height < h))
            {
                if (res >= 27)
                    break;
                res += 1.5f;
                lblFont.Font = new Font(lblFont.Font.Name, res, lblFont.Font.Style);
            }
            while ((lblFont.Width > w) || (lblFont.Height > h))
            {
                if (res <= 18)
                    break;
                res -= 1.5f;
                lblFont.Font = new Font(lblFont.Font.Name, res, lblFont.Font.Style);
            }
            return res;
        }

        /// <summary>
        /// 获取坐席图指定状态的单元个数
        /// </summary>
        /// <param name="BrushType"></param>
        /// <returns></returns>
        public int GetMapStateCount(Brush BrushType)
        {
            int iNum = 0;
            if (Map != null)//杨斌 2020-11-03
            {
                for (int i = 0; i < Map.Count; i++)
                {
                    if (Map[i].Brush == BrushType)
                        iNum += 1;
                }
            }
            return iNum;
        }

        /// <summary>
        /// 获取签到码重复的ID个数
        /// </summary>
        /// <returns></returns>
        private int GetSignInSameCount()
        {
            int res = 0;
            for (int i = 0; i < Map.Count; i++)
            {
                if (Map[i].Brush == BrushSameCode)
                {
                    string[] ary = Map[i].Data.Split(',');
                    res += ary.Length;
                }
            }
            return res;
        }

        /// <summary>
        /// 获取投票数,杨斌 2015-05-20
        /// </summary>
        /// <param name="sVote"></param>
        /// <returns></returns>
        private Dictionary<string, int> GetMapVoteCount()
        {
            Dictionary<string, int> res = new Dictionary<string, int>();
            for (int i = 0; i < Map.Count; i++)
            {
                string sVote = Map[i].Data;
                sVote = PPTOper.FormartABCNum(sVote);
                if (res.ContainsKey(sVote))
                    res[sVote] += 1;
                else
                    res.Add(sVote, 1);
            }
            return res;
        }
        /// <summary>
        /// 获取投票名字,杨斌 2015-05-20
        /// </summary>
        /// <returns></returns>
        private Dictionary<string, List<string>> GetMapVoteCountName()
        {
            Dictionary<string, List<string>> res = new Dictionary<string, List<string>>();
            for (int i = 0; i < Map.Count; i++)
            {
                string sVote = Map[i].Data;
                sVote = PPTOper.FormartABCNum(sVote);

                string sName = Map[i].Name;
                if (string.IsNullOrEmpty(sName))
                    sName = Map[i].ID;

                if (res.ContainsKey(sVote))
                    res[sVote].Add(sName);
                else
                    res.Add(sVote, new List<string>() { sName });
            }
            return res;
        }

        private void FrmVoteDetail_KeyDown(object sender, KeyEventArgs e)
        {
            switch (e.KeyCode)
            {
                case Keys.Escape:
                    this.Close();
                    break;
            }
        }

        [DllImport("user32")]
        private static extern bool ReleaseCapture();
        [DllImport("user32")]
        private static extern int SendMessage(int hWnd, int Msg, int wParam, int lParam);

        /// <summary>
        /// 通过点住控件移动窗体
        /// </summary>
        /// <param name="ctl"></param>
        private void MoveForm(Control ctl)
        {
            const int WM_NCLBUTTONDOWN = 0xA1;
            const int HTCAPTION = 0x2;
            //const int WM_SYSCOMMAND = 0x112;
            //const int SC_MOVE = 0xF010;
            ReleaseCapture();
            SendMessage(ctl.Handle.ToInt32(), WM_NCLBUTTONDOWN, HTCAPTION, 0);
        }

        private void picMap_MouseDown(object sender, MouseEventArgs e)
        {
            //if (e.Button != MouseButtons.Right) return;
            //MoveForm(this);
        }

        private void picMap_MouseUp(object sender, MouseEventArgs e)
        {
            //ReleaseCapture();
        }

        private void picMap_Click(object sender, EventArgs e)
        {

        }

        /// <summary>
        /// 设置Combbox选项属性时,会导致事件重发,进入死循环
        /// 杨斌 2013-05-21
        /// </summary>
        private bool IsSetCboShowData = false;
        private void cboShowData_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (IsSetCboShowData) return;//杨斌 2013-05-21

            InitMap();

            pnlMapBack.Select();
        }

        /// <summary>
        /// 设置Combbox选项属性时,会导致事件重发,进入死循环
        /// 杨斌 2013-05-21
        /// </summary>
        private bool IsSetShowRoster = false;
        private void cboShowRoster_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (IsSetShowRoster) return;//杨斌 2013-05-21

            //杨斌 2014-09-09
            if (cboShowRoster.Items.Count > 0)
            {
                if (cboShowRoster.SelectedIndex == (cboShowRoster.Items.Count - 1))
                {
                    FrmShowCol frm = new FrmShowCol();
                    frm.ShowDialog();
                    if (frm.LstShowCol.Count > 1)
                        GlobalInfo.response.ShowMapColList = frm.LstShowCol;
                    else if (frm.LstShowCol.Count == 1)
                        GlobalInfo.response.ShowMapCol = frm.LstShowCol[0];

                    SetShowRosterCol();

                }
                else
                {
                    GlobalInfo.response.ShowMapCol = cboShowRoster.Text;//杨斌 2014-06-16
                    GlobalInfo.response.ShowMapColList = new List<string>();//杨斌 2014-09-15
                }
            }

            //解决不刷新问题。杨斌 2018-05-22
            InitMap();
            //InitMapName();
            //MapDataChanged = true;
            //ReDrawMap();

            pnlMapBack.Select();
        }

        /// <summary>
        /// 是否显示数据
        /// 创建:杨斌 2012-06-11
        /// </summary>
        private void chkShowData_CheckedChanged(object sender, EventArgs e)
        {
            if (chkShowData.Checked)
            {
                if (cboShowData.SelectedIndex != 2) cboShowData.SelectedIndex = 2;
            }
            else
            {
                if (cboShowData.SelectedIndex != 0) cboShowData.SelectedIndex = 0;
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            MessageBox.Show(this.Name + "  " + this.Font.ToString() + "\r\n"
                           + this.lblTotal.Name + "  " + this.lblTotal.Font.ToString() + "\r\n"
                           + this.lblVoted.Name + "  " + this.lblVoted.Font.ToString() + "\r\n"
                           + this.lblNoPress.Name + "  " + this.lblNoPress.Font.ToString() + "\r\n"
                           + this.chkShowData.Name + "  " + this.chkShowData.Font.ToString() + "\r\n");
        }

        private void pnlMapBack_Scroll(object sender, ScrollEventArgs e)
        {
            ReDrawMap();//杨斌 2012-10-11
        }

        //2013-2-19 增加全屏显示按钮 赵丽
        private void btnFullScreen_Click(object sender, EventArgs e)
        {
            FullScreenChange();
        }

        /// <summary>
        /// 是否正在下拉状态
        /// 杨斌 2014-09-15
        /// </summary>
        /// <returns></returns>
        public bool IsShowDropList
        {
            get
            {
                return (cboShowData.DroppedDown || cboShowRoster.DroppedDown);
            }
        }

        /// <summary>
        /// 导出表决结果表
        /// 杨斌 2015-05-20
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnReportVote_Click(object sender, EventArgs e)
        {
            //杨斌 2016-12-08
            Microsoft.Office.Interop.PowerPoint.Slide sldDetail = GetDetailSlide();
            ResponseType resType = PPTOper.GetSlideType(sldDetail);
            TagSet tagSetSld = new TagSet(sldDetail.Tags);

            if (resType != ResponseType.Vote)
                return;

            Dictionary<string, List<string>> dicVote = GetMapVoteCountName();
            int countYes = 0;
            int countNo = 0;
            int countAbs = 0;
            if (dicVote.ContainsKey("1"))
                countYes = dicVote["1"].Count;
            if (dicVote.ContainsKey("2"))
                countNo = dicVote["2"].Count;
            if (dicVote.ContainsKey("3"))
                countAbs = dicVote["3"].Count;
            int maxCount = 0;
            foreach (var v in dicVote)
            {
                if (!string.IsNullOrEmpty(v.Key) && (v.Value.Count > maxCount))
                    maxCount = v.Value.Count;
            }

            ExcelOper exl = new ExcelOper();
            exl.NewExcel();

            Excel.Worksheet oSheet = exl.GetSheetByNum(1);
            oSheet.Name = btnReportVote.Text;

            object[,] aryTable = new object[maxCount + 1, 3];

            string[] aryOpt = PPTOper.GetOptionTextBySlide(sldDetail);
            if (aryOpt == null)
                aryOpt = PPTOper.GetOptionText(resType, 3);

            aryTable[0, 0] = aryOpt[0] + ":" + countYes;
            aryTable[0, 1] = aryOpt[1] + ":" + countNo;
            aryTable[0, 2] = aryOpt[2] + ":" + countAbs;
            for (int i = 0; i < maxCount; i++)
            {
                int nRow = i + 1;
                for (int col = 1; col <= 3; col++)
                {
                    string sCol = col.ToString();
                    if (dicVote.ContainsKey(sCol))
                    {
                        if (nRow <= dicVote[sCol].Count)
                        {
                            string sName = dicVote[sCol][i].Replace("\r\n", " ");
                            aryTable[nRow, col - 1] = sName;
                        }
                    }
                }
            }

            int nowRow = ExcelOper.ExportArrayToSheet(oSheet, aryTable, 1, 1);

            Excel.Range ran = null;

            for (int i = 1; i <= 3; i++)
            {
                ran = ExcelOper.GetRange(oSheet, 1, i, 1, i);
                ExcelOper.SetRangeTextColor(ran, FrmChartSet.GetTagSetColor(tagSetSld, i - 1));

                ran = ExcelOper.GetRange(oSheet, 1, i, maxCount + 1, i);
                ran.ColumnWidth = 30;
            }

            Color color1 = Color.FromArgb(184, 204, 228);
            Color color2 = Color.FromArgb(219, 229, 241);
            for (int i = 2; i <= maxCount + 1; i++)
            {
                ran = ExcelOper.GetRange(oSheet, i, 1, i, 3);
                if (i % 2 == 0)
                    ExcelOper.SetRangeColor(ran, color1.ToArgb());
                else
                    ExcelOper.SetRangeColor(ran, color2.ToArgb());
            }

            ran = ExcelOper.GetRange(oSheet, 1, 1, maxCount + 1, 3);
            ExcelOper.SetRangeTextFont(ran, "", true);

            ran = ExcelOper.GetRange(oSheet, 1, 1, 1, 3);
            ran.HorizontalAlignment = Excel.XlVAlign.xlVAlignCenter;

            exl.ShowExcel(false);
        }

        private void chkShowNoSignInOK_CheckedChanged(object sender, EventArgs e)
        {
            if (IsRandomUIDSignIn())
            {
                //InitSignInMapRowCol(false);
                MySeatUpdate();
            }
        }

        private void btnImportData_Click(object sender, EventArgs e)
        {
            try
            {
                string fileName = "";
                OpenFileDialog dlg = new OpenFileDialog();
                ////dlg.InitialDirectory = new DirectoryInfo(GlobalInfo.GetAppWorkDir()).Parent.FullName + @"\Resources\RosterList\";
                //dlg.Filter = "Excel(*.xls;*.xlsx)|*.xls;*.xlsx|CSV(*.csv)|*.csv";//杨斌 2017-10-30
                dlg.Filter = "Excel(*.xlsx)|*.xlsx|CSV(*.csv)|*.csv";//杨斌 2018-12-18。不兼容2003格式
                if (dlg.ShowDialog() != DialogResult.OK)
                    return;

                fileName = dlg.FileName;
                string[,] aryTable = null;

                bool isCSV = (Path.GetExtension(fileName).ToLower() == ".csv");//杨斌 2018-05-14
                if (isCSV)
                {
                    aryTable = ExcelOper.ImportCSV(fileName);
                }
                else
                {
                    ExcelOper ex = new ExcelOper();
                    ex.OpenExcel(fileName);
                    aryTable = ex.ImportToSheetBySheetNum(1);//杨斌 2018-05-14
                    ex.CloseExcel();
                }

                int iRowCount = aryTable.GetLength(0);
                int iColCount = aryTable.GetLength(1);
                if (iColCount >= 2)
                {
                    ResponseStatus statusOld = GlobalInfo.response.BusinessStatus;//杨斌 2018-04-20
                    GlobalInfo.response.BusinessStatus = ResponseStatus.bsStart;//杨斌 2018-04-20
                    for (int i = 1; i < iRowCount; i++)
                    {
                        if (!string.IsNullOrEmpty(aryTable[i, 0]) && !string.IsNullOrEmpty(aryTable[i, 1]))
                        {
                            ResponsePar pa = new ResponsePar();
                            pa.KeyID = aryTable[i, 0];
                            pa.KeyValue = aryTable[i, 1];
                            pa.Speed = 0;
                            GlobalInfo.response.Busines_ResponseEventHander(pa);
                        }
                    }
                    GlobalInfo.response.BusinessStatus = statusOld;//杨斌 2018-04-20
                }

                //杨斌 2017-08-07
                //if (Globals.SunVoteARSAddIn.frmVoteBar != null)
                if (Globals.SunVoteARSAddIn.PPTShow.IsShowSlide && (Globals.SunVoteARSAddIn.frmVoteBar != null))
                {
                    if (!Globals.SunVoteARSAddIn.frmVoteBar.IsVoteStart)
                    {
                        Globals.SunVoteARSAddIn.frmVoteBar.VoteStart(false);
                    }
                    else
                    {
                        //ReDrawMap();
                        GlobalInfo.response.SaveResponseData();//保存反馈数据
                        GlobalInfo.response.tmrRefresh_Tick(null, null);
                    }
                }
                else
                {
                    //GlobalInfo.response.SaveResponseInfo();//保存反馈题目信息                    
                    //ReDrawMap();
                    GlobalInfo.response.SaveResponseData();//保存反馈数据
                    GlobalInfo.response.tmrRefresh_Tick(null, null);
                }
                InitMap();
                GlobalInfo.response.RefreshChart();
                //if (Globals.SunVoteARSAddIn.PPTShow.IsShowSlide)
                //{
                //    GlobalInfo.response.RefreshChart();
                //    GlobalInfo.response.RefreshLable();
                //}
                //else
                //{
                //    Globals.SunVoteARSAddIn.PPTEdit.InitChart(true, Globals.SunVoteARSAddIn.PPTEdit.SlideEdit);
                //    //杨斌 2015-03-27
                //    Globals.SunVoteARSAddIn.PPTEdit.RefreshLabelEdit(DataLabelType.VOTENO);
                //    Globals.SunVoteARSAddIn.PPTEdit.RefreshLabelEdit(DataLabelType.VOTENOP);
                //    Globals.SunVoteARSAddIn.PPTEdit.RefreshLabelEdit(DataLabelType.VOTENOPV);
                //    //杨斌 2012-06-01 刷新正确率标签
                //    Globals.SunVoteARSAddIn.PPTEdit.RefreshLabelEdit(DataLabelType.CRRECTNOP);
                //    Globals.SunVoteARSAddIn.PPTEdit.RefreshLabelEdit(DataLabelType.CRRECTNOPV);
                //}
                //GlobalInfo.response.RefreshChart();
            }
            catch (Exception ex)
            {
                SystemLog.WriterLog(ex);
            }
        }

        private void cboDataValue_TextChanged(object sender, EventArgs e)
        {
            cboShowData_SelectedIndexChanged(null, null);
        }
    }
}