Пример #1
0
        private void LawListCT_UnZip_Callback(Law_DownloadItemViewModel lawItem)
        {
            Func <LawRow, bool>        func = null;
            _003C_003Ec__DisplayClass7 _003C_003Ec__DisplayClass = new _003C_003Ec__DisplayClass7();

            _003C_003Ec__DisplayClass.lawItem = lawItem;
            if (!base.Dispatcher.CheckAccess())
            {
                base.Dispatcher.BeginInvoke(new Action <Law_DownloadItemViewModel>(LawListCT_UnZip_Callback), _003C_003Ec__DisplayClass.lawItem);
                return;
            }
            IEnumerable <LawRow> source = Enumerable.OfType <LawRow>(LawRowSP.Children);

            if (func == null)
            {
                func = new Func <LawRow, bool>(_003C_003Ec__DisplayClass._003CLawListCT_UnZip_Callback_003Eb__5);
            }
            LawRow lawRow = Enumerable.FirstOrDefault(Enumerable.Where(source, func));

            if (lawRow == null)
            {
                return;
            }
            if (_003C_003Ec__DisplayClass.lawItem.FileType == LawFileType.更新檔解壓縮中)
            {
                lawRow.txtUpdatePercent.Text       = "100 %";
                lawRow.pbUpdate.Value              = lawRow.pb.Maximum;
                lawRow.txtUpdatePercent.Visibility = Visibility.Collapsed;
                lawRow.pbUpdate.Visibility         = Visibility.Collapsed;
                Storyboard storyboard = (Storyboard)lawRow.TryFindResource("sbUpdate");
                if (storyboard != null)
                {
                    storyboard.Begin();
                }
            }
            else
            {
                lawRow.txtPercent.Text       = "100 %";
                lawRow.pb.Value              = lawRow.pb.Maximum;
                lawRow.txtPercent.Visibility = Visibility.Collapsed;
                lawRow.pb.Visibility         = Visibility.Collapsed;
                Storyboard storyboard = (Storyboard)lawRow.TryFindResource("sb");
                if (storyboard != null)
                {
                    storyboard.Begin();
                }
            }
        }
Пример #2
0
        private void LawListCT_UnZip_Callback(Law_DownloadItemViewModel lawItem)
        {
            //先判斷是否要invoke
            if (this.Dispatcher.CheckAccess() == false)
            {
                // 這裡是下載事件處理,優先權設定為ContextIdle => 列舉值為 3。 幕後作業完成後,會處理作業。
                //this.Dispatcher.BeginInvoke(DispatcherPriority.SystemIdle, new Action<Law_DownloadItemViewModel>(LawListCT_UnZip_Callback), lawItem);
                this.Dispatcher.BeginInvoke(new Action <Law_DownloadItemViewModel>(LawListCT_UnZip_Callback), lawItem);
            }
            else
            {
                LawRow lawRow = LawRowSP.Children.OfType <LawRow>().Where(x => x.lawDataLaw.ID.Equals(lawItem.ID)).FirstOrDefault();
                if (lawRow != null)
                {
                    Storyboard sb;
                    if (lawItem.FileType == LawFileType.更新檔解壓縮中)
                    {
                        //記得不要讓使用者開書
                        lawRow.txtUpdatePercent.Text       = "100 %";
                        lawRow.pbUpdate.Value              = lawRow.pb.Maximum;
                        lawRow.txtUpdatePercent.Visibility = Visibility.Collapsed;
                        lawRow.pbUpdate.Visibility         = Visibility.Collapsed;

                        sb = (Storyboard)lawRow.TryFindResource("sbUpdate");
                        if (sb != null)
                        {
                            sb.Begin();
                        }
                    }
                    else
                    {
                        lawRow.txtPercent.Text       = "100 %";
                        lawRow.pb.Value              = lawRow.pb.Maximum;
                        lawRow.txtPercent.Visibility = Visibility.Collapsed;
                        lawRow.pb.Visibility         = Visibility.Collapsed;

                        sb = (Storyboard)lawRow.TryFindResource("sb");
                        if (sb != null)
                        {
                            sb.Begin();
                        }
                    }
                }
            }
        }
Пример #3
0
        private void LawListCT_DownloadFileCompleted_Callback(Law_DownloadItemViewModel lawItem)
        {
            Func <LawRow, bool>        func = null;
            _003C_003Ec__DisplayClassf _003C_003Ec__DisplayClassf = new _003C_003Ec__DisplayClassf();

            _003C_003Ec__DisplayClassf.lawItem = lawItem;
            if (!base.Dispatcher.CheckAccess())
            {
                base.Dispatcher.BeginInvoke(new Action <Law_DownloadItemViewModel>(LawListCT_DownloadFileCompleted_Callback), _003C_003Ec__DisplayClassf.lawItem);
                return;
            }
            IEnumerable <LawRow> source = Enumerable.OfType <LawRow>(LawRowSP.Children);

            if (func == null)
            {
                func = new Func <LawRow, bool>(_003C_003Ec__DisplayClassf._003CLawListCT_DownloadFileCompleted_Callback_003Eb__d);
            }
            LawRow lawRow = Enumerable.FirstOrDefault(Enumerable.Where(source, func));

            if (lawRow == null)
            {
                return;
            }
            if (_003C_003Ec__DisplayClassf.lawItem.FileType == LawFileType.更新檔已下載完成)
            {
                Storyboard storyboard = (Storyboard)lawRow.TryFindResource("sb");
                if (storyboard != null)
                {
                    storyboard.Stop();
                }
                lawRow.txtIsNew.Visibility = Visibility.Visible;
                return;
            }
            Storyboard storyboard2 = (Storyboard)lawRow.TryFindResource("sb");

            if (storyboard2 != null)
            {
                storyboard2.Stop();
            }
            lawRow.btnDownload.Visibility = Visibility.Collapsed;
            lawRow.btnOpen.Visibility     = Visibility.Visible;
            lawRow.btnDelete.Visibility   = Visibility.Visible;
            lawRow.txtIsNew.Visibility    = Visibility.Visible;
        }
Пример #4
0
        private void LawListCT_UnZipError_Callback(Law_DownloadItemViewModel lawItem)
        {
            //先判斷是否要invoke
            if (this.Dispatcher.CheckAccess() == false)
            {
                // 這裡是下載事件處理,優先權設定為ContextIdle => 列舉值為 3。 幕後作業完成後,會處理作業。
                //this.Dispatcher.BeginInvoke(DispatcherPriority.SystemIdle,new Action<Law_DownloadItemViewModel>(LawListCT_UnZipError_Callback), lawItem);
                this.Dispatcher.BeginInvoke(new Action <Law_DownloadItemViewModel>(LawListCT_UnZipError_Callback), lawItem);
            }
            else
            {
                // 在Home的主視窗Show,不要在這裡Show
                //AutoClosingMessageBox.Show("解壓縮失敗");
                LawRow lawRow = LawRowSP.Children.OfType <LawRow>().Where(x => x.lawDataLaw.ID.Equals(lawItem.ID)).FirstOrDefault();
                if (lawRow != null)
                {
                    Storyboard sb;
                    if (lawItem.FileType == LawFileType.更新檔解壓縮失敗)
                    {
                        sb = (Storyboard)lawRow.TryFindResource("sbUpdate");
                        if (sb != null)
                        {
                            sb.Stop();
                        }

                        // 記得必須隱藏必須先做,才不會被看見
                        lawRow.btnUpdate.Visibility = Visibility.Visible;
                    }
                    else
                    {
                        sb = (Storyboard)lawRow.TryFindResource("sb");
                        if (sb != null)
                        {
                            sb.Stop();
                        }

                        // 記得必須隱藏必須先做,才不會被看見
                        lawRow.btnDownload.Visibility = Visibility.Visible;
                    }
                }
            }
        }
Пример #5
0
        private void LawListCT_UnZipError_Callback(Law_DownloadItemViewModel lawItem)
        {
            Func <LawRow, bool>        func = null;
            _003C_003Ec__DisplayClass3 _003C_003Ec__DisplayClass = new _003C_003Ec__DisplayClass3();

            _003C_003Ec__DisplayClass.lawItem = lawItem;
            if (!base.Dispatcher.CheckAccess())
            {
                base.Dispatcher.BeginInvoke(new Action <Law_DownloadItemViewModel>(LawListCT_UnZipError_Callback), _003C_003Ec__DisplayClass.lawItem);
                return;
            }
            IEnumerable <LawRow> source = Enumerable.OfType <LawRow>(LawRowSP.Children);

            if (func == null)
            {
                func = new Func <LawRow, bool>(_003C_003Ec__DisplayClass._003CLawListCT_UnZipError_Callback_003Eb__1);
            }
            LawRow lawRow = Enumerable.FirstOrDefault(Enumerable.Where(source, func));

            if (lawRow == null)
            {
                return;
            }
            if (_003C_003Ec__DisplayClass.lawItem.FileType == LawFileType.更新檔解壓縮失敗)
            {
                Storyboard storyboard = (Storyboard)lawRow.TryFindResource("sbUpdate");
                if (storyboard != null)
                {
                    storyboard.Stop();
                }
                lawRow.btnUpdate.Visibility = Visibility.Visible;
            }
            else
            {
                Storyboard storyboard = (Storyboard)lawRow.TryFindResource("sb");
                if (storyboard != null)
                {
                    storyboard.Stop();
                }
                lawRow.btnDownload.Visibility = Visibility.Visible;
            }
        }
Пример #6
0
        private void LawListCT_DownloadFileCompleted_Callback(Law_DownloadItemViewModel lawItem)
        {
            //先判斷是否要invoke
            if (this.Dispatcher.CheckAccess() == false)
            {
                // 這裡是下載事件處理,優先權設定為ContextIdle => 列舉值為 3。 幕後作業完成後,會處理作業。
                //this.Dispatcher.BeginInvoke(DispatcherPriority.SystemIdle, new Action<Law_DownloadItemViewModel>(LawListCT_DownloadFileCompleted_Callback), lawItem);
                this.Dispatcher.BeginInvoke(new Action <Law_DownloadItemViewModel>(LawListCT_DownloadFileCompleted_Callback), lawItem);
            }
            else
            {
                LawRow lawRow = LawRowSP.Children.OfType <LawRow>().Where(x => x.lawDataLaw.ID.Equals(lawItem.ID)).FirstOrDefault();

                if (lawRow != null)
                {
                    if (lawItem.FileType == LawFileType.更新檔已下載完成)
                    {
                        Storyboard sb = (Storyboard)lawRow.TryFindResource("sb");
                        if (sb != null)
                        {
                            sb.Stop();
                        }

                        lawRow.txtIsNew.Visibility = Visibility.Visible;
                    }
                    else
                    {
                        Storyboard sb = (Storyboard)lawRow.TryFindResource("sb");
                        if (sb != null)
                        {
                            sb.Stop();
                        }

                        lawRow.btnDownload.Visibility = Visibility.Collapsed;
                        lawRow.btnOpen.Visibility     = Visibility.Visible;
                        lawRow.btnDelete.Visibility   = Visibility.Visible;
                        lawRow.txtIsNew.Visibility    = Visibility.Visible;
                    }
                }
            }
        }