void GetProjectList()
        {
            try
            {
                log.Info("GetProjectList() Start.!");
                ClearClipBoard();
                StateBusiness = ApplicationServicesProvider.Instance.Provider.TransactionStateService;
                this.TransactionDiagram.ProjectList = StateBusiness.AtmProjectList();

                if (this.TransactionDiagram.ProjectList.Count != 0 && this.TransactionDiagram.ProjectList != null)
                {
                    OpenProject openProject = new OpenProject(this.TransactionDiagram.ProjectList);
                    if (openProject.ShowDialog() == true)
                    {
                        if (!this.TransactionDiagram.CopyProjectXmlsDirectory())
                        {
                            pbw.Close();
                            return;
                        }
                        this.TransactionDiagram.ProjectName = openProject.ProjectName;
                        GetTransactionList();
                    }
                }
            }
            catch (Exception ex)
            {
                log.Error("GetProjectList() Error.! " + ex.Message);
            }
            finally
            {
                pbw.Close();
            }
        }
Esempio n. 2
0
        private void MultipleExtractAsync(List <GameFile> entries, string destination)
        {
            CancellationTokenSource tokenSource = new CancellationTokenSource();
            ProgressBarWindow       window      = new ProgressBarWindow();

            window.StartDialogWithAction(() => {
                for (int i = 0; i < entries.Count; i++)
                {
                    if (tokenSource.Token.IsCancellationRequested)
                    {
                        break;
                    }

                    entries[i].ExtractAsync(destination + '\\' + entries[i].Name, tokenSource.Token, (progress, description) =>
                    {
                        window.InvokeOnThread(new Action(() =>
                        {
                            int percent = (int)((float)i / entries.Count * 100);
                            window.SetProgress(percent);
                            window.SetOperationText(String.Format("({0}/{1}) {2}", i + 1, entries.Count, description));
                        }));
                    });
                }

                window.InvokeOnThread(new Action(() => window.Close()));
            }, tokenSource);
        }
Esempio n. 3
0
        private void MultipleDeleteAsync(List <GameFile> entries)
        {
            CancellationTokenSource tokenSource = new CancellationTokenSource();
            ProgressBarWindow       window      = new ProgressBarWindow();

            window.StartDialogWithAction(() => {
                for (int i = 0; i < entries.Count; i++)
                {
                    if (tokenSource.Token.IsCancellationRequested)
                    {
                        break;
                    }

                    window.InvokeOnThread(new Action(() =>
                    {
                        int percent = (int)((float)i / entries.Count * 100);
                        window.SetProgress(percent);
                        window.SetOperationText(String.Format("({0}/{1}) Deleting {2}", i + 1, entries.Count, entries[i].Name));
                    }));

                    entries[i].Delete();
                }

                window.InvokeOnThread(new Action(() =>
                {
                    window.Close();
                }));

                if (InvokeRequired)
                {
                    Invoke(new Action(() => RefreshFileList()));
                }
            }, tokenSource);
        }
Esempio n. 4
0
        private void InsertAsync(GameFile entry)
        {
            CancellationTokenSource tokenSource = new CancellationTokenSource();
            ProgressBarWindow       window      = new ProgressBarWindow();

            window.StartDialogWithAction(() =>
            {
                archiveFile.InsertFileAsync(entry, tokenSource.Token, (progress, description) =>
                {
                    window.InvokeOnThread(new Action(() =>
                    {
                        window.SetProgress(progress);
                        window.SetOperationText(description);

                        if (progress == 100)
                        {
                            window.Close();
                        }
                    }));
                });

                if (InvokeRequired)
                {
                    Invoke(new Action(() => RefreshFileList()));
                }
            }, tokenSource);
        }
Esempio n. 5
0
 private void OnSimulateAbort(object sender, RoutedEventArgs e)
 {
     SimulateAbort(this, e);
     if (isdisposed)
     {
         dllmodel.SimulateAbort    -= OnSimulateAbort;
         dllmodel.SimulateStart    -= OnSimulateStart;
         dllmodel.SimulatePause    -= OnSimulatePause;
         dllmodel.SimulateProgress -= OnSimulateProgress;
         dllmodel = null;
         SimulateDllModel.FreeDll();
         return;
     }
     if (dllmodel.SimuMode == SimulateDllModel.SIMUMODE_CHART)
     {
         if (pbwin != null)
         {
             pbwin.Dispatcher.Invoke(new Utility.Delegates.Execute(
                                         () => { pbwin.Close(); }));
             pbwin = null;
         }
         MainChart.Dispatcher.Invoke(new Utility.Delegates.Execute(
                                         MainChart.Update));
     }
 }
        private void DownloadVideos(ActionType action)
        {
            if (CheckboxChecked())
            {
                PopulateUrlDownloadList();
                foreach (var url in UrlDowloadList)
                {
                    var title = playlistVideos.Find(url).Title;

                    progbarwin = new ProgressBarWindow(action, title, downloadPath)
                    {
                        Owner = this
                    };
                    progbarwin.Show();
                    progbarwin.Start(action, title, url, downloadPath);
                    progbarwin.Close();
                }
                var remove = System.Windows.MessageBox.Show("Downloads completed. Some of your videos may not have been downloaded due to copyrights." + "\n\n" + "Do you want to remove all downloaded videos from your YouTube playlist?", "Update Playlist", MessageBoxButton.YesNo, MessageBoxImage.Question);
                if (remove == MessageBoxResult.Yes)
                {
                    RemoveDownloads();
                    RepopulateVideoList();
                }
            }
            else
            {
                System.Windows.MessageBox.Show("Please select a video to download.", "Selection Required", MessageBoxButton.OK, MessageBoxImage.Exclamation);
            }
        }
Esempio n. 7
0
        private void Bw_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                string email = "";
                string senha = "";

                Dispatcher.Invoke(() =>
                {
                    LoginBtn.IsEnabled = false;

                    progressBarWindow = new ProgressBarWindow("Realizando Login");
                    progressBarWindow.Show();
                });

                Dispatcher.Invoke(() =>
                {
                    email = EmailUC.Text;
                    senha = PasswordUC.Password;
                });

                if (DesktopLoginControlService.Logar(email, senha))
                {
                    Dispatcher.Invoke(() => { PasswordUC.Password = string.Empty; });

                    foreach (int i in Dispatcher.Invoke(() => Application.Current.Windows.OfType <MainWindow>().First().StartSession()))
                    {
                        Thread.Sleep(50);
                        (sender as BackgroundWorker).ReportProgress(i);
                    }
                }
            }
            catch (FieldException ex)
            {
                StandardMessageBoxes.MensagemDeErroCampoFormulario(ex.Message);
            }
            catch (Exception ex)
            {
                StandardMessageBoxes.MensagemDeErro(ex.Message);
            }
            finally
            {
                Dispatcher.Invoke(() =>
                {
                    progressBarWindow.Close();
                    LoginBtn.IsEnabled = true;
                });
            }
        }
Esempio n. 8
0
        private void ExtractAsync(GameFile entry, string destination)
        {
            CancellationTokenSource tokenSource = new CancellationTokenSource();
            ProgressBarWindow       window      = new ProgressBarWindow();

            window.StartDialogWithAction(() => entry.ExtractAsync(destination, tokenSource.Token, (progress, description) =>
            {
                window.InvokeOnThread(new Action(() =>
                {
                    window.SetProgress(progress);
                    window.SetOperationText(description);

                    if (progress == 100)
                    {
                        window.Close();
                    }
                }));
            }), tokenSource);
        }
Esempio n. 9
0
    static void OpenProgressBarWindow()
    {
        if (m_PluginWindow != null)
        {
            m_PluginWindow.Close();
        }

        m_PluginWindow = CreateInstance <ProgressBarWindow>();

        m_StartTime = 0;
        m_NowTime   = 0;
        m_Progress  = 0;


        m_PluginWindow.Open();
        Task.Run(() =>
        {
            _ = UpdateProgressAsync();
        });
    }
Esempio n. 10
0
 private void ProgressClose()
 {
     pbw.Close();
 }
Esempio n. 11
0
        public void CheckReport()
        {
            //举例:
            //SelectListInt =[1,0]
            //SelectListFunctionName=[FindUnitError,FindNotExplainComponentNo]
            //表示算法只算FindUnitError,不算FindNotExplainComponentNo
            var controlClass = RegisterMethod();

            var config = XDocument.Load(@"Option.config");

            //Bug:修改配置文件后,读取结果不变
            foreach (var e in config.Elements("configuration").Descendants())
            {
                try
                {
                    controlClass.SelectListInt.Add(Convert.ToInt32(e.Value.ToString()));
                }
                catch (Exception)
                {
                    //TODO:增加读不出数据的异常处理
                    controlClass.SelectListInt.Add(0);
                }

                try
                {
                    controlClass.SelectListContent.Add(e.Attribute("Content").Value.ToString());
                }
                catch (Exception)
                {
                    //TODO:增加读不出数据的异常处理
                    controlClass.SelectListContent.Add("方法名称读取失败");
                }
            }

            var w = new ProgressBarWindow();

            w.Top  = 0.4 * (App.ScreenHeight - w.Height);
            w.Left = 0.4 * (App.ScreenWidth - w.Width);

            var progressBarDataBinding = new ProgressBarDataBinding
            {
                V = 0,
            };

            w.progressBarNumberTextBlock.DataContext = progressBarDataBinding;
            w.progressBar.DataContext = progressBarDataBinding;
            w.progressBarContentTextBlock.DataContext = progressBarDataBinding;

            var progressSleepTime = 500;    //进度条停顿时间

            var thread = new Thread(new ThreadStart(() =>
            {
                w.progressBar.Dispatcher.BeginInvoke((ThreadStart) delegate { w.Show(); });
                int invokeF = 0;    //已调用函数
                for (int i = 0; i < controlClass.SelectListInt.Count; i++)
                {
                    if (controlClass.SelectListInt[i] != 0)
                    {
                        progressBarDataBinding.V       = invokeF * 100 / controlClass.SelectListInt.Sum();
                        progressBarDataBinding.Content = $"正在校核:{controlClass.SelectListContent[i]}";
                        controlClass.SelectListFunctionName[i]?.Invoke();
                        invokeF++;
                        Thread.Sleep(progressSleepTime);
                    }
                }
                progressBarDataBinding.V       = 100;
                progressBarDataBinding.Content = $"正在校核:正在完成中";
                GenerateResultReport();
                _doc.Save("标出错误或警告的报告.doc");
                Thread.Sleep(progressSleepTime);
                MessageBox.Show($"校核已完成!共校核出:" +
                                $"\r错误{reportError.Count}个" +
                                $"\r警告{reportWarnning.Count}个" +
                                $"\r信息{reportInfo.Count}条");
                w.progressBar.Dispatcher.BeginInvoke((ThreadStart) delegate { w.Close(); });
            }));

            thread.Start();
        }