private MediaPanel getCorrectBRPanel()
        {
            MediaPanel resPanel = null;

            if (layoutType == Constants.LayoutType.Landscape_Full)
            {
                //resPanel = mediaPanel_BR_Landscape_Full;
            }
            else if (layoutType == Constants.LayoutType.Landscape_L1_R21)
            {
                resPanel = mediaPanel_BR_Landscape_L1_R21;
            }
            else if (layoutType == Constants.LayoutType.Landscape_L1_R111)
            {
                resPanel = mediaPanel_BR_Landscape_L1_R111;
            }
            else if (layoutType == Constants.LayoutType.Landscape_Full_BottomMarquee)
            {
                //resPanel = mediaPanel_BR_Landscape_Full_BottomMarquee;
            }
            else if (layoutType == Constants.LayoutType.Landscape_BottomMarquee_L1_R11)
            {
                resPanel = mediaPanel_BR_Landscape_BottomMarquee_L1_R11;
            }
            else if (layoutType == Constants.LayoutType.Landscape_BottomMarquee_L1_R21)
            {
                resPanel = mediaPanel_BR_Landscape_BottomMarquee_L1_R21;
            }
            else if (layoutType == Constants.LayoutType.Landscape_L1_C1_R1)
            {
                //resPanel = mediaPanel_BR_Landscape_L1_C1_R1;
            }
            else if (layoutType == Constants.LayoutType.Landscape_BottomMarquee_L1_C1_R1)
            {
                //resPanel = mediaPanel_BR_Landscape_BottomMarquee_L1_C1_R1;
            }
            else if (layoutType == Constants.LayoutType.Portrait_Full)
            {
                //resPanel = mediaPanel_BR_Portrait_Full;
            }
            else if (layoutType == Constants.LayoutType.Portrait_Full_TopMarquee)
            {
                //resPanel = mediaPanel_BR_Portrait_Full_TopMarquee;
            }
            else if (layoutType == Constants.LayoutType.Portrait_CenterMarquee_T1_B3)
            {
                //resPanel = mediaPanel_BR_Portrait_CenterMarquee_T1_B3;
            }
            else if (layoutType == Constants.LayoutType.Portrait_T1_C1_B1)
            {
                //resPanel = mediaPanel_BR_Portrait_T1_C1_B1;
            }
            else if (layoutType == Constants.LayoutType.Portrait_T1_C1_CL1_CR1_B1)
            {
                //resPanel = mediaPanel_BR_Portrait_T1_C1_CL1_CR1_B1;
            }

            return(resPanel);
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            String path         = System.AppDomain.CurrentDomain.BaseDirectory;
            String fullFileName = System.AppDomain.CurrentDomain.FriendlyName;
            int    dotIndex     = fullFileName.IndexOf('.');
            String fileName     = fullFileName.Substring(0, dotIndex);
            String ksdFileName  = String.Format("{0}{1}.ksd", path, fileName);

            if (File.Exists(ksdFileName))
            {
                String fileContent     = File.ReadAllText(ksdFileName, Encoding.Unicode);
                byte[] encContentBytes = Convert.FromBase64String(fileContent);
                RC4    rc4Obj          = new RC4("a555ab555bc555cd555d");
                rc4Obj.EncryptInPlace(encContentBytes);
                ksData = getString(encContentBytes);
                if (String.IsNullOrEmpty(ksData) || ksData.Length < 492)
                {
                    MessageBox.Show(String.Format("{0}.ksd 檔案格式錯誤", fileName));
                    this.Close();
                }
                else
                {
                    initData(fileName);
                    if (getCorractLayout() == null)
                    {
                        MessageBox.Show(String.Format("{0}.ksd 檔案格式錯誤", fileName));
                        this.Close();
                    }
                    else
                    {
                        showCorractLayout();

                        MediaPanel tLPanel = getCorrectTLPanel();
                        if (tLPanel != null && tLItems.Count > 0)
                        {
                            tLPanel.setData(tLItems);
                        }

                        MediaPanel tCPanel = getCorrectTCPanel();
                        if (tCPanel != null && tCItems.Count > 0)
                        {
                            tCPanel.setData(tCItems);
                        }

                        MediaPanel tRPanel = getCorrectTRPanel();
                        if (tRPanel != null && tRItems.Count > 0)
                        {
                            tRPanel.setData(tRItems);
                        }

                        MediaPanel cLPanel = getCorrectCLPanel();
                        if (cLPanel != null && cLItems.Count > 0)
                        {
                            cLPanel.setData(cLItems);
                        }

                        MediaPanel cCPanel = getCorrectCCPanel();
                        if (cCPanel != null && cCItems.Count > 0)
                        {
                            cCPanel.setData(cCItems);
                        }

                        MediaPanel cRPanel = getCorrectCRPanel();
                        if (cRPanel != null && cRItems.Count > 0)
                        {
                            cRPanel.setData(cRItems);
                        }

                        MediaPanel bLPanel = getCorrectBLPanel();
                        if (bLPanel != null && bLItems.Count > 0)
                        {
                            bLPanel.setData(bLItems);
                        }

                        MediaPanel bCPanel = getCorrectBCPanel();
                        if (bCPanel != null && bCItems.Count > 0)
                        {
                            bCPanel.setData(bCItems);
                        }

                        MediaPanel bRPanel = getCorrectBRPanel();
                        if (bRPanel != null && bRItems.Count > 0)
                        {
                            bRPanel.setData(bRItems);
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show(String.Format("同層資料夾中找不到 {0}.ksd 檔案", fileName));
                this.Close();
            }
        }