public override void RelayMethod(object obj)
        {
            string command = obj.ToString();

            //  Do:应用
            if (command == "Init")
            {
            }
            //  Do:登录成功触发
            else if (command == "LoginModuleSuccessed")
            {
                //  Message:检查是否可以打印
                this.CheckEnblePrint();


                SigningDetailJsonModel model = LoginInfo.Data as SigningDetailJsonModel;

                this.Controls = PrintService.Instance.GetSignPages(LoginInfo.Data as SigningDetailJsonModel);
            }

            if (obj is TPageControl)
            {
                TPageControl control = obj as TPageControl;

                SigningDetailJsonModel entity = LoginInfo.Data as SigningDetailJsonModel;

                string err;


                bool enble = DataManager.DatasManager.PrintEnable(entity.PrintRecord, ModuleManager.ModuleConfig[LoginInfo.ModuleName], out err);

                if (enble)
                {
                    MessageSingleControl.Show("正在打印,请稍等...", 10);

                    control.Print();

                    DataManager.DatasManager.UpdateReportPrintMark(entity.ID, ModuleManager.ModuleConfig[LoginInfo.ModuleName], out err);

                    if (!string.IsNullOrEmpty(err))
                    {
                        MessageSingleControl.Show(err);
                        return;
                    }
                }
                else
                {
                    MessageSingleControl.Show(err);
                    return;
                }
            }
        }
        public override void RelayMethod(object obj)
        {
            string command = obj.ToString();

            //  Do:应用
            if (command == "Init")
            {
            }
            //  Do:取消
            else if (command == "LoginModuleSuccessed")
            {
                //  Message:检查是否可以打印
                this.CheckEnblePrint();

                HEWArchivesDetailDataEntity entity = LoginInfo.Data as HEWArchivesDetailDataEntity;
                this.Controls = PrintService.Instance.GetArchivesPages(entity.Person, entity.ProductInformation.OrgName);
            }

            if (obj is TPageControl)
            {
                TPageControl control = obj as TPageControl;

                HEWArchivesDetailDataEntity entity = LoginInfo.Data as HEWArchivesDetailDataEntity;

                string err;

                bool enble = DataManager.DatasManager.PrintEnable(entity.PrintRecord, ReportTypeEnum.Report_Detail_Archives, out err);

                if (enble)
                {
                    MessageSingleControl.Show("正在打印,请稍等...", 10);

                    control.Print();

                    DataManager.DatasManager.UpdateReportPrintMark(entity.Person.ID, ReportTypeEnum.Report_Detail_Archives, out err);

                    if (!string.IsNullOrEmpty(err))
                    {
                        MessageSingleControl.Show(err);
                        return;
                    }
                }
                else
                {
                    MessageSingleControl.Show(err);
                    return;
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 更新图片组
        /// </summary>

        private static void UpdateImgGroup(System.Collections.ObjectModel.ObservableCollection <string> observable, TPageControl PageControl)
        {
            System.Collections.ObjectModel.ObservableCollection <Panel> Panels = new System.Collections.ObjectModel.ObservableCollection <Panel>();

            for (int i = 0; i < observable.Count; i++)
            {
                WrapPanel rectangle = new WrapPanel();
                rectangle.Width  = PageControl.canvasPageContent.Width;
                rectangle.Height = PageControl.canvasPageContent.Height;
                BitmapImage bitimage = new BitmapImage();
                bitimage.BeginInit();
                bitimage.UriSource = new Uri(observable[i], UriKind.Absolute);
                bitimage.EndInit();

                ImageBrush brush = new ImageBrush();
                brush.ImageSource    = bitimage;
                rectangle.Background = brush;
                Panels.Add(rectangle);
            }
            PageControl.AddPage(Panels, 1);
        }
Esempio n. 4
0
        /// <summary>
        /// 播放器调用方法
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>


        public static ToolboxItem GetToolBoxItemPreview(SaveItemInfo info)
        {
            TransformGroup   transformGroup;
            WindowsFormsHost winformHost;


            string      TempPath = "";
            Image       image;
            ToolboxItem item = null;

            item           = new ToolboxItem();
            item.AssetType = info.assetType;
            item.ItemId    = info.ItemId;
            item.ItemName  = info.ItemName;

            if (!string.IsNullOrEmpty(info.AssetPath))
            {
                TempPath = System.Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Temp" + info.AssetPath.Substring(info.AssetPath.LastIndexOf("\\"));
                //MessageBox.Show("getitem,"+TempPath);
                try
                {
                    if (System.IO.File.Exists(TempPath))
                    {
                        System.IO.File.Delete(TempPath);
                    }

                    if (!info.IsDescPt || info.assetType == AssetType.HTML5)
                    {
                        FileSecurity.StreamToFileInfo(TempPath, info.AssetPath);
                        if (info.assetType == AssetType.HTML5)
                        {
                            string ItemdisFile = System.Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Temp" + "\\" + info.ItemsDis.Substring(info.ItemsDis.LastIndexOf("\\"));
                            if (Directory.Exists(ItemdisFile))
                            {
                                DirectoryInfo di = new DirectoryInfo(ItemdisFile);
                                di.Delete(true);
                            }

                            Directory.CreateDirectory(ItemdisFile);
                            string TempFile = ItemdisFile + "\\";

                            string DecFile = info.ItemsDis.Substring(0, info.ItemsDis.LastIndexOf("\\") + 1);


                            GZip.Decompress(DecFile, TempFile, info.ItemsDis.Substring(info.ItemsDis.LastIndexOf("\\") + 1) + ".zip");
                        }
                    }

                    else
                    {
                        FileSecurity.decryptFile(Globals.AssetDecryptKey, TempPath, info.AssetPath);
                    }
                }
                catch (Exception ex)
                {
                    //MessageBox.Show(ex.Message);
                    //log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
                    //log.Error(ex.Message + "\r\n" + ex.StackTrace);
                }


                Globals.tempFileList.Add(TempPath);
                //info.AssetPath = TempPath;
            }
            switch (info.assetType)
            {
            case AssetType.Movie:

                Control.ControlMediaElement mediaElement = new Control.ControlMediaElement();
                mediaElement.Source = new Uri(TempPath, UriKind.Absolute);
                mediaElement.mediaElement.LoadedBehavior   = MediaState.Manual;
                mediaElement.mediaElement.UnloadedBehavior = MediaState.Stop;

                //mediaElement.Stop();
                item.Content = mediaElement;

                break;

            case AssetType.Sound:
                MediaPlayer mediaPlayer = new MediaPlayer();
                mediaPlayer.Open(new Uri(TempPath, UriKind.Absolute));
                mediaPlayer.Stop();
                item.Content    = mediaPlayer;
                item.Visibility = Visibility.Hidden;
                break;

            case AssetType.Topic:
                System.Collections.Generic.List <int> answerList = new System.Collections.Generic.List <int>();

                TopicInfo topicInfo = XamlReader.Load(XmlReader.Create((TextReader) new StringReader(((ContentText)info.Content).Text))) as TopicInfo;
                foreach (var v in topicInfo.TopicOptionList)    //记录正确答案。
                {
                    if (v.Right)
                    {
                        answerList.Add(v.Id);
                    }
                }
                TopicControl tc = new TopicControl(false, answerList);
                tc.TopicInfo = topicInfo;
                tc.Clear();
                //tc.TopicInfo.TopicOptionList[0].Right = true;
                //foreach (var v in tc.TopicInfo.TopicOptionList)
                //    v.IsSelected = false;

                SetShowDiv(info, item, tc);
                break;

            case AssetType.TopicDrag:
                ContentTopicDrag contentTopicDrag = info.Content as ContentTopicDrag;
                if (contentTopicDrag == null)
                {
                    break;
                }
                ControlTopicDrag controlTopicDarg = new ControlTopicDrag(contentTopicDrag.topicDragItemAnswerList, contentTopicDrag.topicDragItemList,
                                                                         new SolidColorBrush((Color)ColorConverter.ConvertFromString(contentTopicDrag.Background)),
                                                                         new SolidColorBrush((Color)ColorConverter.ConvertFromString(contentTopicDrag.Foreground)), false);
                controlTopicDarg.Score = info.Score;

                SetShowDiv(info, item, controlTopicDarg);
                break;

            case AssetType.Text:
                System.Windows.Controls.RichTextBox richtextbox = new System.Windows.Controls.RichTextBox();
                richtextbox.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
                richtextbox.BorderThickness             = new Thickness(0);
                richtextbox.IsReadOnly = true;

                richtextbox.Document   = XamlReader.Load(XmlReader.Create((TextReader) new StringReader(jg.HTMLConverter.HtmlToXamlConverter.ConvertHtmlToXaml(((ContentText)info.Content).Text, true)))) as FlowDocument;
                richtextbox.Background = richtextbox.Document.Background;
                if (info.LineHeight != 0)
                {
                    richtextbox.Document.LineHeight = info.LineHeight;
                }
                richtextbox.Document.FontSize   = info.FontSize;
                richtextbox.Document.FontFamily = new FontFamily(info.FontFamily);
                item.LineHeight = info.LineHeight;

                SetShowDiv(info, item, richtextbox);
                break;

            case AssetType.TextGrid:
                ControlTextGrid controlTextGrid = new ControlTextGrid();
                controlTextGrid.IsEdit = false;
                controlTextGrid.Source = (ContentGrid)info.Content;

                SetShowDiv(info, item, controlTextGrid);
                item.ItemBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(info.Background));
                item.ItemForeground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(info.Foreground));

                break;

            case AssetType.Shape:
                System.Windows.Shapes.Path path = new System.Windows.Shapes.Path();
                path.Style   = path.FindResource(((ContentText)info.Content).Text) as Style;
                path.Stretch = Stretch.Fill;

                SetShowDiv(info, item, path);
                break;

            case AssetType.Image:

                using (FileStream fs = new FileStream(TempPath, FileMode.Open, FileAccess.Read))
                {
                    byte[] buffer = new byte[fs.Length];
                    fs.Read(buffer, 0, (int)fs.Length);
                    BitmapImage bitmapImage = new BitmapImage();
                    bitmapImage.BeginInit();
                    bitmapImage.StreamSource = new MemoryStream(buffer);
                    bitmapImage.EndInit();
                    image = new Image()
                    {
                        Source = bitmapImage
                    };
                    image.Stretch = Stretch.Fill;

                    SetShowDiv(info, item, image);
                }
                break;

            case AssetType.Document:
                WebBrowser webBrowser = new WebBrowser();
                webBrowser.Source = new Uri(TempPath, UriKind.Absolute);
                SetShowDiv(info, item, webBrowser);
                break;

            case AssetType.Message:
                ControlMessage controlMessage = new ControlMessage(false);
                ContentMessage contentMessage = info.Content as ContentMessage;
                if (contentMessage == null)
                {
                    break;
                }
                controlMessage.Title    = contentMessage.Title;
                controlMessage.Location = new Point(contentMessage.PointX, contentMessage.PointY);
                SetShowDiv(info, item, controlMessage);
                break;

            case AssetType.Line:
                ControlLine controlLine = new ControlLine(false);
                ContentLine contentLine = info.Content as ContentLine;
                if (contentLine == null)
                {
                    break;
                }
                controlLine.Point1 = new Point(contentLine.Point1X, contentLine.Point1Y);
                SetShowDiv(info, item, controlLine);
                break;

            case AssetType.HTML5:
                WebBrowerGecko wbgk = new WebBrowerGecko();
                System.Windows.Forms.Integration.WindowsFormsHost w = new System.Windows.Forms.Integration.WindowsFormsHost();
                w.Child = wbgk;
                wbgk.Navigate(TempPath);
                w.SetValue(Panel.ZIndexProperty, 10);
                w.Width      = info.Width;
                w.Height     = info.Height;
                w.Background = new SolidColorBrush(Colors.Red);
                w.Tag        = TempPath;
                item.Content = w;

                break;

            case AssetType.TPageGroup:
                bool dirInfo = false;
                if (DirectoryAssResInfo.Keys.Count > 0)
                {
                    foreach (var v in DirectoryAssResInfo.Keys)
                    {
                        if (v == item.ItemId.ToString())
                        {
                            dirInfo = true;
                            DirectoryAssResInfo[v].Add(TempPath);
                            UpdateImgGroup(DirectoryAssResInfo[v], DirectoryTpage[v]);
                            break;
                        }
                    }
                }
                if (!dirInfo)
                {
                    TPageControl page = new TPageControl();
                    page.Height = info.Height;
                    page.Width  = info.Width;
                    page.canvasPageContent.Width  = info.Width - 100;
                    page.canvasPageContent.Height = info.Height - 2;
                    System.Collections.ObjectModel.ObservableCollection <string> observableAssResInfo = new System.Collections.ObjectModel.ObservableCollection <string>();
                    observableAssResInfo.Add(TempPath);
                    UpdateImgGroup(observableAssResInfo, page);
                    DirectoryAssResInfo.Add(item.ItemId.ToString(), observableAssResInfo);
                    DirectoryTpage.Add(item.ItemId.ToString(), page);
                    item.Content = DirectoryTpage[item.ItemId.ToString()];
                }
                TPageControl tpage = new TPageControl();
                tpage = DirectoryTpage[item.ItemId.ToString()];
                SetShowDiv(info, item, tpage);
                break;
            }



            //item.Opacity = info.Opacity;
            item.AssetPath  = info.AssetPath;
            item.Thumbnails = info.Thumbnails;

            if (info.Background != null)
            {
                item.ItemBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(info.Background));
            }
            if (info.Foreground != null)
            {
                item.ItemForeground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(info.Foreground));
            }

            item.IsEdit = false;
            item.ItemId = info.ItemId;
            item.Width  = info.Width;
            item.Height = info.Height;

            Canvas.SetLeft(item, info.X);
            Canvas.SetTop(item, info.Y);

            System.Windows.Controls.Panel.SetZIndex(item, info.ZIndex);

            transformGroup = item.RenderTransform as TransformGroup;
            foreach (var v in transformGroup.Children)
            {
                switch (v.GetType().Name)
                {
                case "RotateTransform":
                    ((RotateTransform)v).Angle = info.Angle;
                    break;

                case "ScaleTransform":
                    ((ScaleTransform)v).ScaleX = info.ScaleX == 0 ? 1 : info.ScaleX;
                    ((ScaleTransform)v).ScaleY = info.ScaleY == 0 ? 1 : info.ScaleY;
                    break;

                case "SkewTransform":
                    ((SkewTransform)v).AngleX = info.SkewX;
                    ((SkewTransform)v).AngleY = info.SkewY;
                    break;

                case "TranslateTransform":
                    ((TranslateTransform)v).X = info.TranslateX;
                    ((TranslateTransform)v).Y = info.TranslateY;
                    break;
                }
            }

            return(item);
        }
Esempio n. 5
0
        public static ToolboxItem GetToolBoxItem(SaveItemInfo info)
        {
            Image       image;
            ToolboxItem item = null;

            item           = new ToolboxItem();
            item.AssetType = info.assetType;
            item.ItemName  = info.ItemName;
            item.ItemId    = info.ItemId;
            switch (info.assetType)
            {
            case AssetType.Movie:
            case AssetType.Sound:
            case AssetType.HTML5:
            case AssetType.Document:
                image = new Image()
                {
                    Source = new BitmapImage(new Uri(info.Thumbnails, UriKind.Absolute))
                };
                image.Stretch = Stretch.Fill;
                item.Content  = image;
                break;

            case AssetType.Topic:
                TopicControl tc = new TopicControl(true);
                tc.TopicInfo = XamlReader.Load(XmlReader.Create((TextReader) new StringReader(((ContentText)info.Content).Text))) as TopicInfo;
                item.Content = tc;
                break;

            case AssetType.TopicDrag:
                ContentTopicDrag contentTopicDrag = info.Content as ContentTopicDrag;
                if (contentTopicDrag == null)
                {
                    break;
                }

                ControlTopicDrag controlTopicDarg = new ControlTopicDrag(contentTopicDrag.topicDragItemAnswerList, contentTopicDrag.topicDragItemList,
                                                                         new SolidColorBrush((Color)ColorConverter.ConvertFromString(contentTopicDrag.Background)),
                                                                         new SolidColorBrush((Color)ColorConverter.ConvertFromString(contentTopicDrag.Foreground)), true);
                controlTopicDarg.Score = info.Score;
                item.Content           = controlTopicDarg;
                break;

            case AssetType.Text:
                ControlTextEditor content = new ControlTextEditor();
                if (info.LineHeight != 0)
                {
                    content.mainRTB.Document.LineHeight = info.LineHeight;
                }

                content.mainRTB.Document = XamlReader.Load(XmlReader.Create((TextReader) new StringReader(jg.HTMLConverter.HtmlToXamlConverter.ConvertHtmlToXaml(((ContentText)info.Content).Text, true)))) as FlowDocument;
                //content.mainRTB.Document = XamlReader.Load(XmlReader.Create((TextReader)new StringReader(((ContentText)info.Content).Text))) as FlowDocument;
                if (info.LineHeight != 0)
                {
                    content.mainRTB.Document.LineHeight = info.LineHeight;
                }
                content.mainRTB.Document.FontSize   = info.FontSize;
                content.mainRTB.Document.FontFamily = new FontFamily(info.FontFamily);
                item.LineHeight = info.LineHeight;
                item.FontFamily = new FontFamily(info.FontFamily);
                item.FontSize   = info.FontSize;
                item.Content    = content;
                break;

            case AssetType.TextGrid:
                ControlTextGrid controlTextGrid = new ControlTextGrid();
                controlTextGrid.Source = (ContentGrid)info.Content;
                item.Content           = controlTextGrid;
                break;

            case AssetType.Shape:
                System.Windows.Shapes.Path path = new System.Windows.Shapes.Path()
                {
                    Name = ((ContentText)info.Content).Text
                };
                path.Style   = item.FindResource(((ContentText)info.Content).Text) as Style;
                path.Stretch = Stretch.Fill;
                item.Content = path;
                break;

            case AssetType.Image:
                image = new Image()
                {
                    Source = new BitmapImage(new Uri(info.Thumbnails, UriKind.Absolute))
                };
                image.Stretch = Stretch.Fill;
                item.Content  = image;
                break;

            case AssetType.Message:
                ControlMessage controlMessage = new ControlMessage(true);
                ContentMessage contentMessage = info.Content as ContentMessage;
                if (contentMessage == null)
                {
                    break;
                }
                controlMessage.Title    = contentMessage.Title;
                controlMessage.Location = new Point(contentMessage.PointX, contentMessage.PointY);
                item.Content            = controlMessage;
                break;

            case AssetType.Line:
                ControlLine controlLine = new ControlLine(true);
                ContentLine contentLine = info.Content as ContentLine;
                if (contentLine == null)
                {
                    break;
                }
                controlLine.Point1 = new Point(contentLine.Point1X, contentLine.Point1Y);
                item.Content       = controlLine;
                break;

            case AssetType.TPageGroup:
                bool dirInfo = false;
                if (AssResInfoObser.Keys.Count > 0)
                {
                    foreach (var v in AssResInfoObser.Keys)
                    {
                        if (v == item.ItemId)
                        {
                            dirInfo = true;
                            AssResInfo resInfo = new AssResInfo();
                            resInfo.ArId       = info.ItemId;
                            resInfo.AssetName  = "图片" + (DirectoryTpageLoad[v].Children.Count + 1);
                            resInfo.AssetPath  = info.AssetPath;
                            resInfo.Thumbnails = info.Thumbnails;
                            AssResInfoObser[v].Add(resInfo);
                            DirectoryTpageLoad[v].Children = AssResInfoObser[v];
                            DirectoryTpageLoad[v].UpdateImgGroup();
                            break;
                        }
                    }
                }
                if (!dirInfo)
                {
                    TPageControl page = new TPageControl();
                    page.Height = info.Height;
                    page.Width  = info.Width;
                    page.canvasPageContent.Width  = info.Width - 100;
                    page.canvasPageContent.Height = info.Height - 2;
                    AssResInfo resInfo = new AssResInfo();
                    resInfo.ArId       = info.ItemId;
                    resInfo.AssetName  = "图片1";
                    resInfo.AssetPath  = info.AssetPath;
                    resInfo.Thumbnails = info.Thumbnails;
                    System.Collections.ObjectModel.ObservableCollection <AssResInfo> observableAssResInfo = new System.Collections.ObjectModel.ObservableCollection <AssResInfo>();
                    observableAssResInfo.Add(resInfo);
                    page.Children = observableAssResInfo;
                    page.UpdateImgGroup();
                    AssResInfoObser.Add(item.ItemId, observableAssResInfo);
                    DirectoryTpageLoad.Add(item.ItemId, page);
                    item.Content = DirectoryTpageLoad[item.ItemId];
                }
                break;
            }
            item.IsLongText = info.IsLongText;
            item.IsShowDiv  = info.IsShowDiv;
            item.IsDescPt   = info.IsDescPt;

            item.Opacity = info.Opacity;
            if (info.Background != null)
            {
                item.ItemBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(info.Background));
            }
            if (info.Foreground != null)
            {
                item.ItemForeground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(info.Foreground));
            }

            item.AssetPath  = info.AssetPath;
            item.Thumbnails = info.Thumbnails;

            return(item);
        }
        public override void RelayMethod(object obj)
        {
            string command = obj.ToString();

            //  Do:应用
            if (command == "Init")
            {
                //  Message:答题列表

                string configPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config", "Config.xml");

                if (!File.Exists(configPath))
                {
                    DataManager.DatasManager.Info("配置文件不存在!" + configPath);
                    return;
                }

                XmlTools.Load(configPath);

                List <UserControl> cs = new List <UserControl>();


                var vm = QuetionFactory.Instance.Create();

                int count = vm.Models.Count % 2 == 0 ? vm.Models.Count / 2 : vm.Models.Count / 2 + 1;


                QuetionItemControl control = null;

                for (int i = 0; i < vm.Models.Count; i++)
                {
                    UserControl uc = new UserControl();

                    Button btn = new Button();

                    btn.Content = i;

                    uc.Content = btn;

                    if (i % 2 == 0)
                    {
                        control       = new QuetionItemControl();
                        control.Item1 = vm.Models[i];
                        cs.Add(control);
                    }
                    else
                    {
                        control.Item2 = vm.Models[i];
                    }
                }

                this.QustionList = cs;

#if DEBUG
                //Random r = new Random();

                //foreach (var item in this.QustionList)
                //{
                //    QuetionItemControl quetion = item as QuetionItemControl;

                //    if (quetion.Item1 == null) continue;

                //    quetion.Item1.Collection[r.Next(4)].IsChecked = true;

                //    if (quetion.Item2 == null) continue;

                //    quetion.Item2.Collection[r.Next(4)].IsChecked = true;
                //}
#endif
            }

            //  Do:登录成功触发
            else if (command == "LoginModuleSuccessed")
            {
                //  Message:检查是否可以打印
                this.CheckEnblePrint();


                TCMAndArchivesJsonEntity entity = this.LoginInfo.Data as TCMAndArchivesJsonEntity;

                //  ToDo:测试用
                //entity.TCM = null;

                //  Do:没查询到数据
                if (entity == null || entity.TCM == null)
                {
                    Action <MessageResult> Action = l =>
                    {
                        if (l == MessageResult.Cancel)
                        {
                            //this.ShowQ = true;

                            this.IsLogOffModule = true;
                        }
                        else if (l == MessageResult.Sumit)
                        {
                            this.ShowQ = true;
                        }
                        else
                        {
                            //this.ShowQ = true;
                        }
                    };
                    MessageSingleControl.ShowWithCancelAndSumit("无辨识报告,请进行评估", -9, Action);

                    return;
                }

                this.ShowQ = false;

                //  Message:报表列表
                var result = this.Controls = PrintService.Instance.GetPhysicalPages(entity);
            }

            //  Do:取消
            else if (command == "Button_Save")
            {
                List <string> unCheck = new List <string>();

                foreach (var item in this.QustionList)
                {
                    QuetionItemControl quetion = item as QuetionItemControl;

                    if (quetion.Item1 == null)
                    {
                        continue;
                    }

                    var result = quetion.Item1.Collection.ToList().Exists(l => l.IsChecked);

                    if (!result)
                    {
                        unCheck.Add(quetion.Item1.Index);
                    }

                    if (quetion.Item2 == null)
                    {
                        continue;
                    }

                    result = quetion.Item2.Collection.ToList().Exists(l => l.IsChecked);

                    if (!result)
                    {
                        unCheck.Add(quetion.Item2.Index);
                    }
                }

                Debug.WriteLine("Button_Save");

                if (unCheck.Count > 0)
                {
                    List <string> collection1 = new List <string>();

                    if (unCheck.Count > 7)
                    {
                        collection1.AddRange(unCheck.TakeFromTo(0, 5));
                    }
                    else
                    {
                        collection1.AddRange(unCheck);
                    }

                    Action <MessageResult> ResultAction = l =>
                    {
                        Application.Current.Dispatcher.Invoke(() =>
                        {
                            this.PageSelect = collection1[0].ToInt() % 2 == 1? ((int)(collection1[0].ToInt() / 2) + 1):(int)(collection1[0].ToInt() / 2);
                        });
                    };

                    MessageSingleControl.Show("请回答下列问题..." + Environment.NewLine + collection1.Aggregate((l, k) => l + "、 " + k), 3, ResultAction);
                    return;
                }

                //  ToDo:上传
                TCMAndArchivesJsonEntity last = this.LoginInfo.Data as TCMAndArchivesJsonEntity;

                TCMDetailDataEntity entity = new TCMDetailDataEntity();

                entity.ItemDO = new TCMConstitutionItem();

                entity.Tcm = new TCM();

                entity.Tcm.UpdateDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

                List <string> collection = new List <string>();

                foreach (var item in this.QustionList)
                {
                    QuetionItemControl quetion = item as QuetionItemControl;

                    if (quetion.Item1 == null)
                    {
                        continue;
                    }

                    var result = quetion.Item1.Collection.ToList().Find(l => l.IsChecked);

                    collection.Add(result.Value.ToString());

                    if (quetion.Item2 == null)
                    {
                        continue;
                    }

                    result = quetion.Item2.Collection.ToList().Find(l => l.IsChecked);

                    collection.Add(result.Value.ToString());
                }

                entity.Tcm.TZBS = collection.Aggregate((l, k) => l + k);

                Action action = () =>
                {
                    string err;

                    last.TCM = entity;

                    last = DataManager.DatasManager.TCMQualityDiagnosis(last);

                    bool r = DataManager.DatasManager.AddTCMReport(last, out err);

                    if (!r)
                    {
                        MessageSingleControl.Show(err);
                        return;
                    }

                    Application.Current.Dispatcher.Invoke(() =>
                    {
                        this.RelayMethod("LoginModuleSuccessed");
                    });


                    this.ShowQ = false;
                };

                WaittingSingleControl.Show("正在保存,请等待...", action);
            }

            else if (command == "ReWork")
            {
                //  Message:清理數據
                foreach (var item in this.QustionList)
                {
                    QuetionItemControl quetion = item as QuetionItemControl;

                    if (quetion.Item1 == null)
                    {
                        continue;
                    }

                    quetion.Item1.Collection.ToList().ForEach(l => l.IsChecked = false);

                    if (quetion.Item2 == null)
                    {
                        continue;
                    }

                    quetion.Item2.Collection.ToList().ForEach(l => l.IsChecked = false);
                }

                this.PageSelect = 1;
            }


            if (obj is TPageControl)
            {
                TPageControl control = obj as TPageControl;

                TCMAndArchivesJsonEntity entity = LoginInfo.Data as TCMAndArchivesJsonEntity;

                string err;


                bool enble = DataManager.DatasManager.PrintEnable(entity.PrintRecord, ModuleManager.ModuleConfig[LoginInfo.ModuleName], out err);

                if (enble)
                {
                    MessageSingleControl.Show("正在打印,请稍等...", 10);

                    control.Print();

                    DataManager.DatasManager.UpdateReportPrintMark(entity.TCM.Tcm.ID, ModuleManager.ModuleConfig[LoginInfo.ModuleName], out err);

                    if (!string.IsNullOrEmpty(err))
                    {
                        MessageSingleControl.Show(err);
                        return;
                    }
                }
                else
                {
                    MessageSingleControl.Show(err);
                    return;
                }
            }


            ////  Do:取消
            //else if (command == "Qutionlist_GoBack")
            //{
            //    //this.IsShowquetion = true;
            //    this.ShowQ = false;

            //}
        }