Exemplo n.º 1
0
        protected override async void setConnectTicker(int value)
        {
            connectTicker = value;

            if ((connectTicker == noopAfter) && (await executeCommandAsync("NOOP") != 200))
            {
                AppMessage.Add("Connection dropped. Will reconnect when needed.", MessageType.Info);
            }
        }
Exemplo n.º 2
0
        internal async void OnEnded()
        {
            ended = true;
            timer1000.Stop();
            timer200.Stop();

            if (ownerClosing)
            {
                return;
            }

            TaskbarHelper.Remove(ProgressBarTotal);

            if (closing)
            {
                return;
            }

            if (client.IsChild)
            {
                await client.DisconnectAsync(false, false);
            }

            if (client.TransferEvent.Items.Length == 0)
            {
                if (client.TransferEvent.IsUpload)
                {
                    AppMessage.Add("Nothing to upload.", MessageType.Warning);
                }
                else
                {
                    AppMessage.Add("Nothing to download.", MessageType.Warning);
                }
                this.Close();
                return;
            }

            ButtonCancel.IsEnabled  = false;
            ButtonCancel.Visibility = Visibility.Collapsed;
            ButtonSkip.Visibility   = Visibility.Hidden;
            ButtonPause.Visibility  = Visibility.Hidden;

            if (client.TransferEvent.HasErrors)
            {
                MiniProgressBar.SetStateColor(ProgressBarExtension.ProgressState.Error);
            }
            else
            {
                MiniProgressBar.SetStateColor(ProgressBarExtension.ProgressState.Indeterminate);
            }

            switch (fishedAction)
            {
            case FishedAction.CloseWindow:
                if (!this.IsActive && !ClientHelper.Owner.IsActive)
                {
                    ClientHelper.Owner.FlashWindow(3);
                }
                this.Close();
                return;

            case FishedAction.CloseApp:
                AutoShutdownWindow.Initialize(this, false);
                this.Close();
                return;

            case FishedAction.Shutdown:
                AutoShutdownWindow.Initialize(this, true);
                this.Close();
                return;
            }

            updateCurrentItem();
            UpdateProgress();
            updateTotalFF();

            LabelCurrentRemainsX.Visibility = Visibility.Collapsed;
            LabelTotalRemainsX.Visibility   = Visibility.Collapsed;
            LabelETA.Visibility             = Visibility.Collapsed;

            if (client.TransferEvent.IsUpload)
            {
                this.Title = client.TransferEvent.HasErrors ? AppLanguage.Get("LangTitleUploadFinishedErrors") : AppLanguage.Get("LangTitleUploadDone");
            }
            else
            {
                this.Title = client.TransferEvent.HasErrors ? AppLanguage.Get("LangTitleDownloadFinishedErrors") : AppLanguage.Get("LangTitleDownloadDone");
                ButtonOpenTarget.Visibility = Visibility.Visible;
            }

            ButtonClose.Visibility = Visibility.Visible;
            ButtonClose.IsDefault  = true;
            ButtonClose.IsCancel   = true;
            ButtonClose.Focus();
        }