Exemple #1
0
        void Setup()
        {
            setStatusText("Running setup method..");
            search = new ProgressDialog()
            {
                WindowTitle = "Osu! Player..",
                Description = "Hooking into Osu! window..",
                ShowTimeRemaining = true,
                ShowCancelButton = false,
                ProgressBarStyle = Ookii.Dialogs.ProgressBarStyle.MarqueeProgressBar
            };
            search.DoWork += search_DoWork;

            search.RunWorkerCompleted += delegate
            {
                button1.Enabled = true;
                Thread thread = new Thread(new ThreadStart(ConnectArduino));
                thread.Start();

                search.Dispose();
            };

            search.Show(this);
        }
Exemple #2
0
 private void Import(IPhotoProvider provider)
 {
     using (var dialog = new ProgressDialog(this.components)
                             {
                                 WindowTitle = "Импорт",
                                 Text = string.Format("Импорт фотографий из {0}", provider.Name),
                                 Description = "Инициализация",
                                 CancellationText = "Отмена импорта",
                                 MinimizeBox = false,
                                 ProgressBarStyle = ProgressBarStyle.ProgressBar,
                                 ShowTimeRemaining = true,
                                 UseCompactPathsForText = true,
                                 UseCompactPathsForDescription = true
                             })
     {
         dialog.DoWork += (sender, args) =>
             {
                 var progressDialog = (ProgressDialog)sender;
                 var progress = new Progress<ImportProgress>(p => progressDialog.ReportProgress(p.Percent, null, p.CurrentItem));
                 this.importService.Import(provider, progress, new CancellationTokenAdapter(() => progressDialog.CancellationPending));
             };
         dialog.ShowDialog(this);
     }
 }