private void Connecting() { GroupBoxCurrentX.Opacity = GroupBoxTotal.Opacity = 0.2; MiniProgressBar.SetStateColor(ProgressBarExtension.ProgressState.Paused); ButtonFished.Visibility = Visibility.Hidden; ButtonPause.Visibility = Visibility.Hidden; ButtonSkip.Visibility = Visibility.Hidden; TransferProgress.Roll(true); LabelReconnecting.Visibility = Visibility.Visible; TextBlockCounts.Visibility = Visibility.Collapsed; }
internal void OnStarted() { started = true; MiniProgressBar.IsIndeterminate = false; if (client.TransferEvent.IsUpload) { Title = AppLanguage.Get("LangTitleUploading_x").FormatC(0); } else { Title = AppLanguage.Get("LangTitleDownloading_x").FormatC(0); } GroupBoxCurrentX.Visibility = GroupBoxTotal.Visibility = Visibility.Visible; LabelETA.Visibility = Visibility.Visible; TransferProgress.Roll(false); TextBlockCounts.Visibility = Visibility.Collapsed; ButtonPause.Visibility = Visibility.Visible; if (client.TransferEvent.TotalFiles > 0) { LabelFilesXY.Content = AppLanguage.Get("LangLabelFiles_X_Y").FormatC(0, client.TransferEvent.TotalFiles); LabelFilesXY.Visibility = Visibility.Visible; } if (client.TransferEvent.TotalFolders > 0) { LabelFoldersXY.Content = AppLanguage.Get("LangLabelFolders_X_Y").FormatC(0, client.TransferEvent.TotalFolders); LabelFoldersXY.Visibility = Visibility.Visible; } cacher.TotalSize = SizeUnit.Parse(client.TransferEvent.TotalSize); LabelTotalSizeXY.Content = AppLanguage.Get("LangLabelTransferredSize_X_FromTotal_Y").FormatC(0, cacher.TotalSize); LabelTotalRemainsX.Content = AppLanguage.Get("LangLabelRemains_X").FormatC(cacher.TotalSize); maximum = client.TransferEvent.TotalFolders + client.TransferEvent.TotalFiles + client.TransferEvent.TotalSize; if (maximum == 0) { maximum = 1; } LabelTransferSpeed.Content = AppLanguage.Get("LangLabelAverageTransferSpeed_X").FormatC(SizeUnit.Parse(0)); ElapsedTimeLabel.Content = AppLanguage.Get("LangLabelElapsedTime_X").FormatC(zeroTime); LabelETA.Content = AppLanguage.Get("LangLabelETATime_X").FormatC(zeroTime); ButtonFished.Visibility = Visibility.Visible; TaskbarHelper.Add(ProgressBarTotal); timer200.Start(); timer1000.Start(); }
private void Window_Loaded(object sender, RoutedEventArgs e) { TextBlockSession.Text = "#" + count.String(); timer200.Interval = TimeSpan.FromMilliseconds(200); timer200.Tick += new EventHandler(timer200_Tick); timer1000.Interval = TimeSpan.FromMilliseconds(1000); timer1000.Tick += new EventHandler(timer1000_Tick); client.OnConnecting += Connecting; //new FTPClient.StateHandler() see -= client.OnConnected += Connected; client.OnFailedToConnect += FailedToConnected; Title = AppLanguage.Get("LangTitleCalculatingItems"); Task.Run(async delegate { await Task.Delay(300); if (!started) { Dispatcher.Invoke((Action)(() => { TransferProgress.Roll(true); TextBlockCounts.DataContext = client.TransferEvent; TextBlockCounts.Visibility = Visibility.Visible; })); } }); switch (AppSettings.Get("FTP", "FishedBehavior", 0)) { case 1: fishedAction = FishedAction.CloseWindow; MenuItemFishedCloseWindow.IsChecked = true; break; case 2: fishedAction = FishedAction.CloseApp; MenuItemFishedCloseApp.IsChecked = true; break; case 3: fishedAction = FishedAction.Shutdown; MenuItemFishedShutdown.IsChecked = true; break; default: MenuItemFishedDisabled.IsChecked = true; break; } }
private void Connected() { GroupBoxCurrentX.Opacity = GroupBoxTotal.Opacity = 1; MiniProgressBar.SetStateColor(ProgressBarExtension.ProgressState.Normal); ButtonFished.Visibility = Visibility.Visible; ButtonPause.Visibility = Visibility.Visible; if (client.TransferEvent.Item.IsFile) { ButtonSkip.Visibility = Visibility.Visible; } TransferProgress.Roll(false); LabelReconnecting.Visibility = Visibility.Collapsed; if ((client.TransferEvent.ItemSent == 0) && (client.TransferEvent.TotalTransferredFolders == 0)) { TextBlockCounts.Visibility = Visibility.Visible; } }
private void FailedToConnected() { client.TransferEvent.HasErrors = true; TransferProgress.Roll(false); LabelReconnecting.Content = AppLanguage.Get("LangTextUnableToConnect"); }