Пример #1
0
        private void UpdateProgress()
        {
            SmartItem item = client.TransferEvent.Item;

            ProgressBarTotal.Value = (((client.TransferEvent.TotalTransferredFolders + client.TransferEvent.TotalTransferredFiles + client.TransferEvent.TotalSent) * 100) / maximum);

            if (!ended && (ProgressBarTotal.Value > 0))
            {
                if (client.TransferEvent.IsUpload)
                {
                    Title = AppLanguage.Get("LangTitleUploading_x").FormatC(ProgressBarTotal.Value);
                }
                else
                {
                    Title = AppLanguage.Get("LangTitleDownloading_x").FormatC(ProgressBarTotal.Value);
                }
            }

            if (!shrink.Shrinked)
            {
                ProgressBarCurrent.Value     = (item.Length == 0) ? 100 : client.TransferEvent.ItemSent * 100 / item.Length;
                GroupBoxCurrentX.Header      = AppLanguage.Get("LangGroupBoxCurrent_X").FormatC(ProgressBarCurrent.Value);
                LabelCurrentSizeXY.Content   = AppLanguage.Get("LangLabelTransferredSize_X_FromTotal_Y").FormatC(SizeUnit.Parse(client.TransferEvent.ItemSent), cacher.CurrentSize);
                LabelCurrentRemainsX.Content = AppLanguage.Get("LangLabelRemains_X").FormatC(SizeUnit.Parse(item.Length - client.TransferEvent.ItemSent));
                LabelTotalSizeXY.Content     = AppLanguage.Get("LangLabelTransferredSize_X_FromTotal_Y").FormatC(SizeUnit.Parse(client.TransferEvent.TotalSent), cacher.TotalSize);
                LabelTotalRemainsX.Content   = AppLanguage.Get("LangLabelRemains_X").FormatC(SizeUnit.Parse(client.TransferEvent.TotalSize - client.TransferEvent.TotalSent));
            }
        }
Пример #2
0
        private void updateCurrentItem()
        {
            SmartItem item = client.TransferEvent.Item;

            LabelItemName.Text       = item.ItemName;
            ProgressBarCurrent.Value = 0.0;

            if (item.IsFile)
            {
                if (!ended)
                {
                    ButtonSkip.Visibility = Visibility.Visible;
                }
                GroupBoxCurrentX.Header    = AppLanguage.Get("LangGroupBoxCurrent_X").FormatC(0);
                cacher.CurrentSize         = item.FileSize;
                LabelCurrentSizeXY.Content = AppLanguage.Get("LangLabelTransferredSize_X_FromTotal_Y").FormatC(0, cacher.CurrentSize);
            }
            else
            {
                GroupBoxCurrentX.Header = AppLanguage.Get("LangGroupBoxCurrent_X").FormatC(100);
                ButtonSkip.Visibility   = Visibility.Hidden;
            }

            if (pathChanged.Changed)
            {
                LabelItemFrom.Text = pathChanged.From;
                LabelItemTo.Text   = pathChanged.To.Length > 1 ? pathChanged.To.TrimEnd('/') : pathChanged.To;
            }
        }
Пример #3
0
        private async void ButtonCheckForNewVersion_Click(object sender, RoutedEventArgs e)
        {
            ButtonCheckForNewVersion.IsEnabled = false;
            Cursor = System.Windows.Input.Cursors.Wait;
            LabelLatest.Visibility  = Visibility.Collapsed;
            LinkDownload.Visibility = Visibility.Collapsed;

            bool?hasChecked = await VersionHelper.Check(true);

            if (hasChecked.HasValue)
            {
                setLastVersion(true);
            }
            else
            {
                MessageWindow.Show(this,
                                   AppLanguage.Get("LangMBUpdateFails"),
                                   AppLanguage.Get("LangMBCheckingForUpdatesTitle"),
                                   MessageBoxButton.OK,
                                   MessageBoxImage.Error,
                                   MessageBoxResult.OK);
            }

            Cursor = System.Windows.Input.Cursors.Arrow;
            ButtonCheckForNewVersion.IsEnabled = true;
        }
Пример #4
0
        private void timer1000_Tick(object sender, EventArgs e)
        {
            cacher.StartTime   = cacher.StartTime.AddSeconds(1.0);
            speedy.Transferred = client.TransferEvent.TotalSent;
            int average = speedy.Average() / 5;

            if (average > 0)
            {
                if ((average > NetworkClient.BUFFER_SIZE) && (average < 1043741824))
                {
                    client.BufferSize = average;
                }

                if (!shrink.Shrinked)
                {
                    average = average * 5;
                    ElapsedTimeLabel.Content   = AppLanguage.Get("LangLabelElapsedTime_X").FormatC(cacher.StartTime);
                    LabelTransferSpeed.Content = AppLanguage.Get("LangLabelAverageTransferSpeed_X").FormatC(SizeUnit.Parse(average));

                    LabelETA.Content = AppLanguage.Get("LangLabelETATime_X").FormatC(
                        zeroTime.AddSeconds((client.TransferEvent.TotalSize - client.TransferEvent.TotalSent) / average));
                }
            }
            else if (!shrink.Shrinked)
            {
                LabelETA.Content = AppLanguage.Get("LangLabelETATime_X").FormatC(zeroTime);
            }
        }
Пример #5
0
        private async void MenuItemDetailSaveAs_Click(object sender, RoutedEventArgs e)
        {
            if (DetailList.Items.Count == 0)
            {
                return;
            }

            SaveFileDialog sfd = new SaveFileDialog();

            sfd.InitialDirectory = AppSettings.Get("Path", "LastSaved", DirectoryHelper.DesktopDirectory);
            sfd.CheckPathExists  = true;
            sfd.AddExtension     = true;
            sfd.DefaultExt       = ".txt";
            sfd.FileName         = AppLanguage.Get("LangPlusFTPLog") + " - " + DateFormatHelper.GetShortDateTimeSafe();
            sfd.Filter           = AppLanguage.Get("LangTextAllextensions");

            if (!(bool)sfd.ShowDialog() || (sfd.FileName.Trim().Length == 0))
            {
                return;
            }

            await Task.Run(() =>
            {
                AppSettings.Set("Path", "LastSaved", DirectoryHelper.GetPath(sfd.FileName));
                StringBuilder sb = new StringBuilder();
                for (int i = 0; i < AppMessage.Count; i++)
                {
                    try { sb.Append(((sb.Length > 0) ? Environment.NewLine : string.Empty) + AppMessage.Items[i].MText + " - " + AppMessage.Items[i].MDate); }
                    catch (Exception exp) { ExceptionHelper.Log(exp); }
                }

                FileHelper.WriteAll(sfd.FileName, sb.ToString());
                sb.Clear();
            });
        }
Пример #6
0
        private void deleteLocalItems()
        {
            if (LocalList.SelectedItems.Count == 0)
            {
                return;
            }

            if (MessageWindow.Show(this,
                                   AppLanguage.Get("LangMBDelete"),
                                   AppLanguage.Get("LangMBDeleteTitle"),
                                   MessageBoxButton.YesNo,
                                   MessageBoxImage.Question,
                                   MessageBoxResult.Yes) != MessageBoxResult.Yes)
            {
                return;
            }

            SmartItem[] items = LocalList.SelectedItems();
            if (items == null)
            {
                return;
            }

            LocalHelper.Delete(items);
        }
Пример #7
0
        private async void ButtonServerConnect_Click(object sender, RoutedEventArgs e)
        {
            if (ClientHelper.IsConnected || connecting)
            {
                if (!connecting && MessageWindow.Show(this,
                                                      AppLanguage.Get("LangMBDisconnect").FormatC(ClientHelper.Server),
                                                      AppLanguage.Get("LangMBDisconnectTitle"),
                                                      MessageBoxButton.YesNo,
                                                      MessageBoxImage.Question,
                                                      MessageBoxResult.Yes) != MessageBoxResult.Yes)
                {
                    return;
                }

                ButtonServerConnect.IsEnabled = false;
                TextBoxHostPath.Text          = string.Empty;
                TextBoxHostPath.Items.Clear();
                ServerBackForthStack.Clear();

                await ClientHelper.DisconnectAsync(true);
            }
            else if (ConnectWindow.OK(this))
            {
                ButtonServerConnect.IsEnabled = false;
                AppMessage.Clear();

                if (await ClientHelper.ConnectAsync())
                {
                    await setServerList(ClientHelper.Home);

                    SLTChangePermission.IsEnabled = ClientHelper.Client.IsUnix.HasValue && ClientHelper.Client.IsUnix.Value;
                    ClientHelper.SetSecondaryClient();
                }
            }
        }
Пример #8
0
        private void ButtonHideDetailList_Click(object sender, RoutedEventArgs e)
        {
            DetailListAnimation.Duration = timeSpan3;

            ThicknessAnimation HideButtonMargin = new ThicknessAnimation();

            HideButtonMargin.Duration = timeSpan3;

            if (AppMessage.IsVisible)
            {
                DetailListAnimation.From = DLAniFrom;
                DetailListAnimation.To   = DLTAniTo;

                VisualBrushHideDetailList.Visual = this.GetVisual("appbar_chevron_up");
                ButtonHideDetailList.ToolTip     = AppLanguage.Get("LangButtonShowDetailList");
                AppMessage.IsVisible             = false;
            }
            else
            {
                DetailListAnimation.From         = DLTAniTo;
                DetailListAnimation.To           = DLAniFrom;
                VisualBrushHideDetailList.Visual = this.GetVisual("appbar_chevron_down");
                ButtonHideDetailList.ToolTip     = AppLanguage.Get("LangButtonHideDetailList");
                AppMessage.IsVisible             = true;
            }
            AppSettings.Set("DetailList", "Minimized", !AppMessage.IsVisible);

            DetailListRow.BeginAnimation(RowDefinition.HeightProperty, DetailListAnimation);
            ButtonHideDetailList.BeginAnimation(Button.MarginProperty, HideButtonMargin);
            //VisualBrushHideDetailList
        }
Пример #9
0
        private void _initialize()
        {
            InitializeComponent();

            this.SetWidthHeight("MainWindow", this.MinWidth, this.MinHeight);
            if (AppSettings.Get("MainWindow", "Maximized", false))
            {
                WindowState = WindowState.Maximized;
            }
            else
            {
                this.SetTopLeft("MainWindow");
            }

            if (AppSettings.Get("DetailList", "Minimized", !AppMessage.IsVisible))
            {
                VisualBrushHideDetailList.Visual = this.GetVisual("appbar_chevron_up");
                ButtonHideDetailList.ToolTip     = AppLanguage.Get("LangButtonShowDetailList");
                DetailListRow.Height             = DLTAniTo;
                AppMessage.IsVisible             = false;
            }

            ColumnLocal.Width = new GridLength(AppSettings.Get("MainWindow", "GridSplitter", 235.0));

            //string[] sColumns = new string[] { "ItemName", "Length", "Extension", "Permissions", "LastModified" };

            /*for (int y = 0; y < sColumns.Length; y++)
             *  ((GridView)ServerList.View).Columns.Move(y, AppSettings.Get("ServerList", sColumns[y], y));*/
            AppSettings.SetGridView("ServerList", ServerList.View);
            AppSettings.SetGridView("DetailList", DetailList.View);

            this.Loaded += new RoutedEventHandler(Window_Loaded);
        }
Пример #10
0
        private async void ButtonNewFolder_Click(object sender, RoutedEventArgs e)
        {
            TreeSmartItem sItem = TreeViewFolders.SelectedItem as TreeSmartItem;

            if ((sItem == null) || sItem.HasError)
            {
                return;
            }

            NewFolderWindow NFW = new NewFolderWindow(this, false);

            if (!(bool)NFW.ShowDialog() || NFW.newFolder.NullEmpty())
            {
                return;
            }

            //item.Expanded = true;
            TreeSmartItem item;

            if (sItem.Parent != null)
            {
                item = sItem.Parent;
            }
            else
            {
                item = sItem;
            }

            if (item.HasDummy)
            {
                item.Items.Clear();
                item.HasDummy = false;
            }

            string path = item.FullName;

            PathHelper.AddEndningSlash(ref path);
            TreeSmartItem folder = new TreeSmartItem(NFW.newFolder, path);

            item.Items.Add(folder);

            folder.OptColor  = SolidColors.DarkGreen;
            folder.Operation = AppLanguage.Get("LangOperationCreating");

            if (await ClientHelper.NewFolder(NFW.newFolder, path))
            {
                folder.Selected  = true;
                folder.OptColor  = SolidColors.SolidBlue;
                folder.Operation = AppLanguage.Get("LangOperationCreated");
            }
            else
            {
                folder.Items.Clear();
                folder.HasError  = true;
                folder.OptColor  = SolidColors.DarkRed;
                folder.Operation = AppLanguage.Get("LangOperationCreateError");
                folder.Items.Add(new TreeSmartItem(AppLanguage.Get("LangTextNoFoldersInside"), dummyIcon));
            }
        }
Пример #11
0
 private NewVersionWindow(Window owner)
 {
     this.Owner = owner;
     InitializeComponent();
     TextBlockCurrentVersion.Text   = currentVersion;
     TextBlockNewVersion.Text       = AppLanguage.Get("LangTextBlockNewVersion_x").FormatC(VersionHelper.LatestVersion.ToString());
     CheckBoxCheckVersion.IsChecked = AppSettings.Get("App", "CheckVersion", true);
 }
Пример #12
0
 private AboutWindow(Window owner)
 {
     this.Owner = owner;
     InitializeComponent();
     LabelVersion.Content = AppLanguage.Get("LangLabelVersion").FormatC(AppLanguage.Get("LangTitlePlusFTP"), VersionHelper.AppVersion.ToString());
     HyperlinkHomePage.Inlines.Add(VersionHelper.AppUrlHomePage);
     HyperlinkHomePage.NavigateUri = new Uri(VersionHelper.AppUrlHomePage);
     LabelCopyrightX.Content       = DateTime.Now.Year.String();
 }
Пример #13
0
        private void Connected()
        {
            connecting = false;
            ButtonServerConnect.ToolTip = AppLanguage.Get("LangButtonDisconnect");
            VisualBrushConnect.Visual   = this.GetVisual("appbar_monitor_on");
            this.Title = AppLanguage.Get("LangTitlePlusFTP") + " - " + AppLanguage.RLMARK + "(" + ClientHelper.Server + ")";

            ClientHelper.Counts.Time = new DateTime(0);
        }
Пример #14
0
        private void Connecting()
        {
            connecting = true;
            ButtonServerConnect.ToolTip = AppLanguage.Get("LangButtonCancel");
            VisualBrushConnect.Visual   = this.GetVisual("appbar_monitor_starting");

            this.Title = AppLanguage.Get("LangTitlePlusFTP") + ' ' + AppLanguage.Get("LangTitleConnectingTo") + ' ' + AppLanguage.RLMARK + "(" + ClientHelper.Server + ")";
            ButtonServerConnect.IsEnabled = true;
        }
Пример #15
0
 private void updateTotalFF()
 {
     if (client.TransferEvent.TotalFiles > 0)
     {
         LabelFilesXY.Content = AppLanguage.Get("LangLabelFiles_X_Y").FormatC(client.TransferEvent.TotalTransferredFiles, client.TransferEvent.TotalFiles);
     }
     if (client.TransferEvent.TotalFolders > 0)
     {
         LabelFoldersXY.Content = AppLanguage.Get("LangLabelFolders_X_Y").FormatC(client.TransferEvent.TotalTransferredFolders, client.TransferEvent.TotalFolders);
     }
 }
Пример #16
0
 private void updateMessage()
 {
     if (Shutdown)
     {
         TextBlockMessageText.Text = AppLanguage.Get("LangAutomaticShutdownPCIn_X").FormatC(seconds);
     }
     else
     {
         TextBlockMessageText.Text = AppLanguage.Get("LangAutomaticShutdownAppIn_X").FormatC(seconds);
     }
 }
Пример #17
0
        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();
        }
Пример #18
0
        private void ButtonServerBack_ToolTipOpening(object sender, ToolTipEventArgs e)
        {
            string peek = ServerBackForthStack.PeekBack();

            if (!peek.NullEmpty())
            {
                ButtonServerBack.ToolTip = AppLanguage.Get("LangTextBackToX").FormatC(peek);
            }
            else
            {
                ButtonServerBack.ToolTip = AppLanguage.Get("LangTextBack");
            }
        }
Пример #19
0
        private void ButtonLocalForward_ToolTipOpening(object sender, ToolTipEventArgs e)
        {
            string peek = LocalBackForthStack.PeekForth();

            if (!peek.NullEmpty())
            {
                ButtonLocalForward.ToolTip = AppLanguage.Get("LangTextForwardToX").FormatC(peek);
            }
            else
            {
                ButtonLocalForward.ToolTip = AppLanguage.Get("LangTextForward");
            }
        }
Пример #20
0
        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;
            }
        }
Пример #21
0
        private void Disconnected()
        {
            connecting = false;
            ButtonServerConnect.ToolTip = AppLanguage.Get("LangButtonConnect");
            VisualBrushConnect.Visual   = this.GetVisual("appbar_monitor_off");

            this.Title = AppLanguage.Get("LangTitlePlusFTP");
            ClientHelper.Counts.Items = string.Empty;
            Lock();

            SLProgress.Roll(false);
            ButtonServerConnect.IsEnabled = true;
            ButtonServerConnect.Focus();

            ClientHelper.Counts.Time = null;
        }
Пример #22
0
        private void ButtonOK_Click(object sender, RoutedEventArgs e)
        {
            if (newName.NullEmpty() || (oldName == TextBoxNewName.Text))
            {
                return;
            }

            if (local ? LocalHelper.NameExists(newName) : ClientHelper.NameExists(newName))
            {
                TextBlockNewNameinfo.Text = AppLanguage.Get("LangTextBlockSameNameExists");
            }
            else
            {
                DialogResult = true;
            }
        }
Пример #23
0
        private void SetPhrases()
        {
            AppLanguage.SetCurrentThreadCulture(Thread.CurrentThread);

            LocalHelper.ThisPC = AppLanguage.Get("LangThisPC");

            DaysWord.TodayWord     = AppLanguage.Get("LangTextToday");
            DaysWord.YesterdayWord = AppLanguage.Get("LangTextYesterday");
            DaysWord._set();

            SizeUnit.SizeB  = AppLanguage.Get("LangSizeBytes");
            SizeUnit.SizeKB = AppLanguage.Get("LangSizeKB");
            SizeUnit.SizeMB = AppLanguage.Get("LangSizeMB");
            SizeUnit.SizeGB = AppLanguage.Get("LangSizeGB");
            SizeUnit.SizeTB = AppLanguage.Get("LangSizeTB");

            LabelServerTime.ContentStringFormat = AppLanguage.Get("LangLabelElapsedTime_X");
        }
Пример #24
0
        private void TreeViewItemFolder_Collapsed(object sender, RoutedEventArgs e)
        {
            TreeViewItem treeItem = e.OriginalSource as TreeViewItem;

            if (treeItem == null)
            {
                return;
            }

            TreeSmartItem item = treeItem.Header as TreeSmartItem;

            if ((item == null) || item.HasError)
            {
                return;
            }

            item.Items.Clear();
            item.Items.Add(new TreeSmartItem(AppLanguage.Get("LangTextLoading"), dummyIcon));
        }
Пример #25
0
        private void deleteServerItems()
        {
            SmartItem[] items = ServerList.SelectedItems(ClientHelper.Items);
            if (items == null)
            {
                return;
            }

            if (MessageWindow.Show(this,
                                   AppLanguage.Get("LangMBDelete"),
                                   AppLanguage.Get("LangMBDeleteTitle"),
                                   MessageBoxButton.YesNo,
                                   MessageBoxImage.Question,
                                   MessageBoxResult.Yes) != MessageBoxResult.Yes)
            {
                return;
            }

            ClientHelper.DeleteAsync(items);
        }
Пример #26
0
        private PermissionsWindow(Window owner, SmartItem[] items)
        {
            this.Owner = owner;
            InitializeComponent();

            this.Items = items;

            TextBoxPath.Text          = ClientHelper.CurrentPath;
            LabelPermissionDgit.Text  = items[0].Permissions;
            TextBoxNewPermission.Text = items[0].Permissions;

            LabelPermission.Text = PermParser.GetLetters(items[0].Permissions);

            for (int i = 0; i < items.Length; i++)
            {
                if (!TextBoxFiles.Text.NullEmpty())
                {
                    TextBoxFiles.Text += AppLanguage.Get("LangTextSpaceComma");
                }
                TextBoxFiles.Text += items[i].ItemName;
            }
        }
Пример #27
0
        private void ButtonSelect_Click(object sender, RoutedEventArgs e)
        {
            TreeSmartItem sItem = TreeViewFolders.SelectedItem as TreeSmartItem;

            if ((sItem == null) || sItem.HasError)
            {
                return;
            }

            TreeSmartItem item;

            if (sItem.Parent != null)
            {
                item = sItem.Parent;
            }
            else
            {
                item = sItem;
            }

            string toPath = item.FullName;

            PathHelper.AddEndningSlash(ref toPath);

            if (MessageWindow.Show(this,
                                   AppLanguage.Get("LangMBMove").FormatC(System.Environment.NewLine + toPath),
                                   AppLanguage.Get("LangMBMoveTitle"),
                                   MessageBoxButton.YesNo,
                                   MessageBoxImage.Question,
                                   MessageBoxResult.Yes) != MessageBoxResult.Yes)
            {
                return;
            }

            ClientHelper.MoveAsync(selectedItems, toPath);

            this.Close();
        }
Пример #28
0
        private async void ButtonDelete_Click(object sender, RoutedEventArgs e)
        {
            if (users.Items.Count == 0)
            {
                return;
            }

            if (MessageWindow.Show(this,
                                   AppLanguage.Get("LangMBRemoveAccount"),
                                   AppLanguage.Get("LangMBRemoveAccountTitle"),
                                   MessageBoxButton.YesNo,
                                   MessageBoxImage.Question,
                                   MessageBoxResult.Yes) != MessageBoxResult.Yes)
            {
                return;
            }

            if (users.Items.Count == 1)
            {
                ButtonDelete.IsEnabled = false; ButtonNew.IsEnabled = false;
            }

            int id = users.SelectedIndex;

            users.Items.RemoveAt(id);
            Users.Items.RemoveAt(id);

            if (id > 0)
            {
                users.SelectedIndex = --id;
            }
            else if (users.Items.Count > 0)
            {
                users.SelectedIndex = id;
            }

            await Users.Save();
        }
Пример #29
0
        private bool conformCancel()
        {
            client.Paused = true;
            timer1000.Stop();
            timer200.Stop();
            MiniProgressBar.SetStateColor(ProgressBarExtension.ProgressState.Paused);
            ButtonResume.Visibility = Visibility.Visible;
            ButtonPause.Visibility  = Visibility.Collapsed;
            ButtonSkip.Visibility   = Visibility.Hidden;

            if (MessageWindow.Show(this,
                                   AppLanguage.Get("LangMBCancelTransfer"),
                                   AppLanguage.Get("LangMBDCancelTransferTitle"),
                                   MessageBoxButton.YesNo,
                                   MessageBoxImage.Question,
                                   MessageBoxResult.Yes) != MessageBoxResult.Yes)
            {
                if (ownerClosing || closing)
                {
                    return(false);
                }

                client.Paused = false;
                MiniProgressBar.SetStateColor(ProgressBarExtension.ProgressState.Normal);
                if (started && client.TransferEvent.Item.IsFile)
                {
                    ButtonSkip.Visibility = Visibility.Visible;
                }
                ButtonResume.Visibility = Visibility.Collapsed;
                ButtonPause.Visibility  = Visibility.Visible;
                timer1000.Start();
                timer200.Start();
                return(false);
            }

            return(true);
        }
Пример #30
0
        private async Task addFolders(TreeSmartItem pItem, string path)
        {
            TreeViewFolders.IsEnabled = false;

            SmartItem[] folders = await ClientHelper.Client.GetServerFoldersAsync(path);

            pItem.Items.Clear();

            if (folders == null)
            {
                TreeSmartItem item = new TreeSmartItem(AppLanguage.Get("LangTextError"), dummyIcon);
                item.Parent = pItem;
                pItem.Items.Add(item);
                pItem.HasDummy = true;
            }
            else if (folders.Length > 0)
            {
                TreeSmartItem[] items = new TreeSmartItem[folders.Length];

                for (int i = 0; i < folders.Length; i++)
                {
                    items[i] = new TreeSmartItem(folders[i].ItemName, folders[i].ItemFolder);
                }

                pItem.Items = new ObservableCollection <TreeSmartItem>(items);
            }
            else
            {
                TreeSmartItem item = new TreeSmartItem(AppLanguage.Get("LangTextNoFoldersInside"), dummyIcon);
                item.Parent = pItem;
                pItem.Items.Add(item);
                pItem.HasDummy = true;
            }

            TreeViewFolders.IsEnabled = true;
        }