//保存配置
        private void btnSetup_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                int            count       = canvasParams.Children.Count;
                ContentControl ccTemp      = null;
                RemoteWin      rwTemp      = null;
                ArrayList      alRemoteWin = new ArrayList();
                for (int i = 0; i < count; i++)
                {
                    ccTemp = canvasParams.Children[i] as ContentControl;
                    rwTemp = new RemoteWin(ccTemp.Width, ccTemp.Height, Canvas.GetLeft(ccTemp), Canvas.GetTop(ccTemp), Canvas.GetZIndex(ccTemp), ccTemp.Name, Convert.ToInt32(ccTemp.FontSize), GetImgPathFromRect(ccTemp));
                    //XmlHelper.UpdateModularByName(PublicParams.xmlFilePath, "/Root/Windows", rwTemp);
                    alRemoteWin.Add(rwTemp);
                }
                RemoteWin[] rws = (RemoteWin[])alRemoteWin.ToArray(typeof(RemoteWin));
                XmlHelper.UpdateModularsByName(PublicParams.xmlFilePath, "/Root/Windows", rws);

                //发送模块排列信息组到大屏
                MapMethods.SendModularsToServer(rws);

                MessageBox.Show("已保存!", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(ex.Message);
                return;
            }

            //MessageBox.Show(xx.ToString());
        }
        /// <summary>
        /// 设置模块的层叠顺序
        /// </summary>
        /// <param name="cc">要设置的模块</param>
        /// <param name="order">顺序:1,置于顶层 2,上移一层 3,置于底层 4,下移一层</param>
        private void SetZindex(ContentControl cc, int order)
        {
            if (order == 0)
            {
                return;
            }
            string         currentName = string.Empty;
            ArrayList      alModulars = new ArrayList();
            ContentControl ccCurrent = null; int iCurrentZindex = 0;
            ContentControl ccTemp = null;

            for (int i = 0; i < canvasParams.Children.Count; i++)
            {
                alModulars.Add((ContentControl)canvasParams.Children[i]);
            }

            alModulars = MakeSort(alModulars);//按Zindex排序

            switch (order)
            {
            case 1:    //1,置于顶层
                for (int i = 0; i < alModulars.Count - 1; i++)
                {
                    if (((ContentControl)alModulars[i]).Name == cc.Name)
                    {
                        ccCurrent      = (ContentControl)alModulars[i];
                        iCurrentZindex = Canvas.GetZIndex((ContentControl)alModulars[alModulars.Count - 1]) + 1;
                        Canvas.SetZIndex(ccCurrent, iCurrentZindex);
                        RemoteWin rw = new RemoteWin(ccCurrent.Width, ccCurrent.Height, Canvas.GetLeft(ccCurrent), Canvas.GetTop(ccCurrent), iCurrentZindex, ccCurrent.Name, Convert.ToInt32(ccCurrent.FontSize), "");
                        rw.SendParamsToRemote();
                    }
                }
                break;

            case 2:    //2,上移一层
                for (int i = 0; i < alModulars.Count - 1; i++)
                {
                    if (((ContentControl)alModulars[i]).Name == cc.Name)
                    {
                        ccCurrent      = (ContentControl)alModulars[i];
                        iCurrentZindex = Canvas.GetZIndex((ContentControl)alModulars[i + 1]);

                        ccTemp = (ContentControl)alModulars[i + 1];
                        int tempzindex = Canvas.GetZIndex((ContentControl)alModulars[i]);

                        Canvas.SetZIndex(ccCurrent, iCurrentZindex);
                        Canvas.SetZIndex(ccTemp, tempzindex);

                        RemoteWin rw = new RemoteWin(ccCurrent.Width, ccCurrent.Height, Canvas.GetLeft(ccCurrent), Canvas.GetTop(ccCurrent), iCurrentZindex, ccCurrent.Name, Convert.ToInt32(ccCurrent.FontSize), "");
                        rw.SendParamsToRemote();
                        rw = new RemoteWin(ccTemp.Width, ccTemp.Height, Canvas.GetLeft(ccTemp), Canvas.GetTop(ccTemp), tempzindex, ccTemp.Name, Convert.ToInt32(ccTemp.FontSize), "");
                        rw.SendParamsToRemote();
                    }
                }
                break;

            case 3:    //3,置于底层
                for (int i = 1; i < alModulars.Count; i++)
                {
                    if (((ContentControl)alModulars[i]).Name == cc.Name)
                    {
                        ccCurrent      = (ContentControl)alModulars[i];
                        iCurrentZindex = Canvas.GetZIndex((ContentControl)alModulars[0]) - 1;
                        Canvas.SetZIndex(ccCurrent, iCurrentZindex);
                        RemoteWin rw = new RemoteWin(ccCurrent.Width, ccCurrent.Height, Canvas.GetLeft(ccCurrent), Canvas.GetTop(ccCurrent), iCurrentZindex, ccCurrent.Name, Convert.ToInt32(ccCurrent.FontSize), "");
                        rw.SendParamsToRemote();
                    }
                }
                break;

            case 4:    //4,下移一层
                for (int i = 1; i < alModulars.Count; i++)
                {
                    if (((ContentControl)alModulars[i]).Name == cc.Name)
                    {
                        ccCurrent      = (ContentControl)alModulars[i];
                        iCurrentZindex = Canvas.GetZIndex((ContentControl)alModulars[i - 1]);

                        ccTemp = (ContentControl)alModulars[i - 1];
                        int tempzindex = Canvas.GetZIndex((ContentControl)alModulars[i]);

                        Canvas.SetZIndex(ccCurrent, iCurrentZindex);
                        Canvas.SetZIndex(ccTemp, tempzindex);

                        RemoteWin rw = new RemoteWin(ccCurrent.Width, ccCurrent.Height, Canvas.GetLeft(ccCurrent), Canvas.GetTop(ccCurrent), iCurrentZindex, ccCurrent.Name, Convert.ToInt32(ccCurrent.FontSize), "");
                        rw.SendParamsToRemote();
                        rw = new RemoteWin(ccTemp.Width, ccTemp.Height, Canvas.GetLeft(ccTemp), Canvas.GetTop(ccTemp), tempzindex, ccTemp.Name, Convert.ToInt32(ccTemp.FontSize), "");
                        rw.SendParamsToRemote();
                    }
                }
                break;

            default:
                break;
            }
        }