示例#1
0
        private async void OnConnect(object obj)
        {
            if (IsWorking)
            {
                return;
            }

            Message = "";

            if (GoldDriveList.Count == 0 || string.IsNullOrEmpty(SelectedDrive.Host))
            {
                IsDriveNew    = true;
                SelectedDrive = FreeDriveList.First();
                CurrentPage   = Page.Host;
                return;
            }
            if (ConnectButtonText == "Connect")
            {
                ConnectAsync(SelectedDrive);
            }
            else
            {
                WorkStart("Disconnecting...");
                ReturnBox r = await Task.Run(() => _mountService.Unmount(SelectedDrive));

                WorkDone(r);
            }
        }
示例#2
0
        public async void LoadDrivesAsync()
        {
            Loaded = false;
            WorkStart("Exploring local drives...");
            await Task.Run(() =>
            {
                Settings settings = _mountService.LoadSettings();
                if (_selectedDrive == null && settings.SelectedDrive != null)
                {
                    SelectedDrive = settings.SelectedDrive;
                }
                _mountService.UpdateDrives(settings);
            });

            UpdateObservableDrives();

            if (_mountService.GoldDrives.Count == 0)
            {
                CurrentPage = Page.Host;
                IsDriveNew  = true;
                OnFocusRequested(nameof(SelectedDrive.Host));
                SelectedDrive = FreeDriveList.First();
                WorkDone();
            }
            else
            {
                CheckDriveStatusAsync();
            }
            Loaded = true;
        }
示例#3
0
 private void OnSettingsNew(object obj)
 {
     OriginalDrive = new Drive(SelectedDrive);
     SelectedDrive = FreeDriveList.First();
     IsDriveNew    = true;
 }