Example #1
0
 public ConfigurePageViewModel(IUnityContainer container, IMountUserRepository mountUserRepository)
     : base(container)
 {
     _localConfigInfo         = Container.Resolve <ILocalConfigInfo>();
     _mountUserRepository     = mountUserRepository;
     OpenFolderBrowserCommand = new Command(OpenFolderBrowserCommandExecute, () => _localDiskUser != null);
 }
Example #2
0
        public LoginPageViewModel(IUnityContainer container) : base(container)
        {
            _mountUserRepository = Container.Resolve <IMountUserRepository>();

            LoginServiceAccountCommand   = new Command <PasswordBox>(LoginServiceAccountCommandExecute);
            SignOutServiceAccountCommand = new Command(SignOutServiceAccountCommandExecute);
            LoginBaiduAccountCommand     = new Command(LoginBaiduAccountCommandExecute);
        }
        public OptionPageViewModel(IUnityContainer container, IMountUserRepository mountUserRepository,
                                   ILocalConfigInfo localConfigInfo) : base(container)
        {
            _mountUserRepository = mountUserRepository;
            _localConfigInfo     = localConfigInfo;

            SignOutCommand = new Command(SignOutCommandExecute);
            //BindBaiduAccountCommand = new Command(BindBaiduAccountCommandExecute);

            OpenFolderBrowserCommand = new Command(OpenFolderBrowserCommandExecute, () => _mountUser != null);
        }
Example #4
0
        //private TreeNode<NetDiskFileNodeViewModel> _fileTree;

        public HomeViewModel(IUnityContainer container, IMountUserRepository mountUserRepository)
            : base(container)
        {
            _mountUserRepository = mountUserRepository;

            // TODO: Replace the Command to Prism.Commands.DelegateCommand.
            ReturnFolderCommand      = new Command(() => CurrentFile = CurrentFile.Parent, () => CurrentFile?.Parent != null);
            EnterFolderCommand       = new Command <NetDiskFileNodeViewModel>(file => CurrentFile = file, file => file?.FileType == FileTypeEnum.FolderType);
            BatchDownloadFileCommand = new Command <IList>(BatchDownloadFileCommandExecute, param => GetSeletedItems(param).Any());
            BatchDeleteFileCommand   = new Command <IList>(BatchDeleteFileCommandExecute, param => GetSeletedItems(param).Any());
        }
        public DownloadedPageViewModel(IUnityContainer container, IMountUserRepository mountUserRepository)
            : base(container)
        {
            _mountUserRepository = mountUserRepository;

            ClearAllRecordCommand = new Command(ClearAllRecordCommandExecute, () => DownloadTaskList?.Any() ?? false);
            EventAggregator.GetEvent <DownloadStateChangedEvent>().Subscribe(
                OnDownloadCompleted,
                Prism.Events.ThreadOption.UIThread,
                keepSubscriberReferenceAlive: false,
                filter: e => e.NewState == DownloadStateEnum.Completed);
        }
        public DownloadingPageViewModel(IUnityContainer container, IMountUserRepository mountUserRepository)
            : base(container)
        {
            _mountUserRepository = mountUserRepository;
            Func <bool> isAnyElementInDownloadTaskList = () => DownloadTaskList?.Any() ?? false;

            PauseAllCommand  = new Command(PauseAllCommandExecute, isAnyElementInDownloadTaskList);
            StartAllCommand  = new Command(StartAllCommandExecute, isAnyElementInDownloadTaskList);
            CancelAllCommand = new Command(CancelAllCommandExecute, isAnyElementInDownloadTaskList);

            EventAggregator.GetEvent <DownloadProgressChangedEvent>().Subscribe(OnDownloadPregressChanged, ThreadOption.UIThread);
            EventAggregator.GetEvent <DownloadStateChangedEvent>().Subscribe(OnDownloadStateChanged, ThreadOption.UIThread);
        }
Example #7
0
        public NetDiskFileNodeViewModel(IUnityContainer container, IMountUserRepository mountUserRepository, INetDiskFile netDiskFile)
            : base(container)
        {
            _mountUserRepository = mountUserRepository;
            _netDiskFile         = netDiskFile;

            DeleteFileCommand   = new Command(DeleteFileCommandExecuteAsync);
            DownloadFileCommand = new Command(DownloadFileCommandExecuteAsync);

            EventAggregator.GetEvent <DownloadStateChangedEvent>().Subscribe(
                OnDownloadStateChanged,
                Prism.Events.ThreadOption.UIThread,
                keepSubscriberReferenceAlive: false,
                filter: e => e.FileId == FileId);
            EventAggregator.GetEvent <DownloadProgressChangedEvent>().Subscribe(
                OnDownloadProgressChanged,
                Prism.Events.ThreadOption.UIThread,
                keepSubscriberReferenceAlive: false,
                filter: e => e.FileId == FileId);
        }
Example #8
0
        public HomeViewModel(IUnityContainer container, IMountUserRepository mountUserRepository)
            : base(container)
        {
            _mountUserRepository = mountUserRepository;

            // TODO: Replace the Command to Prism.Commands.DelegateCommand.
            ReturnFolderCommand = new Command(() =>
            {
                CurrentFile  = CurrentFile.Parent;
                IsRefreshing = false;
            }, () => CurrentFile?.Parent != null);
            EnterFolderCommand = new Command <NetDiskFileNodeViewModel>(async file =>
            {
                CurrentFile = file;
                if (CurrentFile.Children == null)
                {
                    await RefreshFileListCommandExecuteAsync();
                }
            }, file => file?.FileType == FileTypeEnum.FolderType);
            RefreshFileListCommand   = new Command(async() => await RefreshFileListCommandExecuteAsync(), () => CurrentFile != null);
            BatchDownloadFileCommand = new Command <IList>(BatchDownloadFileCommandExecute, param => GetSeletedItems(param).Any());
            BatchDeleteFileCommand   = new Command <IList>(BatchDeleteFileCommandExecute, param => GetSeletedItems(param).Any());
        }
 public AccountOptionAreaViewModel(IUnityContainer container, IMountUserRepository mountUserRepository) : base(container)
 {
     _mountUserRepository = mountUserRepository;
     SignOutCommand       = new Command(SignOutCommandExecute);
 }
Example #10
0
 public SignInMountPageViewModel(IUnityContainer container) : base(container)
 {
     _mountUserRepository = Container.Resolve <IMountUserRepository>();
     SignInCommand        = new Command <PasswordBox>(SignInCommandExecute,
                                                      p => !(string.IsNullOrEmpty(Username) || string.IsNullOrEmpty(p.Password)));
 }
 public DownloadOptionAreaViewModel(IUnityContainer container, IMountUserRepository mountUserRepository, ILocalConfigInfo localConfigInfo) : base(container)
 {
     _mountUserRepository     = mountUserRepository;
     _localConfigInfo         = localConfigInfo;
     OpenFolderBrowserCommand = new Command(OpenFolderBrowserCommandExecute, () => _mountUser != null);
 }